@Override public void NotInstr(NotInstr instr) { visit(instr.getOperands()[0]); // SSS FIXME: Does this really require a helper rather than being inlined? jvm.method().invokeHelper("irNot", IRubyObject.class, ThreadContext.class, IRubyObject.class); }
@Override public void NotInstr(NotInstr instr) { visit(instr.getOperands()[0]); // SSS FIXME: Does this really require a helper rather than being inlined? jvm.method().invokeHelper("irNot", IRubyObject.class, ThreadContext.class, IRubyObject.class); }
@Override public void Splat(Splat splat) { jvm.method().loadContext(); visit(splat.getArray()); jvm.method().invokeHelper("irSplat", RubyArray.class, ThreadContext.class, IRubyObject.class); }
@Override public void Splat(Splat splat) { jvm.method().loadContext(); visit(splat.getArray()); jvm.method().invokeHelper("irSplat", RubyArray.class, ThreadContext.class, IRubyObject.class); }
@Override public void CompoundArray(CompoundArray compoundarray) { visit(compoundarray.getAppendingArg()); if (compoundarray.isArgsPush()) jvm.method().adapter.checkcast("org/jruby/RubyArray"); visit(compoundarray.getAppendedArg()); if (compoundarray.isArgsPush()) { jvm.method().invokeHelper("argsPush", RubyArray.class, RubyArray.class, IRubyObject.class); } else { jvm.method().invokeHelper("argsCat", RubyArray.class, IRubyObject.class, IRubyObject.class); } }
@Override public void ProcessModuleBodyInstr(ProcessModuleBodyInstr processmodulebodyinstr) { jvm.method().loadLocal(0); visit(processmodulebodyinstr.getModuleBody()); jvm.method().invokeHelper("invokeModuleBody", IRubyObject.class, ThreadContext.class, CompiledIRMethod.class); jvmStoreLocal(processmodulebodyinstr.getResult()); }
@Override public void ProcessModuleBodyInstr(ProcessModuleBodyInstr processmodulebodyinstr) { jvm.method().loadLocal(0); visit(processmodulebodyinstr.getModuleBody()); jvm.method().invokeHelper("invokeModuleBody", IRubyObject.class, ThreadContext.class, CompiledIRMethod.class); jvmStoreLocal(processmodulebodyinstr.getResult()); }
@Override public void ReceiveOptArgInstr(ReceiveOptArgInstr instr) { // FIXME: Only works when args is in an array rather than being flattened out // FIXME: Missing kwargs 2.0 support (kwArgHashCount value) jvm.method().adapter.pushInt(instr.getArgIndex() + instr.numUsedArgs); // MIN reqd args jvm.method().adapter.pushInt(instr.getArgIndex() + instr.argOffset); // args array offset jvm.method().adapter.aload(3); // FIXME: what is the correct lvar index for args[]? jvm.method().invokeHelper("irLoadOptArg", IRubyObject.class, int.class, int.class, IRubyObject[].class); }
@Override public void ReceiveOptArgInstr(ReceiveOptArgInstr instr) { // FIXME: Only works when args is in an array rather than being flattened out // FIXME: Missing kwargs 2.0 support (kwArgHashCount value) jvm.method().adapter.pushInt(instr.getArgIndex() + instr.numUsedArgs); // MIN reqd args jvm.method().adapter.pushInt(instr.getArgIndex() + instr.argOffset); // args array offset jvm.method().adapter.aload(3); // FIXME: what is the correct lvar index for args[]? jvm.method().invokeHelper("irLoadOptArg", IRubyObject.class, int.class, int.class, IRubyObject[].class); }
@Override public void ToAryInstr(ToAryInstr toaryinstr) { jvm.method().loadContext(); visit(toaryinstr.getArrayArg()); jvm.method().adapter.ldc(toaryinstr.dontToAryArrays()); jvm.method().invokeHelper("irToAry", IRubyObject.class, ThreadContext.class, IRubyObject.class, boolean.class); jvmStoreLocal(toaryinstr.getResult()); }
@Override public void AliasInstr(AliasInstr aliasInstr) { IRBytecodeAdapter m = jvm.method(); m.loadLocal(0); m.loadLocal(getJVMLocalVarIndex(aliasInstr.getReceiver())); m.adapter.ldc(((StringLiteral) aliasInstr.getNewName()).string); m.adapter.ldc(((StringLiteral) aliasInstr.getOldName()).string); m.invokeHelper("defineAlias", IRubyObject.class, ThreadContext.class, IRubyObject.class, Object.class, Object.class); m.adapter.pop(); }
@Override public void AliasInstr(AliasInstr aliasInstr) { IRBytecodeAdapter m = jvm.method(); m.loadLocal(0); m.loadLocal(getJVMLocalVarIndex(aliasInstr.getReceiver())); m.adapter.ldc(((StringLiteral) aliasInstr.getNewName()).string); m.adapter.ldc(((StringLiteral) aliasInstr.getOldName()).string); m.invokeHelper("defineAlias", IRubyObject.class, ThreadContext.class, IRubyObject.class, Object.class, Object.class); m.adapter.pop(); }
@Override public void BEQInstr(BEQInstr beqInstr) { Operand[] args = beqInstr.getOperands(); jvm.method().loadLocal(0); visit(args[0]); visit(args[1]); jvm.method().invokeHelper("BEQ", boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class); jvm.method().adapter.iftrue(getJVMLabel(beqInstr.getJumpTarget())); }
@Override public void BNEInstr(BNEInstr bneinstr) { Operand[] args = bneinstr.getOperands(); jvm.method().loadLocal(0); visit(args[0]); visit(args[1]); jvm.method().invokeHelper("BNE", boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class); jvm.method().adapter.iftrue(getJVMLabel(bneinstr.getJumpTarget())); }
@Override public void BEQInstr(BEQInstr beqInstr) { Operand[] args = beqInstr.getOperands(); jvm.method().loadLocal(0); visit(args[0]); visit(args[1]); jvm.method().invokeHelper("BEQ", boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class); jvm.method().adapter.iftrue(getJVMLabel(beqInstr.getJumpTarget())); }
@Override public void ToAryInstr(ToAryInstr toaryinstr) { jvm.method().loadContext(); visit(toaryinstr.getArrayArg()); jvm.method().adapter.ldc(toaryinstr.dontToAryArrays()); jvm.method().invokeHelper("irToAry", IRubyObject.class, ThreadContext.class, IRubyObject.class, boolean.class); jvmStoreLocal(toaryinstr.getResult()); }
@Override public void BNEInstr(BNEInstr bneinstr) { jvmMethod().loadContext(); visit(bneinstr.getArg1()); visit(bneinstr.getArg2()); jvmMethod().invokeHelper("BNE", boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class); jvmAdapter().iftrue(getJVMLabel(bneinstr.getJumpTarget())); }
@Override public void BNEInstr(BNEInstr bneinstr) { jvmMethod().loadContext(); visit(bneinstr.getArg1()); visit(bneinstr.getArg2()); jvmMethod().invokeHelper("BNE", boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class); jvmAdapter().iftrue(getJVMLabel(bneinstr.getJumpTarget())); }
@Override public void ReceivePostReqdArgInstr(ReceivePostReqdArgInstr instr) { // FIXME: Only works when args is in an array rather than being flattened out // FIXME: Missing kwargs 2.0 support (kwArgHashCount value) jvm.method().loadContext(); jvm.method().adapter.pushInt(instr.getArgIndex()); jvm.method().adapter.pushInt(instr.preReqdArgsCount); jvm.method().adapter.pushInt(instr.postReqdArgsCount); jvm.method().adapter.aload(3); // FIXME: what is the correct lvar index for args[]? jvm.method().invokeHelper("irLoadPostReqdArg", IRubyObject.class, int.class, int.class, int.class, IRubyObject[].class); }
@Override public void ReqdArgMultipleAsgnInstr(ReqdArgMultipleAsgnInstr reqdargmultipleasgninstr) { jvm.method().loadContext(); visit(reqdargmultipleasgninstr.getArrayArg()); jvm.method().adapter.checkcast("org/jruby/RubyArray"); jvm.method().adapter.pushInt(reqdargmultipleasgninstr.getPreArgsCount()); jvm.method().adapter.pushInt(reqdargmultipleasgninstr.getIndex()); jvm.method().adapter.pushInt(reqdargmultipleasgninstr.getPostArgsCount()); jvm.method().invokeHelper("irReqdArgMultipleAsgn", IRubyObject.class, ThreadContext.class, RubyArray.class, int.class, int.class, int.class); jvmStoreLocal(reqdargmultipleasgninstr.getResult()); }