gpt4 book ai didi

org.jruby.ir.instructions.YieldInstr.getResult()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 08:43:31 27 4
gpt4 key购买 nike

本文整理了Java中org.jruby.ir.instructions.YieldInstr.getResult()方法的一些代码示例,展示了YieldInstr.getResult()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldInstr.getResult()方法的具体详情如下:
包路径:org.jruby.ir.instructions.YieldInstr
类名称:YieldInstr
方法名:getResult

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());
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com