public void assignLocalVariable(int index, int depth,boolean expr) { if (depth == 0) { assignLocalVariable(index, expr); } else { assignHeapLocal(depth, index, expr); } }
public void retrieveLocalVariable(int index, int depth) { if (depth == 0) { retrieveLocalVariable(index); } else { retrieveHeapLocal(depth, index); } } }
private void assignLocalVariable(int index, CompilerCallback value, boolean expr) { value.call(methodCompiler); assignLocalVariable(index, expr); }
@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()); } }
private void assignLocalVariable(int index, CompilerCallback value, boolean expr) { value.call(methodCompiler); assignLocalVariable(index, expr); }
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()); } }
public void assignLocalVariable(int index, int depth, CompilerCallback value, boolean expr) { if (depth == 0) { assignLocalVariable(index, value, expr); } else { assignHeapLocal(value, depth, index, expr); } }
public void retrieveLocalVariable(int index, int depth) { if (depth == 0) { retrieveLocalVariable(index); } else { retrieveHeapLocal(depth, index); } } }
public void beginClass(StaticScope scope) { assert scope != null : "compiling a class body with no scope"; // fill in all vars with nil so compiler is happy about future accesses if (scope.getNumberOfVariables() > 0) { // if we don't have opt args, start after args (they will be assigned later) // this is for crap like def foo(a = (b = true; 1)) which numbers b before a // FIXME: only starting after required args, since opt args may access others // and rest args conflicts with compileRoot using "0" to indicate [] signature. int start = scope.getRequiredArgs(); for (int i = start; i < scope.getNumberOfVariables(); i++) { methodCompiler.loadNil(); assignLocalVariable(i, false); } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); } }
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 assignLocalVariable(int index, int depth,boolean expr) { if (depth == 0) { assignLocalVariable(index, expr); } else { assignHeapLocal(depth, index, expr); } }
public void beginClass(StaticScope scope) { assert scope != null : "compiling a class body with no scope"; // fill in all vars with nil so compiler is happy about future accesses if (scope.getNumberOfVariables() > 0) { // if we don't have opt args, start after args (they will be assigned later) // this is for crap like def foo(a = (b = true; 1)) which numbers b before a // FIXME: only starting after required args, since opt args may access others // and rest args conflicts with compileRoot using "0" to indicate [] signature. int start = scope.getRequiredArgs(); for (int i = start; i < scope.getNumberOfVariables(); i++) { methodCompiler.loadNil(); assignLocalVariable(i, false); } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); } }
@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 void assignLocalVariable(int index, int depth, CompilerCallback value, boolean expr) { if (depth == 0) { assignLocalVariable(index, value, expr); } else { assignHeapLocal(value, depth, index, expr); } }
public void beginMethod(CompilerCallback argsCallback, StaticScope scope) { // fill in all vars with nil so compiler is happy about future accesses if (scope.getNumberOfVariables() > 0) { // if we don't have opt args, start after args (they will be assigned later) // this is for crap like def foo(a = (b = true; 1)) which numbers b before a // FIXME: only starting after required args, since opt args may access others // and rest args conflicts with compileRoot using "0" to indicate [] signature. if (scope.getRequiredArgs() < scope.getNumberOfVariables()) { int start = scope.getRequiredArgs(); methodCompiler.loadNil(); for (int i = start; i < scope.getNumberOfVariables(); i++) { if (i + 1 < scope.getNumberOfVariables()) methodCompiler.method.dup(); assignLocalVariable(i, false); } } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); } if (argsCallback != null) { argsCallback.call(methodCompiler); } }
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()); } }
public void beginMethod(CompilerCallback argsCallback, StaticScope scope) { // fill in all vars with nil so compiler is happy about future accesses if (scope.getNumberOfVariables() > 0) { // if we don't have opt args, start after args (they will be assigned later) // this is for crap like def foo(a = (b = true; 1)) which numbers b before a // FIXME: only starting after required args, since opt args may access others // and rest args conflicts with compileRoot using "0" to indicate [] signature. if (scope.getRequiredArgs() < scope.getNumberOfVariables()) { int start = scope.getRequiredArgs(); methodCompiler.loadNil(); for (int i = start; i < scope.getNumberOfVariables(); i++) { if (i + 1 < scope.getNumberOfVariables()) methodCompiler.method.dup(); assignLocalVariable(i, false); } } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); } if (argsCallback != null) { argsCallback.call(methodCompiler); } }
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 beginClosure(CompilerCallback argsCallback, StaticScope scope) { assert scope != null : "compiling a closure body with no scope"; // store the local vars in a local variable methodCompiler.loadThreadContext(); methodCompiler.invokeThreadContext("getCurrentScope", sig(DynamicScope.class)); method.astore(methodCompiler.getDynamicScopeIndex()); boolean first = true; for (int i = 0; i < scope.getNumberOfVariables(); i++) { if (first) { methodCompiler.loadNil(); first = false; } // assign, duping value for all but last assignLocalVariable(i, i + 1 < scope.getNumberOfVariables()); } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); if (argsCallback != null) { // load block methodCompiler.loadRuntime(); method.aload(methodCompiler.getClosureIndex()); methodCompiler.invokeUtilityMethod("processBlockArgument", sig(IRubyObject.class, params(Ruby.class, Block.class))); // load args (the IRubyObject representing incoming normal args) method.aload(argsIndex); argsCallback.call(methodCompiler); } }
public void beginClosure(CompilerCallback argsCallback, StaticScope scope) { assert scope != null : "compiling a closure body with no scope"; // store the local vars in a local variable methodCompiler.loadThreadContext(); methodCompiler.invokeThreadContext("getCurrentScope", sig(DynamicScope.class)); method.astore(methodCompiler.getDynamicScopeIndex()); boolean first = true; for (int i = 0; i < scope.getNumberOfVariables(); i++) { if (first) { methodCompiler.loadNil(); first = false; } // assign, duping value for all but last assignLocalVariable(i, i + 1 < scope.getNumberOfVariables()); } // temp locals must start after last real local tempVariableIndex += scope.getNumberOfVariables(); if (argsCallback != null) { // load block methodCompiler.loadRuntime(); method.aload(methodCompiler.getClosureIndex()); methodCompiler.invokeUtilityMethod("processBlockArgument", sig(IRubyObject.class, params(Ruby.class, Block.class))); // load args (the IRubyObject representing incoming normal args) method.aload(argsIndex); argsCallback.call(methodCompiler); } }