/** Used by cloning code */ /* Inlining generates a new name and id and basic cloning will reuse the originals name */ protected IRClosure(IRClosure c, IRScope lexicalParent, int closureId, RubySymbol fullName) { super(c, lexicalParent); this.closureId = closureId; super.setName(fullName); this.startLabel = getNewLabel(getId() + "_START"); this.endLabel = getNewLabel(getId() + "_END"); if (getManager().isDryRun()) { this.body = null; } else { boolean shouldJit = getManager().getInstanceConfig().getCompileMode().shouldJIT(); this.body = shouldJit ? new MixedModeIRBlockBody(c, c.getSignature()) : new InterpretedIRBlockBody(c, c.getSignature()); } this.signature = c.signature; }
/** Used by cloning code */ /* Inlining generates a new name and id and basic cloning will reuse the originals name */ protected IRClosure(IRClosure c, IRScope lexicalParent, int closureId, RubySymbol fullName) { super(c, lexicalParent); this.closureId = closureId; super.setName(fullName); this.startLabel = getNewLabel(getId() + "_START"); this.endLabel = getNewLabel(getId() + "_END"); if (getManager().isDryRun()) { this.body = null; } else { boolean shouldJit = getManager().getInstanceConfig().getCompileMode().shouldJIT(); this.body = shouldJit ? new MixedModeIRBlockBody(c, c.getSignature()) : new InterpretedIRBlockBody(c, c.getSignature()); } this.signature = c.signature; }
private static void persistScopeHeader(IRWriterEncoder file, IRScope scope) { if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("Writing Scope Header"); file.startEncodingScopeHeader(scope); if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("IRScopeType = " + scope.getScopeType()); file.encode(scope.getScopeType()); // type is enum of kind of scope if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("NAME = " + scope.getName()); file.encode(scope.getName()); if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("Line # = " + scope.getLine()); file.encode(scope.getLine()); if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("# of temp vars = " + scope.getTemporaryVariablesCount()); file.encode(scope.getTemporaryVariablesCount()); persistScopeLabelIndices(scope, file); if (!(scope instanceof IRScriptBody)) file.encode(scope.getLexicalParent()); if (scope instanceof IRClosure) { IRClosure closure = (IRClosure) scope; file.encode(closure.getSignature()); } persistStaticScope(file, scope.getStaticScope()); persistLocalVariables(scope, file); file.endEncodingScopeHeader(scope); }
private static void persistScopeHeader(IRWriterEncoder file, IRScope scope) { if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("Writing Scope Header"); file.startEncodingScopeHeader(scope); if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("IRScopeType = " + scope.getScopeType()); file.encode(scope.getScopeType()); // type is enum of kind of scope if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("NAME = " + scope.getName()); file.encode(scope.getName()); if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("Line # = " + scope.getLine()); file.encode(scope.getLine()); if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("# of temp vars = " + scope.getTemporaryVariablesCount()); file.encode(scope.getTemporaryVariablesCount()); persistScopeLabelIndices(scope, file); if (!(scope instanceof IRScriptBody)) file.encode(scope.getLexicalParent()); if (scope instanceof IRClosure) { IRClosure closure = (IRClosure) scope; file.encode(closure.getSignature()); } persistStaticScope(file, scope.getStaticScope()); persistLocalVariables(scope, file); file.endEncodingScopeHeader(scope); }
@Override public void WrappedIRClosure(WrappedIRClosure wrappedirclosure) { IRClosure closure = wrappedirclosure.getClosure(); jvmMethod().loadContext(); visit(closure.getSelf()); jvmLoadLocal(DYNAMIC_SCOPE); jvmMethod().prepareBlock(closure.getHandle(), closure.getSignature(), jvm.clsData().clsName); }
@Override public void WrappedIRClosure(WrappedIRClosure wrappedirclosure) { IRClosure closure = wrappedirclosure.getClosure(); jvmMethod().loadContext(); visit(closure.getSelf()); jvmLoadLocal(DYNAMIC_SCOPE); jvmMethod().prepareBlock(closure.getHandle(), closure.getSignature(), jvm.clsData().clsName); }
JITCompiler.PUBLIC_LOOKUP.findStatic(sourceClass, jittedName, JVMVisitor.CLOSURE_SIGNATURE.type()), body.getIRScope(), ((IRClosure) body.getIRScope()).getSignature().encode()));
JITCompiler.PUBLIC_LOOKUP.findStatic(sourceClass, jittedName, JVMVisitor.CLOSURE_SIGNATURE.type()), body.getIRScope(), ((IRClosure) body.getIRScope()).getSignature().encode()));
Signature sig = ((IRClosure)scope).getSignature(); int arityValue = sig.arityValue(); if (arityValue == 0) {
Signature sig = ((IRClosure)scope).getSignature(); int arityValue = sig.arityValue(); if (arityValue == 0) {