@Override public Instr clone(CloneInfo ii) { return new DefineClassInstr(ii.getRenamedVariable(result), this.newIRClassBody, getContainer().cloneForInlining(ii), getSuperClass().cloneForInlining(ii)); }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getNewIRClassBody()); e.encode(getContainer()); e.encode(getSuperClass()); }
public Operand getContainer() { return getOperand1(); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Object container = getContainer().retrieve(context, self, currScope, currDynScope, temp); Object superClass = getSuperClass().retrieve(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.newInterpretedClassBody(context, newIRClassBody, container, superClass); }
@Override public void DefineClassInstr(DefineClassInstr defineclassinstr) { IRClassBody newIRClassBody = defineclassinstr.getNewIRClassBody(); jvmMethod().loadContext(); Handle handle = emitModuleBody(newIRClassBody); jvmMethod().pushHandle(handle); jvmAdapter().getstatic(jvm.clsData().clsName, handle.getName() + "_IRScope", ci(IRScope.class)); visit(defineclassinstr.getContainer()); visit(defineclassinstr.getSuperClass()); jvmMethod().invokeIRHelper("newCompiledClassBody", sig(DynamicMethod.class, ThreadContext.class, java.lang.invoke.MethodHandle.class, IRScope.class, Object.class, Object.class)); jvmStoreLocal(defineclassinstr.getResult()); }
@Override public Instr cloneForInlining(InlinerInfo ii) { // SSS FIXME: So, do we clone the class body scope or not? return new DefineClassInstr(ii.getRenamedVariable(result), this.newIRClassBody, container.cloneForInlining(ii), superClass.cloneForInlining(ii)); }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { Object rubyContainer = container.retrieve(context, self, currDynScope, temp); if (!(rubyContainer instanceof RubyModule)) { throw context.runtime.newTypeError("no outer class/module"); } RubyModule newRubyClass = newClass(context, self, (RubyModule) rubyContainer, currDynScope, temp); newIRClassBody.getStaticScope().setModule(newRubyClass); return new InterpretedIRMethod(newIRClassBody, Visibility.PUBLIC, newRubyClass); }
public Operand getSuperClass() { return getOperand2(); }
case CONST_MISSING: return ConstMissingInstr.decode(this); case COPY: return CopyInstr.decode(this); case DEF_CLASS: return DefineClassInstr.decode(this); case DEF_CLASS_METH: return DefineClassMethodInstr.decode(this); case DEF_INST_METH: return DefineInstanceMethodInstr.decode(this);
@Override public void DefineClassInstr(DefineClassInstr defineclassinstr) { IRClassBody newIRClassBody = defineclassinstr.getNewIRClassBody(); jvmMethod().loadContext(); Handle handle = emitModuleBody(newIRClassBody); jvmMethod().pushHandle(handle); jvmAdapter().getstatic(jvm.clsData().clsName, handle.getName() + "_IRScope", ci(IRScope.class)); visit(defineclassinstr.getContainer()); visit(defineclassinstr.getSuperClass()); jvmMethod().invokeIRHelper("newCompiledClassBody", sig(DynamicMethod.class, ThreadContext.class, java.lang.invoke.MethodHandle.class, IRScope.class, Object.class, Object.class)); jvmStoreLocal(defineclassinstr.getResult()); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Object container = getContainer().retrieve(context, self, currScope, currDynScope, temp); Object superClass = getSuperClass().retrieve(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.newInterpretedClassBody(context, newIRClassBody, container, superClass); }
@Override public Instr cloneForInlining(InlinerInfo ii) { // SSS FIXME: So, do we clone the class body scope or not? return new DefineClassInstr(ii.getRenamedVariable(result), this.newIRClassBody, container.cloneForInlining(ii), superClass.cloneForInlining(ii)); }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { Object rubyContainer = container.retrieve(context, self, currDynScope, temp); if (!(rubyContainer instanceof RubyModule)) { throw context.runtime.newTypeError("no outer class/module"); } RubyModule newRubyClass = newClass(context, self, (RubyModule) rubyContainer, currDynScope, temp); newIRClassBody.getStaticScope().setModule(newRubyClass); return new InterpretedIRMethod(newIRClassBody, Visibility.PUBLIC, newRubyClass); }
public Operand getSuperClass() { return getOperand2(); }
case CONST_MISSING: return ConstMissingInstr.decode(this); case COPY: return CopyInstr.decode(this); case DEF_CLASS: return DefineClassInstr.decode(this); case DEF_CLASS_METH: return DefineClassMethodInstr.decode(this); case DEF_INST_METH: return DefineInstanceMethodInstr.decode(this);
@Override public void DefineClassInstr(DefineClassInstr defineclassinstr) { IRClassBody newIRClassBody = defineclassinstr.getNewIRClassBody(); StaticScope scope = newIRClassBody.getStaticScope(); if (scope.getRequiredArgs() > 3 || scope.getRestArg() >= 0 || scope.getOptionalArgs() != 0) { visit(defineclassinstr.getContainer()); m.invokeHelper("checkIsRubyModule", RubyModule.class, ThreadContext.class, Object.class); if (defineclassinstr.getSuperClass() instanceof Nil) { a.aconst_null(); } else { visit(defineclassinstr.getSuperClass()); jvmStoreLocal(defineclassinstr.getResult());
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getNewIRClassBody()); e.encode(getContainer()); e.encode(getSuperClass()); }
@Override public Instr clone(CloneInfo ii) { return new DefineClassInstr(ii.getRenamedVariable(result), this.newIRClassBody, getContainer().cloneForInlining(ii), getSuperClass().cloneForInlining(ii)); }
public static DefineClassInstr decode(IRReaderDecoder d) { return new DefineClassInstr((d.decodeVariable()), (IRClassBody) d.decodeScope(), d.decodeOperand(), d.decodeOperand()); }
public Operand getContainer() { return getOperand1(); }