@Override public void PopMethodFrameInstr(PopMethodFrameInstr popframeinstr) { jvmMethod().loadContext(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void postMethodFrameOnly()")); }
@Override public void PushBackrefFrameInstr(PushBackrefFrameInstr pushframeinstr) { jvmMethod().loadContext(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void preBackrefMethod()")); }
@Override public void PopBackrefFrameInstr(PopBackrefFrameInstr popframeinstr) { jvmMethod().loadContext(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void postBackrefMethod()")); }
@Override public void PopMethodFrameInstr(PopMethodFrameInstr popframeinstr) { jvmMethod().loadContext(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void postMethodFrameOnly()")); }
@Override public void PopBindingInstr(PopBindingInstr popbindinginstr) { jvmMethod().loadContext(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void popScope()")); }
@Override public void PopBackrefFrameInstr(PopBackrefFrameInstr popframeinstr) { jvmMethod().loadContext(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void postBackrefMethod()")); }
@Override public void PushBackrefFrameInstr(PushBackrefFrameInstr pushframeinstr) { jvmMethod().loadContext(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void preBackrefMethod()")); }
@Override public void PopBindingInstr(PopBindingInstr popbindinginstr) { jvmMethod().loadContext(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void popScope()")); }
@Override public void BlockGivenInstr(BlockGivenInstr blockGivenInstr) { jvm.method().loadRuntime(); visit(blockGivenInstr.getBlockArg()); jvm.method().invokeVirtual(Type.getType(Block.class), Method.getMethod("boolean isGiven()")); jvm.method().invokeVirtual(Type.getType(Ruby.class), Method.getMethod("org.jruby.RubyBoolean newBoolean(boolean)")); jvmStoreLocal(blockGivenInstr.getResult()); }
@Override public void BlockGivenInstr(BlockGivenInstr blockGivenInstr) { jvm.method().loadRuntime(); visit(blockGivenInstr.getBlockArg()); jvm.method().invokeVirtual(Type.getType(Block.class), Method.getMethod("boolean isGiven()")); jvm.method().invokeVirtual(Type.getType(Ruby.class), Method.getMethod("org.jruby.RubyBoolean newBoolean(boolean)")); jvmStoreLocal(blockGivenInstr.getResult()); }
@Override public void CheckArgsArrayArityInstr(CheckArgsArrayArityInstr checkargsarrayarityinstr) { jvmMethod().loadContext(); visit(checkargsarrayarityinstr.getArgsArray()); jvmAdapter().pushInt(checkargsarrayarityinstr.required); jvmAdapter().pushInt(checkargsarrayarityinstr.opt); jvmAdapter().pushBoolean(checkargsarrayarityinstr.rest); jvmMethod().invokeStatic(Type.getType(Helpers.class), Method.getMethod("void irCheckArgsArrayArity(org.jruby.runtime.ThreadContext, org.jruby.RubyArray, int, int, boolean)")); }
@Override public void CheckArgsArrayArityInstr(CheckArgsArrayArityInstr checkargsarrayarityinstr) { jvmMethod().loadContext(); visit(checkargsarrayarityinstr.getArgsArray()); jvmAdapter().pushInt(checkargsarrayarityinstr.required); jvmAdapter().pushInt(checkargsarrayarityinstr.opt); jvmAdapter().pushBoolean(checkargsarrayarityinstr.rest); jvmMethod().invokeStatic(Type.getType(Helpers.class), Method.getMethod("void irCheckArgsArrayArity(org.jruby.runtime.ThreadContext, org.jruby.RubyArray, int, int, boolean)")); }
@Override public void CheckArgsArrayArityInstr(CheckArgsArrayArityInstr checkargsarrayarityinstr) { jvm.method().loadContext(); visit(checkargsarrayarityinstr.getArgsArray()); jvm.method().adapter.pushInt(checkargsarrayarityinstr.required); jvm.method().adapter.pushInt(checkargsarrayarityinstr.opt); jvm.method().adapter.pushInt(checkargsarrayarityinstr.rest); jvm.method().invokeStatic(Type.getType(Helpers.class), Method.getMethod("void irCheckArgsArrayArity(org.jruby.runtime.ThreadContext, org.jruby.RubyArray, int, int, int)")); }
@Override public void CheckArgsArrayArityInstr(CheckArgsArrayArityInstr checkargsarrayarityinstr) { jvm.method().loadContext(); visit(checkargsarrayarityinstr.getArgsArray()); jvm.method().adapter.pushInt(checkargsarrayarityinstr.required); jvm.method().adapter.pushInt(checkargsarrayarityinstr.opt); jvm.method().adapter.pushInt(checkargsarrayarityinstr.rest); jvm.method().invokeStatic(Type.getType(Helpers.class), Method.getMethod("void irCheckArgsArrayArity(org.jruby.runtime.ThreadContext, org.jruby.RubyArray, int, int, int)")); }
@Override public void ConstMissingInstr(ConstMissingInstr constmissinginstr) { visit(constmissinginstr.getReceiver()); jvm.method().adapter.checkcast("org/jruby/RubyModule"); jvm.method().loadContext(); jvm.method().adapter.ldc("const_missing"); jvm.method().pushSymbol(constmissinginstr.getMissingConst()); jvm.method().invokeVirtual(Type.getType(RubyModule.class), Method.getMethod("org.jruby.runtime.builtin.IRubyObject callMethod(org.jruby.runtime.ThreadContext, java.lang.String, org.jruby.runtime.builtin.IRubyObject)")); }
@Override public void ConstMissingInstr(ConstMissingInstr constmissinginstr) { visit(constmissinginstr.getReceiver()); jvm.method().adapter.checkcast("org/jruby/RubyModule"); jvm.method().loadContext(); jvm.method().adapter.ldc("const_missing"); jvm.method().pushSymbol(constmissinginstr.getMissingConst()); jvm.method().invokeVirtual(Type.getType(RubyModule.class), Method.getMethod("org.jruby.runtime.builtin.IRubyObject callMethod(org.jruby.runtime.ThreadContext, java.lang.String, org.jruby.runtime.builtin.IRubyObject)")); }
@Override public void ConstMissingInstr(ConstMissingInstr constmissinginstr) { visit(constmissinginstr.getReceiver()); jvmAdapter().checkcast("org/jruby/RubyModule"); jvmMethod().loadContext(); jvmAdapter().ldc("const_missing"); jvmMethod().pushSymbol(constmissinginstr.getMissingConst().getBytes()); jvmMethod().invokeVirtual(Type.getType(RubyModule.class), Method.getMethod("org.jruby.runtime.builtin.IRubyObject callMethod(org.jruby.runtime.ThreadContext, java.lang.String, org.jruby.runtime.builtin.IRubyObject)")); jvmStoreLocal(constmissinginstr.getResult()); }
@Override public void ConstMissingInstr(ConstMissingInstr constmissinginstr) { visit(constmissinginstr.getReceiver()); jvmAdapter().checkcast("org/jruby/RubyModule"); jvmMethod().loadContext(); jvmAdapter().ldc("const_missing"); jvmMethod().pushSymbol(constmissinginstr.getMissingConst().getBytes()); jvmMethod().invokeVirtual(Type.getType(RubyModule.class), Method.getMethod("org.jruby.runtime.builtin.IRubyObject callMethod(org.jruby.runtime.ThreadContext, java.lang.String, org.jruby.runtime.builtin.IRubyObject)")); jvmStoreLocal(constmissinginstr.getResult()); }
@Override public void EnsureRubyArrayInstr(EnsureRubyArrayInstr ensurerubyarrayinstr) { visit(ensurerubyarrayinstr.getObject()); jvm.method().adapter.dup(); org.objectweb.asm.Label after = new org.objectweb.asm.Label(); jvm.method().adapter.instance_of("org/jruby/RubyArray"); jvm.method().adapter.iftrue(after); jvm.method().adapter.swap(); jvm.method().loadRuntime(); jvm.method().adapter.ldc(false); jvm.method().invokeStatic(Type.getType(ArgsUtil.class), Method.getMethod("org.jruby.RubyArray convertToRubyArray(org.jruby.Ruby, org.jruby.runtime.builtin.IRubyObject, boolean)")); jvm.method().adapter.label(after); jvmStoreLocal(ensurerubyarrayinstr.getResult()); }
@Override public void PushMethodFrameInstr(PushMethodFrameInstr pushframeinstr) { jvmMethod().loadContext(); jvmMethod().loadFrameClass(); jvmMethod().loadFrameName(); jvmMethod().loadSelf(); jvmMethod().loadBlock(); jvmMethod().invokeVirtual(Type.getType(ThreadContext.class), Method.getMethod("void preMethodFrameOnly(org.jruby.RubyModule, String, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.Block)")); // FIXME: this should be part of explicit call protocol only when needed, optimizable, and correct for the scope // See also CompiledIRMethod.call jvmMethod().loadContext(); jvmAdapter().getstatic(p(Visibility.class), pushframeinstr.getVisibility().name(), ci(Visibility.class)); jvmAdapter().invokevirtual(p(ThreadContext.class), "setCurrentVisibility", sig(void.class, Visibility.class)); }