Ejemplo n.º 1
0
  public static IRubyObject INTERPRET_METHOD(
      ThreadContext context,
      CFG cfg,
      InterpreterContext interp,
      String name,
      RubyModule implClass,
      boolean isTraceable) {
    Ruby runtime = interp.getRuntime();
    boolean syntheticMethod = name == null || name.equals("");

    try {
      String className = implClass.getName();
      if (!syntheticMethod)
        ThreadContext.pushBacktrace(context, className, name, context.getFile(), context.getLine());
      if (isTraceable) methodPreTrace(runtime, context, name, implClass);
      return interpret(context, cfg, interp);
    } finally {
      if (isTraceable) {
        try {
          methodPostTrace(runtime, context, name, implClass);
        } finally {
          if (!syntheticMethod) ThreadContext.popBacktrace(context);
        }
      } else {
        if (!syntheticMethod) ThreadContext.popBacktrace(context);
      }
    }
  }
Ejemplo n.º 2
0
  private IRubyObject INTERPRET_METHOD(
      ThreadContext context,
      InterpreterContext ic,
      RubyModule implClass,
      IRubyObject self,
      String name,
      IRubyObject arg1,
      IRubyObject arg2,
      IRubyObject arg3,
      Block block) {
    try {
      ThreadContext.pushBacktrace(context, name, ic.getFileName(), context.getLine());

      if (ic.hasExplicitCallProtocol()) {
        return ic.engine.interpret(
            context, self, ic, implClass, name, arg1, arg2, arg3, block, null);
      } else {
        try {
          this.pre(ic, context, self, name, block, implClass);
          return ic.engine.interpret(
              context, self, ic, implClass, name, arg1, arg2, arg3, block, null);
        } finally {
          this.post(ic, context);
        }
      }
    } finally {
      ThreadContext.popBacktrace(context);
    }
  }
Ejemplo n.º 3
0
  public static IRubyObject INTERPRET_METHOD(
      ThreadContext context,
      InterpretedIRMethod irMethod,
      IRubyObject self,
      String name,
      IRubyObject[] args,
      Block block,
      Block.Type blockType,
      boolean isTraceable) {
    Ruby runtime = context.runtime;
    IRScope scope = irMethod.getIRMethod();
    RubyModule implClass = irMethod.getImplementationClass();
    Visibility viz = irMethod.getVisibility();
    boolean syntheticMethod = name == null || name.equals("");

    try {
      if (!syntheticMethod)
        ThreadContext.pushBacktrace(context, name, scope.getFileName(), context.getLine());
      if (isTraceable) methodPreTrace(runtime, context, name, implClass);
      return interpret(context, self, scope, viz, implClass, args, block, blockType);
    } finally {
      if (isTraceable) {
        try {
          methodPostTrace(runtime, context, name, implClass);
        } finally {
          if (!syntheticMethod) ThreadContext.popBacktrace(context);
        }
      } else {
        if (!syntheticMethod) ThreadContext.popBacktrace(context);
      }
    }
  }
Ejemplo n.º 4
0
 public static IRubyObject INTERPRET_METHOD(
     Ruby runtime,
     ThreadContext context,
     String file,
     int line,
     RubyModule implClass,
     Node node,
     String name,
     IRubyObject self,
     Block block,
     boolean isTraceable) {
   try {
     ThreadContext.pushBacktrace(context, name, file, line);
     if (isTraceable) methodPreTrace(runtime, context, name, implClass);
     return node.interpret(runtime, context, self, block);
   } finally {
     if (isTraceable) {
       try {
         methodPostTrace(runtime, context, name, implClass);
       } finally {
         ThreadContext.popBacktrace(context);
       }
     } else {
       ThreadContext.popBacktrace(context);
     }
   }
 }
Ejemplo n.º 5
0
 public static IRubyObject INTERPRET_EVAL(
     Ruby runtime, ThreadContext context, Node node, String name, IRubyObject self, Block block) {
   try {
     ThreadContext.pushBacktrace(context, name, node.getPosition());
     return node.interpret(runtime, context, self, block);
   } finally {
     ThreadContext.popBacktrace(context);
   }
 }
Ejemplo n.º 6
0
 public static IRubyObject INTERPRET_BLOCK(
     ThreadContext context,
     IRubyObject self,
     IRScope scope,
     IRubyObject[] args,
     String name,
     Block block,
     Block.Type blockType) {
   try {
     ThreadContext.pushBacktrace(context, name, scope.getFileName(), context.getLine());
     return interpret(context, self, scope, null, null, args, block, blockType);
   } finally {
     ThreadContext.popBacktrace(context);
   }
 }
Ejemplo n.º 7
0
 public static IRubyObject INTERPRET_BLOCK(
     Ruby runtime,
     ThreadContext context,
     String file,
     int line,
     Node node,
     String name,
     IRubyObject self,
     Block block) {
   try {
     ThreadContext.pushBacktrace(context, name, file, line);
     blockPreTrace(runtime, context, name, self.getType());
     return node.interpret(runtime, context, self, block);
   } finally {
     blockPostTrace(runtime, context, name, self.getType());
     ThreadContext.popBacktrace(context);
   }
 }