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 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; }
public void rethrowException() { loadException(); method.athrow(); }
public void cacheSpecialClosure(BaseBodyCompiler method, String closureMethod) { method.loadThis(); if (inheritedBlockCallbackCount < AbstractScript.NUMBERED_BLOCKCALLBACK_COUNT) { method.method.ldc(closureMethod); method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockCallback" + inheritedBlockCallbackCount, sig(CompiledBlockCallback.class, String.class)); } else { method.method.pushInt(inheritedBlockCallbackCount); method.method.ldc(closureMethod); method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockCallback", sig(CompiledBlockCallback.class, int.class, String.class)); } inheritedBlockCallbackCount++; }
public BaseBodyCompiler(StandardASMCompiler scriptCompiler, String methodName, String rubyName, ASTInspector inspector, StaticScope scope, int scopeIndex) { this.script = scriptCompiler; this.scope = scope; this.inspector = inspector; this.methodName = methodName; this.rubyName = rubyName; this.argParamCount = getActualArgsCount(scope); method = new SkinnyMethodAdapter(script.getClassVisitor(), ACC_PUBLIC | ACC_STATIC, methodName, getSignature(), null, null); createVariableCompiler(); invocationCompiler = OptoFactory.newInvocationCompiler(this, method); this.scopeIndex = scopeIndex; }
protected void createVariableCompiler() { if (inspector == null) { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, false, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } else if (inspector.hasClosure() || inspector.hasScopeAwareMethods()) { variableCompiler = new HeapBasedVariableCompiler(this, method, scope, false, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } else { variableCompiler = new StackBasedVariableCompiler(this, method, scope, false, StandardASMCompiler.ARGS_INDEX, getFirstTempIndex()); } }
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()); } }
@Override 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 static InvocationCompiler newInvocationCompiler(BaseBodyCompiler bodyCompiler, SkinnyMethodAdapter method) { if (tryIndy) { try { return new InvokeDynamicInvocationCompiler(bodyCompiler, method); } catch (Error e) { tryIndy = false; throw e; } catch (Throwable t) { tryIndy = false; } } return new StandardInvocationCompiler(bodyCompiler, method); }
public static CacheCompiler newCacheCompiler(StandardASMCompiler scriptCompiler) { if (tryIndy) { try { return new InvokeDynamicCacheCompiler(scriptCompiler); } catch (Error e) { tryIndy = false; throw e; } catch (Throwable t) { tryIndy = false; } } return new InheritedCacheCompiler(scriptCompiler); }
public void invokeBinaryBooleanFixnumRHS(String name, CompilerCallback receiverCallback, long fixnum) { invokeBinaryFixnumRHS(name, receiverCallback, fixnum); methodCompiler.isTrue(); }
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; }
public void cacheSpecialClosure(BaseBodyCompiler method, String closureMethod) { method.loadThis(); if (inheritedBlockCallbackCount < AbstractScript.NUMBERED_BLOCKCALLBACK_COUNT) { method.method.ldc(closureMethod); method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockCallback" + inheritedBlockCallbackCount, sig(CompiledBlockCallback.class, String.class)); } else { method.method.pushInt(inheritedBlockCallbackCount); method.method.ldc(closureMethod); method.method.invokevirtual(scriptCompiler.getClassname(), "getBlockCallback", sig(CompiledBlockCallback.class, int.class, String.class)); } inheritedBlockCallbackCount++; }
public BaseBodyCompiler(StandardASMCompiler scriptCompiler, String methodName, String rubyName, ASTInspector inspector, StaticScope scope, int scopeIndex) { this.script = scriptCompiler; this.scope = scope; this.inspector = inspector; this.methodName = methodName; this.rubyName = rubyName; this.argParamCount = getActualArgsCount(scope); method = new SkinnyMethodAdapter(script.getClassVisitor(), ACC_PUBLIC | ACC_STATIC, methodName, getSignature(), null, null); createVariableCompiler(); invocationCompiler = OptoFactory.newInvocationCompiler(this, method); this.scopeIndex = scopeIndex; }
public void rethrowException() { loadException(); method.athrow(); }
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 static InvocationCompiler newInvocationCompiler(BaseBodyCompiler bodyCompiler, SkinnyMethodAdapter method) { if (tryIndy) { try { return new InvokeDynamicInvocationCompiler(bodyCompiler, method); } catch (Error e) { tryIndy = false; throw e; } catch (Throwable t) { tryIndy = false; } } return new StandardInvocationCompiler(bodyCompiler, method); }
public static CacheCompiler newCacheCompiler(StandardASMCompiler scriptCompiler) { if (tryIndy) { try { return new InvokeDynamicCacheCompiler(scriptCompiler); } catch (Error e) { tryIndy = false; throw e; } catch (Throwable t) { tryIndy = false; } } return new InheritedCacheCompiler(scriptCompiler); }
public void invokeBinaryBooleanFixnumRHS(String name, CompilerCallback receiverCallback, long fixnum) { invokeBinaryFixnumRHS(name, receiverCallback, fixnum); methodCompiler.isTrue(); }
public void loadStaticScope(BaseBodyCompiler method, int index) { method.loadThis(); if (scopeCount < AbstractScript.NUMBERED_SCOPE_COUNT) { // use numbered access method method.method.invokevirtual(scriptCompiler.getClassname(), "getScope" + index, sig(StaticScope.class)); } else { method.method.pushInt(index); method.method.invokevirtual(scriptCompiler.getClassname(), "getScope", sig(StaticScope.class, int.class)); } }