@Override public Instr clone(CloneInfo ii) { return new NoResultCallInstr(ii.getScope(), getOperation(), getCallType(), getName(), getReceiver().cloneForInlining(ii), cloneCallArgs(ii), getClosureArg() == null ? null : getClosureArg().cloneForInlining(ii), isPotentiallyRefined(), getCallSite(), getCallSiteId()); }
public static NoResultCallInstr create(IRScope scope, CallType callType, RubySymbol name, Operand receiver, Operand[] args, Operand closure, boolean isPotentiallyRefined) { if (closure == null && !containsArgSplat(args) && args.length == 1) { return new OneOperandArgNoBlockNoResultCallInstr(scope, callType, name, receiver, args, null, isPotentiallyRefined); } return new NoResultCallInstr(scope, Operation.NORESULT_CALL, callType, name, receiver, args, closure, isPotentiallyRefined); }
@Override public CallBase specializeForInterpretation() { Operand[] callArgs = getCallArgs(); if (hasClosure() || containsSplat(callArgs)) return this; switch (callArgs.length) { // case 0: // return new ZeroOperandArgNoBlockNoResultCallInstr(this); case 1: // if (isAllFixnums()) return new OneFixnumArgNoBlockNoResultCallInstr(this); return new OneOperandArgNoBlockNoResultCallInstr(this); } return this; }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new NoResultCallInstr(getOperation(), getCallType(), (MethAddr) getMethodAddr().cloneForInlining(ii), receiver.cloneForInlining(ii), cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii)); }
@Override public void NoResultCallInstr(NoResultCallInstr noResultCallInstr) { IRBytecodeAdapter m = jvm.method(); m.loadLocal(0); visit(noResultCallInstr.getReceiver()); for (Operand operand : noResultCallInstr.getCallArgs()) { visit(operand); } switch (noResultCallInstr.getCallType()) { case FUNCTIONAL: case VARIABLE: m.invokeSelf(noResultCallInstr.getMethodAddr().getName(), noResultCallInstr.getCallArgs().length); break; case NORMAL: m.invokeOther(noResultCallInstr.getMethodAddr().getName(), noResultCallInstr.getCallArgs().length); break; case SUPER: m.invokeSuper(noResultCallInstr.getMethodAddr().getName(), noResultCallInstr.getCallArgs().length); break; } m.adapter.pop(); }
public NoResultCallInstr(Operation op, NoResultCallInstr instr) { this(op, instr.getCallType(), instr.methAddr, instr.receiver, instr.arguments, instr.closure); }
public Instr discardResult() { return new NoResultCallInstr(Operation.NORESULT_CALL, getCallType(), getMethodAddr(), getReceiver(), getCallArgs(), closure); }
public static NoResultCallInstr decode(IRReaderDecoder d) { int callTypeOrdinal = d.decodeInt(); if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("decoding call, ordinal: "+ callTypeOrdinal); RubySymbol name = d.decodeSymbol(); if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("decoding call, methaddr: "+ name); Operand receiver = d.decodeOperand(); int argsCount = d.decodeInt(); boolean hasClosureArg = argsCount < 0; int argsLength = hasClosureArg ? (-1 * (argsCount + 1)) : argsCount; if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("ARGS: " + argsLength + ", CLOSURE: " + hasClosureArg); Operand[] args = new Operand[argsLength]; for (int i = 0; i < argsLength; i++) { args[i] = d.decodeOperand(); } Operand closure = hasClosureArg ? d.decodeOperand() : null; return NoResultCallInstr.create(d.getCurrentScope(), CallType.fromOrdinal(callTypeOrdinal), name, receiver, args, closure, d.getCurrentScope().maybeUsingRefinements()); }
case NOP: return NopInstr.NOP; case NORESULT_CALL: case NORESULT_CALL_1O: return NoResultCallInstr.decode(this); case POP_BINDING: return PopBindingInstr.decode(this); case POP_METHOD_FRAME: return PopMethodFrameInstr.decode(this);
@Override public Instr cloneForInlining(InlinerInfo ii) { return new NoResultCallInstr(getOperation(), getCallType(), (MethAddr) getMethodAddr().cloneForInlining(ii), receiver.cloneForInlining(ii), cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii)); }
@Override public void NoResultCallInstr(NoResultCallInstr noResultCallInstr) { IRBytecodeAdapter m = jvm.method(); m.loadLocal(0); visit(noResultCallInstr.getReceiver()); for (Operand operand : noResultCallInstr.getCallArgs()) { visit(operand); } switch (noResultCallInstr.getCallType()) { case FUNCTIONAL: case VARIABLE: m.invokeSelf(noResultCallInstr.getMethodAddr().getName(), noResultCallInstr.getCallArgs().length); break; case NORMAL: m.invokeOther(noResultCallInstr.getMethodAddr().getName(), noResultCallInstr.getCallArgs().length); break; case SUPER: m.invokeSuper(noResultCallInstr.getMethodAddr().getName(), noResultCallInstr.getCallArgs().length); break; } m.adapter.pop(); }
public NoResultCallInstr(Operation op, NoResultCallInstr instr) { this(op, instr.getCallType(), instr.methAddr, instr.receiver, instr.arguments, instr.closure); }
public Instr discardResult() { return new NoResultCallInstr(Operation.NORESULT_CALL, getCallType(), getMethodAddr(), getReceiver(), getCallArgs(), closure); }
public static NoResultCallInstr decode(IRReaderDecoder d) { int callTypeOrdinal = d.decodeInt(); if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("decoding call, ordinal: "+ callTypeOrdinal); RubySymbol name = d.decodeSymbol(); if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("decoding call, methaddr: "+ name); Operand receiver = d.decodeOperand(); int argsCount = d.decodeInt(); boolean hasClosureArg = argsCount < 0; int argsLength = hasClosureArg ? (-1 * (argsCount + 1)) : argsCount; if (RubyInstanceConfig.IR_READING_DEBUG) System.out.println("ARGS: " + argsLength + ", CLOSURE: " + hasClosureArg); Operand[] args = new Operand[argsLength]; for (int i = 0; i < argsLength; i++) { args[i] = d.decodeOperand(); } Operand closure = hasClosureArg ? d.decodeOperand() : null; return NoResultCallInstr.create(d.getCurrentScope(), CallType.fromOrdinal(callTypeOrdinal), name, receiver, args, closure, d.getCurrentScope().maybeUsingRefinements()); }
case NOP: return NopInstr.NOP; case NORESULT_CALL: case NORESULT_CALL_1O: return NoResultCallInstr.decode(this); case POP_BINDING: return PopBindingInstr.decode(this); case POP_METHOD_FRAME: return PopMethodFrameInstr.decode(this);
@Override public Instr clone(CloneInfo ii) { return new NoResultCallInstr(ii.getScope(), getOperation(), getCallType(), getName(), getReceiver().cloneForInlining(ii), cloneCallArgs(ii), getClosureArg() == null ? null : getClosureArg().cloneForInlining(ii), isPotentiallyRefined(), getCallSite(), getCallSiteId()); }
public static NoResultCallInstr create(IRScope scope, CallType callType, RubySymbol name, Operand receiver, Operand[] args, Operand closure, boolean isPotentiallyRefined) { if (closure == null && !containsArgSplat(args) && args.length == 1) { return new OneOperandArgNoBlockNoResultCallInstr(scope, callType, name, receiver, args, null, isPotentiallyRefined); } return new NoResultCallInstr(scope, Operation.NORESULT_CALL, callType, name, receiver, args, closure, isPotentiallyRefined); }
@Override public CallBase specializeForInterpretation() { Operand[] callArgs = getCallArgs(); if (hasClosure() || containsSplat(callArgs)) return this; switch (callArgs.length) { // case 0: // return new ZeroOperandArgNoBlockNoResultCallInstr(this); case 1: // if (isAllFixnums()) return new OneFixnumArgNoBlockNoResultCallInstr(this); return new OneOperandArgNoBlockNoResultCallInstr(this); } return this; }