本文整理了Java中org.jruby.ir.instructions.YieldInstr.getBlockArg()
方法的一些代码示例,展示了YieldInstr.getBlockArg()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldInstr.getBlockArg()
方法的具体详情如下:
包路径:org.jruby.ir.instructions.YieldInstr
类名称:YieldInstr
方法名:getBlockArg
暂无
代码示例来源:origin: org.jruby/jruby-complete
@Override
public Instr clone(CloneInfo ii) {
// FIXME: Is it necessary to clone a yield instruction in a method
// that is being inlined, i.e. in METHOD_INLINE clone mode?
// Fix BasicBlock.java:clone!!
return new YieldInstr(ii.getRenamedVariable(result), getBlockArg().cloneForInlining(ii),
getYieldArg().cloneForInlining(ii), unwrapArray);
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public Instr clone(CloneInfo ii) {
// FIXME: Is it necessary to clone a yield instruction in a method
// that is being inlined, i.e. in METHOD_INLINE clone mode?
// Fix BasicBlock.java:clone!!
return new YieldInstr(ii.getRenamedVariable(result), getBlockArg().cloneForInlining(ii),
getYieldArg().cloneForInlining(ii), unwrapArray);
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public void encode(IRWriterEncoder e) {
super.encode(e);
e.encode(getBlockArg());
e.encode(getYieldArg());
e.encode(isUnwrapArray());
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public void encode(IRWriterEncoder e) {
super.encode(e);
e.encode(getBlockArg());
e.encode(getYieldArg());
e.encode(isUnwrapArray());
}
代码示例来源:origin: org.jruby/jruby-core
@Interp
@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
Block blk = (Block)getBlockArg().retrieve(context, self, currScope, currDynScope, temp);
if (getYieldArg() == UndefinedValue.UNDEFINED) {
return IRRuntimeHelpers.yieldSpecific(context, blk);
} else {
Operand yieldOp = getYieldArg();
if (unwrapArray && yieldOp instanceof Array && ((Array)yieldOp).size() > 1) {
// Special case this path!
// Don't build a RubyArray.
return blk.yieldValues(context, ((Array)yieldOp).retrieveArrayElts(context, self, currScope, currDynScope, temp));
} else {
IRubyObject yieldVal = (IRubyObject) yieldOp.retrieve(context, self, currScope, currDynScope, temp);
return IRRuntimeHelpers.yield(context, blk, yieldVal, unwrapArray);
}
}
}
代码示例来源:origin: org.jruby/jruby-complete
@Interp
@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
Block blk = (Block)getBlockArg().retrieve(context, self, currScope, currDynScope, temp);
if (getYieldArg() == UndefinedValue.UNDEFINED) {
return IRRuntimeHelpers.yieldSpecific(context, blk);
} else {
Operand yieldOp = getYieldArg();
if (unwrapArray && yieldOp instanceof Array && ((Array)yieldOp).size() > 1) {
// Special case this path!
// Don't build a RubyArray.
return blk.yieldValues(context, ((Array)yieldOp).retrieveArrayElts(context, self, currScope, currDynScope, temp));
} else {
IRubyObject yieldVal = (IRubyObject) yieldOp.retrieve(context, self, currScope, currDynScope, temp);
return IRRuntimeHelpers.yield(context, blk, yieldVal, unwrapArray);
}
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public void YieldInstr(YieldInstr yieldinstr) {
visit(yieldinstr.getBlockArg());
// TODO: proc, nil block logic
jvm.method().loadLocal(0);
if (yieldinstr.getYieldArg() == UndefinedValue.UNDEFINED) {
jvm.method().adapter.invokevirtual(p(Block.class), "yieldSpecific", sig(IRubyObject.class, ThreadContext.class));
} else {
visit(yieldinstr.getYieldArg());
// TODO: if yielding array, call yieldArray
jvm.method().adapter.invokevirtual(p(Block.class), "yield", sig(IRubyObject.class, ThreadContext.class, IRubyObject.class));
}
jvmStoreLocal(yieldinstr.getResult());
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
public void YieldInstr(YieldInstr yieldinstr) {
visit(yieldinstr.getBlockArg());
// TODO: proc, nil block logic
jvm.method().loadLocal(0);
if (yieldinstr.getYieldArg() == UndefinedValue.UNDEFINED) {
jvm.method().adapter.invokevirtual(p(Block.class), "yieldSpecific", sig(IRubyObject.class, ThreadContext.class));
} else {
visit(yieldinstr.getYieldArg());
// TODO: if yielding array, call yieldArray
jvm.method().adapter.invokevirtual(p(Block.class), "yield", sig(IRubyObject.class, ThreadContext.class, IRubyObject.class));
}
jvmStoreLocal(yieldinstr.getResult());
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public void YieldInstr(YieldInstr yieldinstr) {
jvmMethod().loadContext();
visit(yieldinstr.getBlockArg());
if (yieldinstr.getYieldArg() == UndefinedValue.UNDEFINED) {
jvmMethod().yieldSpecific();
} else {
Operand yieldOp = yieldinstr.getYieldArg();
if (yieldinstr.isUnwrapArray() && yieldOp instanceof Array && ((Array) yieldOp).size() > 1) {
Array yieldValues = (Array) yieldOp;
for (Operand yieldValue : yieldValues) {
visit(yieldValue);
}
jvmMethod().yieldValues(yieldValues.size());
} else {
visit(yieldinstr.getYieldArg());
jvmMethod().yield(yieldinstr.isUnwrapArray());
}
}
jvmStoreLocal(yieldinstr.getResult());
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public void YieldInstr(YieldInstr yieldinstr) {
jvmMethod().loadContext();
visit(yieldinstr.getBlockArg());
if (yieldinstr.getYieldArg() == UndefinedValue.UNDEFINED) {
jvmMethod().yieldSpecific();
} else {
Operand yieldOp = yieldinstr.getYieldArg();
if (yieldinstr.isUnwrapArray() && yieldOp instanceof Array && ((Array) yieldOp).size() > 1) {
Array yieldValues = (Array) yieldOp;
for (Operand yieldValue : yieldValues) {
visit(yieldValue);
}
jvmMethod().yieldValues(yieldValues.size());
} else {
visit(yieldinstr.getYieldArg());
jvmMethod().yield(yieldinstr.isUnwrapArray());
}
}
jvmStoreLocal(yieldinstr.getResult());
}
内容来源于网络,如有侵权,请联系作者删除!