public BodyCompiler startMethod(String rubyName, String javaName, CompilerCallback args, StaticScope scope, ASTInspector inspector, int scopeIndex) { RootScopedBodyCompiler methodCompiler = new MethodBodyCompiler(this, rubyName, javaName, inspector, scope, scopeIndex); methodCompiler.beginMethod(args, scope); return methodCompiler; }
public void performReturn() { if (inRescue) { // returning from rescue, clear $! clearErrorInfo(); } // normal return for method body. return jump for within a begin/rescue/ensure if (inNestedMethod) { loadThreadContext(); invokeUtilityMethod("throwReturnJump", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class)); } else { method.areturn(); } }
protected void createVariableCompiler() { if (inspector == null) { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, specificArity, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } else if (inspector.hasClosure() || inspector.hasScopeAwareMethods()) { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, specificArity, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } else { variableCompiler = new StackBasedVariableCompiler(this, method, scope, specificArity, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } }
public void issueRedoEvent() { if (currentLoopLabels != null) { issueLoopRedo(); } else if (inNestedMethod) { invokeUtilityMethod("redoJump", sig(IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); invokeUtilityMethod("redoLocalJumpError", sig(IRubyObject.class, Ruby.class)); } } }
public void issueBreakEvent(CompilerCallback value) { if (currentLoopLabels != null) { value.call(this); issueLoopBreak(); } else if (inNestedMethod) { loadThreadContext(); value.call(this); invokeUtilityMethod("breakJump", sig(IRubyObject.class, ThreadContext.class, IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); value.call(this); invokeUtilityMethod("breakLocalJumpError", sig(IRubyObject.class, Ruby.class, IRubyObject.class)); } }
classBody.method.trycatch(start, end, after, null); classBody.beginMethod(null, staticScope); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceClass(); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceEnd(); classBody.loadThreadContext(); classBody.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); classBody.method.athrow(); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceEnd(); classBody.loadThreadContext(); classBody.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); classBody.endBody();
method.pop(); loadThis(); loadThreadContext(); loadSelf(); method.invokestatic(script.getClassname(), methodName, getSignature()); method.areturn(); method.end();
public void issueNextEvent(CompilerCallback value) { if (currentLoopLabels != null) { value.call(this); issueLoopNext(); } else if (inNestedMethod) { value.call(this); invokeUtilityMethod("nextJump", sig(IRubyObject.class, IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); value.call(this); invokeUtilityMethod("nextLocalJumpError", sig(IRubyObject.class, Ruby.class, IRubyObject.class)); } }
public ChainedRootBodyCompiler outline(String methodName) { // chain to the next segment of this giant method method.aload(StandardASMCompiler.THIS); // load all arguments straight through for (int i = 1; i <= getClosureIndex(); i++) { method.aload(i); } // we append an index to ensure two identical method names will not conflict methodName = "chained_" + script.getAndIncrementMethodIndex() + "_" + methodName; method.invokestatic(script.getClassname(), methodName, getSignature()); ChainedRootBodyCompiler methodCompiler = new ChainedRootBodyCompiler(script, methodName, rubyName, inspector, scope, this); methodCompiler.beginChainedMethod(); return methodCompiler; }
classBody.method.trycatch(start, end, after, null); classBody.beginMethod(null, staticScope); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceClass(); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceEnd(); classBody.loadThreadContext(); classBody.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); classBody.method.athrow(); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceEnd(); classBody.loadThreadContext(); classBody.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); classBody.endBody();
public void issueBreakEvent(CompilerCallback value) { if (currentLoopLabels != null) { value.call(this); issueLoopBreak(); } else if (inNestedMethod) { loadThreadContext(); value.call(this); invokeUtilityMethod("breakJump", sig(IRubyObject.class, ThreadContext.class, IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); value.call(this); invokeUtilityMethod("breakLocalJumpError", sig(IRubyObject.class, Ruby.class, IRubyObject.class)); } }
method.pop(); loadThis(); loadThreadContext(); loadSelf(); method.invokestatic(script.getClassname(), methodName, getSignature()); method.areturn(); method.end();
public void issueRedoEvent() { if (currentLoopLabels != null) { issueLoopRedo(); } else if (inNestedMethod) { invokeUtilityMethod("redoJump", sig(IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); invokeUtilityMethod("redoLocalJumpError", sig(IRubyObject.class, Ruby.class)); } } }
public void issueNextEvent(CompilerCallback value) { if (currentLoopLabels != null) { value.call(this); issueLoopNext(); } else if (inNestedMethod) { value.call(this); invokeUtilityMethod("nextJump", sig(IRubyObject.class, IRubyObject.class)); } else { // in method body with no containing loop, issue jump error // load runtime and value, issue jump error loadRuntime(); value.call(this); invokeUtilityMethod("nextLocalJumpError", sig(IRubyObject.class, Ruby.class, IRubyObject.class)); } }
public ChainedRootBodyCompiler outline(String methodName) { // chain to the next segment of this giant method method.aload(StandardASMCompiler.THIS); // load all arguments straight through for (int i = 1; i <= getClosureIndex(); i++) { method.aload(i); } // we append an index to ensure two identical method names will not conflict methodName = "chained_" + script.getAndIncrementMethodIndex() + "_" + methodName; method.invokestatic(script.getClassname(), methodName, getSignature()); ChainedRootBodyCompiler methodCompiler = new ChainedRootBodyCompiler(script, methodName, rubyName, inspector, scope, this); methodCompiler.beginChainedMethod(); return methodCompiler; }
classBody.method.trycatch(start, end, after, null); classBody.beginMethod(null, staticScope); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceClass(); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceEnd(); classBody.loadThreadContext(); classBody.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceEnd(); classBody.loadThreadContext(); classBody.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); classBody.method.athrow(); classBody.endBody();
public void performReturn() { if (inRescue) { // returning from rescue, clear $! clearErrorInfo(); } // normal return for method body. return jump for within a begin/rescue/ensure if (inNestedMethod) { loadThreadContext(); invokeUtilityMethod("throwReturnJump", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class)); } else { method.areturn(); } }
protected void createVariableCompiler() { if (inspector == null) { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, specificArity, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } else if (inspector.hasClosure() || inspector.hasScopeAwareMethods()) { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, specificArity, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } else { variableCompiler = new StackBasedVariableCompiler(this, method, scope, specificArity, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } }
public BodyCompiler startMethod(String rubyName, String javaName, CompilerCallback args, StaticScope scope, ASTInspector inspector, int scopeIndex) { RootScopedBodyCompiler methodCompiler = new MethodBodyCompiler(this, rubyName, javaName, inspector, scope, scopeIndex); methodCompiler.beginMethod(args, scope); return methodCompiler; }
classBody.method.trycatch(start, end, after, null); classBody.beginMethod(null, staticScope); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceClass(); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceEnd(); classBody.loadThreadContext(); classBody.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); if (RubyInstanceConfig.FULL_TRACE_ENABLED) classBody.traceEnd(); classBody.loadThreadContext(); classBody.invokeThreadContext("postCompiledClass", sig(Void.TYPE, params())); classBody.method.athrow(); classBody.endBody();