本文整理了Java中org.jruby.ir.instructions.YieldInstr.getResult()
方法的一些代码示例,展示了YieldInstr.getResult()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldInstr.getResult()
方法的具体详情如下:
包路径:org.jruby.ir.instructions.YieldInstr
类名称:YieldInstr
方法名:getResult
暂无
代码示例来源:origin: org.jruby/jruby-complete
public void setupYieldArgsAndYieldResult(YieldInstr yi, BasicBlock yieldBB, int blockArityValue) {
Operand yieldInstrArg = yi.getYieldArg();
if ((yieldInstrArg == UndefinedValue.UNDEFINED) || blockArityValue == 0) {
yieldArg = new Array(); // Zero-elt array
} else if (yieldInstrArg instanceof Array) {
yieldArg = yieldInstrArg;
// 1:1 arg match
if (((Array) yieldInstrArg).size() == blockArityValue) canMapArgsStatically = true;
} else if (blockArityValue == 1 && yi.unwrapArray == false) {
yieldArg = yieldInstrArg;
canMapArgsStatically = true;
} else {
// SSS FIXME: The code below is not entirely correct. We have to process 'yi.getYieldArg()' similar
// to how InterpretedIRBlockBody (1.8 and 1.9 modes) processes it. We may need a special instruction
// that takes care of aligning the stars and bringing good fortune to arg yielder and arg receiver.
IRScope callerScope = getHostScope();
Variable yieldArgArray = callerScope.createTemporaryVariable();
yieldBB.addInstr(new ToAryInstr(yieldArgArray, yieldInstrArg));
yieldArg = yieldArgArray;
}
yieldResult = yi.getResult();
}
代码示例来源:origin: org.jruby/jruby-core
public void setupYieldArgsAndYieldResult(YieldInstr yi, BasicBlock yieldBB, int blockArityValue) {
Operand yieldInstrArg = yi.getYieldArg();
if ((yieldInstrArg == UndefinedValue.UNDEFINED) || blockArityValue == 0) {
yieldArg = new Array(); // Zero-elt array
} else if (yieldInstrArg instanceof Array) {
yieldArg = yieldInstrArg;
// 1:1 arg match
if (((Array) yieldInstrArg).size() == blockArityValue) canMapArgsStatically = true;
} else if (blockArityValue == 1 && yi.unwrapArray == false) {
yieldArg = yieldInstrArg;
canMapArgsStatically = true;
} else {
// SSS FIXME: The code below is not entirely correct. We have to process 'yi.getYieldArg()' similar
// to how InterpretedIRBlockBody (1.8 and 1.9 modes) processes it. We may need a special instruction
// that takes care of aligning the stars and bringing good fortune to arg yielder and arg receiver.
IRScope callerScope = getHostScope();
Variable yieldArgArray = callerScope.createTemporaryVariable();
yieldBB.addInstr(new ToAryInstr(yieldArgArray, yieldInstrArg));
yieldArg = yieldArgArray;
}
yieldResult = yi.getResult();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public void setupYieldArgsAndYieldResult(YieldInstr yi, BasicBlock yieldBB, Arity blockArity) {
int blockArityValue = blockArity.getValue();
Operand yieldInstrArg = yi.getYieldArg();
if ((yieldInstrArg == UndefinedValue.UNDEFINED) || (blockArityValue == 0)) {
this.yieldArg = new Array(); // Zero-elt array
} else if (yieldInstrArg instanceof Array) {
this.yieldArg = yieldInstrArg;
// 1:1 arg match
if (((Array)yieldInstrArg).size() == blockArityValue) canMapArgsStatically = true;
} else {
// SSS FIXME: The code below is not entirely correct. We have to process 'yi.getYieldArg()' similar
// to how InterpretedIRBlockBody (1.8 and 1.9 modes) processes it. We may need a special instruction
// that takes care of aligning the stars and bringing good fortune to arg yielder and arg receiver.
IRScope callerScope = getInlineHostScope();
boolean needSpecialProcessing = (blockArityValue != -1) && (blockArityValue != 1);
Variable yieldArgArray = callerScope.getNewTemporaryVariable();
yieldBB.addInstr(new ToAryInstr(yieldArgArray, yieldInstrArg, callerScope.getManager().getTrue()));
this.yieldArg = yieldArgArray;
}
this.yieldResult = yi.getResult();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public void setupYieldArgsAndYieldResult(YieldInstr yi, BasicBlock yieldBB, Arity blockArity) {
int blockArityValue = blockArity.getValue();
Operand yieldInstrArg = yi.getYieldArg();
if ((yieldInstrArg == UndefinedValue.UNDEFINED) || (blockArityValue == 0)) {
this.yieldArg = new Array(); // Zero-elt array
} else if (yieldInstrArg instanceof Array) {
this.yieldArg = yieldInstrArg;
// 1:1 arg match
if (((Array)yieldInstrArg).size() == blockArityValue) canMapArgsStatically = true;
} else {
// SSS FIXME: The code below is not entirely correct. We have to process 'yi.getYieldArg()' similar
// to how InterpretedIRBlockBody (1.8 and 1.9 modes) processes it. We may need a special instruction
// that takes care of aligning the stars and bringing good fortune to arg yielder and arg receiver.
IRScope callerScope = getInlineHostScope();
boolean needSpecialProcessing = (blockArityValue != -1) && (blockArityValue != 1);
Variable yieldArgArray = callerScope.getNewTemporaryVariable();
yieldBB.addInstr(new ToAryInstr(yieldArgArray, yieldInstrArg, callerScope.getManager().getTrue()));
this.yieldArg = yieldArgArray;
}
this.yieldResult = yi.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: 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.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());
}
内容来源于网络,如有侵权,请联系作者删除!