@Override public String toString() { return getOperation() + "(" + returnValue + ", <" + (methodToReturnFrom == null ? "-NULL-" : methodToReturnFrom.getName()) + ">" + ")"; }
@Override public String toString() { return getOperation() + "(" + returnValue + ", <" + (methodToReturnFrom == null ? "-NULL-" : methodToReturnFrom.getName()) + ">" + ")"; }
@Override public String toString() { return getOperation() + "(" + container + ", " + method.getName() + ", " + method.getFileName() + ")"; }
@Override public String toString() { return getOperation() + "(" + container + ", " + method.getName() + ", " + method.getFileName() + ")"; }
@Override public String toString() { return getOperation() + "(" + container + ", " + method.getName() + ", " + method.getFileName() + ")"; }
@Override public String toString() { return getOperation() + "(" + container + ", " + method.getName() + ", " + method.getFileName() + ")"; }
public void emit(IRMethod method) { String name = emitScope(method, method.getName(), method.getCallArgs().length); // push a method handle for binding purposes jvm.method().pushHandle(jvm.clsData().clsName, name, method.getStaticScope().getRequiredArgs()); }
public void emit(IRMethod method) { String name = emitScope(method, method.getName(), method.getCallArgs().length); // push a method handle for binding purposes jvm.method().pushHandle(jvm.clsData().clsName, name, method.getStaticScope().getRequiredArgs()); }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { String name = method.getName(); Ruby runtime = context.runtime; RubyObject obj = (RubyObject) container.retrieve(context, self, currDynScope, temp); if (obj instanceof RubyFixnum || obj instanceof RubySymbol) { throw runtime.newTypeError("can't define singleton method \"" + name + "\" for " + obj.getMetaClass().getBaseName()); } if (obj.isFrozen()) throw runtime.newFrozenError("object"); RubyClass rubyClass = obj.getSingletonClass(); rubyClass.addMethod(name, new InterpretedIRMethod(method, Visibility.PUBLIC, rubyClass)); obj.callMethod(context, "singleton_method_added", runtime.fastNewSymbol(name)); return null; }
String name = method.getName();
String name = method.getName();
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { String name = method.getName(); Ruby runtime = context.runtime; RubyObject obj = (RubyObject) container.retrieve(context, self, currDynScope, temp); if (obj instanceof RubyFixnum || obj instanceof RubySymbol) { throw runtime.newTypeError("can't define singleton method \"" + name + "\" for " + obj.getMetaClass().getBaseName()); } if (obj.isFrozen()) throw runtime.newFrozenError("object"); RubyClass rubyClass = obj.getSingletonClass(); rubyClass.addMethod(name, new InterpretedIRMethod(method, Visibility.PUBLIC, rubyClass)); obj.callMethod(context, "singleton_method_added", runtime.fastNewSymbol(name)); return null; }
public Operand buildReturn(ReturnNode returnNode) { Operand retVal = build(returnNode.getValueNode()); if (scope instanceof IRClosure) { // Closures return behavior has several cases (which depend on runtime state): // 1. closure in method (return). !method (error) except if in define_method (return) // 2. lambda (return) [dynamic] // FIXME: I believe ->() can be static and omit LJE check. // 3. migrated closure (LJE) [dynamic] // 4. eval/for (return) [static] boolean definedWithinMethod = scope.getNearestMethod() != null; if (!(scope instanceof IREvalScript) && !(scope instanceof IRFor)) addInstr(new CheckForLJEInstr(definedWithinMethod)); addInstr(new NonlocalReturnInstr(retVal, definedWithinMethod ? scope.getNearestMethod().getName() : manager.runtime.newSymbol("--none--"))); } else if (scope.isModuleBody()) { IRMethod sm = scope.getNearestMethod(); // Cannot return from top-level module bodies! if (sm == null) addInstr(new ThrowExceptionInstr(IRException.RETURN_LocalJumpError)); if (sm != null) addInstr(new NonlocalReturnInstr(retVal, sm.getName())); } else { retVal = processEnsureRescueBlocks(retVal); if (RubyInstanceConfig.FULL_TRACE_ENABLED) { addInstr(new TraceInstr(RubyEvent.RETURN, getName(), getFileName(), returnNode.getLine())); } addInstr(new ReturnInstr(retVal)); } // The value of the return itself in the containing expression can never be used because of control-flow reasons. // The expression that uses this result can never be executed beyond the return and hence the value itself is just // a placeholder operand. return U_NIL; }
public Operand buildReturn(ReturnNode returnNode) { Operand retVal = build(returnNode.getValueNode()); if (scope instanceof IRClosure) { // Closures return behavior has several cases (which depend on runtime state): // 1. closure in method (return). !method (error) except if in define_method (return) // 2. lambda (return) [dynamic] // FIXME: I believe ->() can be static and omit LJE check. // 3. migrated closure (LJE) [dynamic] // 4. eval/for (return) [static] boolean definedWithinMethod = scope.getNearestMethod() != null; if (!(scope instanceof IREvalScript) && !(scope instanceof IRFor)) addInstr(new CheckForLJEInstr(definedWithinMethod)); addInstr(new NonlocalReturnInstr(retVal, definedWithinMethod ? scope.getNearestMethod().getName() : manager.runtime.newSymbol("--none--"))); } else if (scope.isModuleBody()) { IRMethod sm = scope.getNearestMethod(); // Cannot return from top-level module bodies! if (sm == null) addInstr(new ThrowExceptionInstr(IRException.RETURN_LocalJumpError)); if (sm != null) addInstr(new NonlocalReturnInstr(retVal, sm.getName())); } else { retVal = processEnsureRescueBlocks(retVal); if (RubyInstanceConfig.FULL_TRACE_ENABLED) { addInstr(new TraceInstr(RubyEvent.RETURN, getName(), getFileName(), returnNode.getLine())); } addInstr(new ReturnInstr(retVal)); } // The value of the return itself in the containing expression can never be used because of control-flow reasons. // The expression that uses this result can never be executed beyond the return and hence the value itself is just // a placeholder operand. return U_NIL; }