public BuildLambdaInstr(Variable lambda, IRClosure lambdaBody, ISourcePosition position) { super(Operation.LAMBDA); this.result = lambda; this.operands = new Operand[] { new WrappedIRClosure(lambdaBody) }; this.position = position; }
private IRClosure getLambdaBody() { return ((WrappedIRClosure) operands[0]).getClosure(); }
public static void runBeginBlocks(List<IRClosure> beBlocks, ThreadContext context, IRubyObject self, StaticScope currScope, Object[] temp) { if (beBlocks == null) return; for (IRClosure b: beBlocks) { // SSS FIXME: Should I piggyback on WrappedIRClosure.retrieve or just copy that code here? Block blk = (Block)(new WrappedIRClosure(b.getSelf(), b)).retrieve(context, self, currScope, context.getCurrentScope(), temp); blk.yield(context, null); } }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Block blk = (Block) getEndBlockClosure().retrieve(context, self, currScope, context.getCurrentScope(), temp); IRRuntimeHelpers.pushExitBlock(context, blk); return null; }
@Override public Instr clone(CloneInfo ii) { // SSS FIXME: Correct in all situations?? return new RecordEndBlockInstr(declaringScope, (WrappedIRClosure) getEndBlockClosure().cloneForInlining(ii)); }
case UNDEFINED_VALUE: return UndefinedValue.UNDEFINED; case UNEXECUTABLE_NIL: return UnexecutableNil.U_NIL; case WRAPPED_IR_CLOSURE: return WrappedIRClosure.decode(this);
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Block blk = (Block) getEndBlockClosure().retrieve(context, self, currScope, context.getCurrentScope(), temp); IRRuntimeHelpers.pushExitBlock(context, blk); return null; }
@Override public Instr clone(CloneInfo ii) { // SSS FIXME: Correct in all situations?? return new RecordEndBlockInstr(declaringScope, (WrappedIRClosure) getEndBlockClosure().cloneForInlining(ii)); }
case UNDEFINED_VALUE: return UndefinedValue.UNDEFINED; case UNEXECUTABLE_NIL: return UnexecutableNil.U_NIL; case WRAPPED_IR_CLOSURE: return WrappedIRClosure.decode(this);
private IRClosure getLambdaBody() { return ((WrappedIRClosure) operands[0]).getClosure(); }
public BuildLambdaInstr(Variable lambda, IRClosure lambdaBody, ISourcePosition position) { super(Operation.LAMBDA); this.result = lambda; this.operands = new Operand[] { new WrappedIRClosure(lambdaBody) }; this.position = position; }
public static void runBeginEndBlocks(List<IRClosure> beBlocks, ThreadContext context, IRubyObject self, Object[] temp) { if (beBlocks == null) return; for (IRClosure b: beBlocks) { // SSS FIXME: Should I piggyback on WrappedIRClosure.retrieve or just copy that code here? b.prepareForInterpretation(false); Block blk = (Block)(new WrappedIRClosure(b)).retrieve(context, self, context.getCurrentScope(), temp); blk.yield(context, null); } }
public void WrappedIRClosure(WrappedIRClosure wrappedirclosure) { print(wrappedirclosure.getClosure().getId()); }
@Override public Operand getSimplifiedOperand(Map<Operand, Operand> valueMap, boolean force) { Operand newSelf = self.getSimplifiedOperand(valueMap, force); return newSelf == self ? this : new WrappedIRClosure((Variable)newSelf, closure); }
public static void runBeginEndBlocks(List<IRClosure> beBlocks, ThreadContext context, IRubyObject self, Object[] temp) { if (beBlocks == null) return; for (IRClosure b: beBlocks) { // SSS FIXME: Should I piggyback on WrappedIRClosure.retrieve or just copy that code here? b.prepareForInterpretation(false); Block blk = (Block)(new WrappedIRClosure(b)).retrieve(context, self, context.getCurrentScope(), temp); blk.yield(context, null); } }
public void WrappedIRClosure(WrappedIRClosure wrappedirclosure) { print(wrappedirclosure.getClosure().getId()); }
@Override public Operand getSimplifiedOperand(Map<Operand, Operand> valueMap, boolean force) { Operand newSelf = self.getSimplifiedOperand(valueMap, force); return newSelf == self ? this : new WrappedIRClosure((Variable)newSelf, closure); }
public static void runBeginBlocks(List<IRClosure> beBlocks, ThreadContext context, IRubyObject self, StaticScope currScope, Object[] temp) { if (beBlocks == null) return; for (IRClosure b: beBlocks) { // SSS FIXME: Should I piggyback on WrappedIRClosure.retrieve or just copy that code here? Block blk = (Block)(new WrappedIRClosure(b.getSelf(), b)).retrieve(context, self, currScope, context.getCurrentScope(), temp); blk.yield(context, null); } }
/** * Wrapped IRClosures in dead BB are lexically rooted to that dead BB so they can * be removed from the parent scope if the BB they live in died. */ private void removeNestedScopesFromBB(BasicBlock bb) { for (Instr instr: bb.getInstrs()) { for (Operand oper: instr.getOperands()) { if (oper instanceof WrappedIRClosure) { scope.removeClosure(((WrappedIRClosure) oper).getClosure()); break; // Only one WrappedIRClosure possible per instr } } } }
@Override public Operand cloneForInlining(InlinerInfo ii) { return new WrappedIRClosure(closure.cloneForClonedInstr(ii)); }