@Override public Instr clone(CloneInfo ii) { return new BlockGivenInstr(ii.getRenamedVariable(result), getBlockArg().cloneForInlining(ii)); }
public Operand getBlockArg() { return getOperand1(); }
@Override public void BlockGivenInstr(BlockGivenInstr blockGivenInstr) { jvmMethod().loadContext(); visit(blockGivenInstr.getBlockArg()); jvmMethod().invokeIRHelper("isBlockGiven", sig(RubyBoolean.class, ThreadContext.class, Object.class)); jvmStoreLocal(blockGivenInstr.getResult()); }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new BlockGivenInstr(ii.getRenamedVariable(result), blockArg.cloneForInlining(ii)); }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getBlockArg()); }
case BINDING_LOAD: return LoadLocalVarInstr.decode(this); case BINDING_STORE: return StoreLocalVarInstr.decode(this); case BLOCK_GIVEN: return BlockGivenInstr.decode(this); case BNE: return BNEInstr.decode(this); case BREAK: return BreakInstr.decode(this);
@Override public void BlockGivenInstr(BlockGivenInstr blockGivenInstr) { jvmMethod().loadContext(); visit(blockGivenInstr.getBlockArg()); jvmMethod().invokeIRHelper("isBlockGiven", sig(RubyBoolean.class, ThreadContext.class, Object.class)); jvmStoreLocal(blockGivenInstr.getResult()); }
public static BlockGivenInstr decode(IRReaderDecoder d) { return new BlockGivenInstr(d.decodeVariable(), d.decodeOperand()); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Object blk = getBlockArg().retrieve(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.isBlockGiven(context, blk); }
case BINDING_LOAD: return LoadLocalVarInstr.decode(this); case BINDING_STORE: return StoreLocalVarInstr.decode(this); case BLOCK_GIVEN: return BlockGivenInstr.decode(this); case BNE: return BNEInstr.decode(this); case BREAK: return BreakInstr.decode(this);
@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 Instr clone(CloneInfo ii) { return new BlockGivenInstr(ii.getRenamedVariable(result), getBlockArg().cloneForInlining(ii)); }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new BlockGivenInstr(ii.getRenamedVariable(result), blockArg.cloneForInlining(ii)); }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getBlockArg()); }
public Operand getBlockArg() { return getOperand1(); }
@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()); }
public static BlockGivenInstr decode(IRReaderDecoder d) { return new BlockGivenInstr(d.decodeVariable(), d.decodeOperand()); }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { Object blk = getBlockArg().retrieve(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.isBlockGiven(context, blk); }
return buildDefinitionCheck(s, new HasInstanceVarInstr(s.getNewTemporaryVariable(), getSelf(s), new StringLiteral(((InstVarNode) node).getName())), "instance-variable"); case YIELDNODE: return buildDefinitionCheck(s, new BlockGivenInstr(s.getNewTemporaryVariable(), s.getImplicitBlockArg()), "yield"); case BACKREFNODE: return buildDefinitionCheck(s, new BackrefIsMatchDataInstr(s.getNewTemporaryVariable()), "$" + ((BackRefNode) node).getType());
return buildDefinitionCheck(s, new HasInstanceVarInstr(s.getNewTemporaryVariable(), getSelf(s), new StringLiteral(((InstVarNode) node).getName())), "instance-variable"); case YIELDNODE: return buildDefinitionCheck(s, new BlockGivenInstr(s.getNewTemporaryVariable(), s.getImplicitBlockArg()), "yield"); case BACKREFNODE: return buildDefinitionCheck(s, new BackrefIsMatchDataInstr(s.getNewTemporaryVariable()), "$" + ((BackRefNode) node).getType());