コード例 #1
0
 private void processFixedGuardAndMerge(
     FixedGuardNode fixedGuard,
     PhaseContext context,
     CompareNode compare,
     ValueNode x,
     ValuePhiNode xPhi,
     ValueNode y,
     ValuePhiNode yPhi,
     AbstractMergeNode merge) {
   List<EndNode> mergePredecessors = merge.cfgPredecessors().snapshot();
   for (int i = 0; i < mergePredecessors.size(); ++i) {
     AbstractEndNode mergePredecessor = mergePredecessors.get(i);
     if (!mergePredecessor.isAlive()) {
       break;
     }
     Constant xs;
     if (xPhi == null) {
       xs = x.asConstant();
     } else {
       xs = xPhi.valueAt(mergePredecessor).asConstant();
     }
     Constant ys;
     if (yPhi == null) {
       ys = y.asConstant();
     } else {
       ys = yPhi.valueAt(mergePredecessor).asConstant();
     }
     if (xs != null
         && ys != null
         && compare
                 .condition()
                 .foldCondition(xs, ys, context.getConstantReflection(), compare.unorderedIsTrue())
             == fixedGuard.isNegated()) {
       visitDeoptBegin(
           AbstractBeginNode.prevBegin(mergePredecessor),
           fixedGuard.getAction(),
           fixedGuard.getReason(),
           fixedGuard.getSpeculation(),
           fixedGuard.graph());
     }
   }
 }
コード例 #2
0
  private void processFixedGuardAndPhis(
      FixedGuardNode fixedGuard,
      PhaseContext context,
      CompareNode compare,
      ValueNode x,
      ValuePhiNode xPhi,
      ValueNode y,
      ValuePhiNode yPhi) {
    AbstractBeginNode pred = AbstractBeginNode.prevBegin(fixedGuard);
    if (pred instanceof AbstractMergeNode) {
      AbstractMergeNode merge = (AbstractMergeNode) pred;
      if (xPhi != null && xPhi.merge() != merge) {
        return;
      }
      if (yPhi != null && yPhi.merge() != merge) {
        return;
      }

      processFixedGuardAndMerge(fixedGuard, context, compare, x, xPhi, y, yPhi, merge);
    }
  }