コード例 #1
0
 private ValueNode op(ValueNode b, ValueNode o) {
   if (value instanceof AddNode) {
     return add(graph(), b, o);
   }
   if (value instanceof SubNode) {
     if (base.valueNode() == value.getX()) {
       return sub(graph(), b, o);
     } else {
       assert base.valueNode() == value.getY();
       return sub(graph(), o, b);
     }
   }
   throw JVMCIError.shouldNotReachHere();
 }
コード例 #2
0
 private long op(long b, long o) {
   if (value instanceof AddNode) {
     return b + o;
   }
   if (value instanceof SubNode) {
     if (base.valueNode() == value.getX()) {
       return b - o;
     } else {
       assert base.valueNode() == value.getY();
       return o - b;
     }
   }
   throw JVMCIError.shouldNotReachHere();
 }
コード例 #3
0
 @Override
 public ValueNode strideNode() {
   if (value instanceof SubNode && base.valueNode() == value.getY()) {
     return graph().unique(new NegateNode(base.strideNode()));
   }
   return base.strideNode();
 }
コード例 #4
0
 @Override
 public long constantStride() {
   if (value instanceof SubNode && base.valueNode() == value.getY()) {
     return -base.constantStride();
   }
   return base.constantStride();
 }
コード例 #5
0
 @Test
 public void testValueProxyInputs() {
   StructuredGraph graph = parseEager("testValueProxyInputsSnippet", AllowAssumptions.YES);
   for (FrameState fs : graph.getNodes().filter(FrameState.class).snapshot()) {
     fs.replaceAtUsages(null);
     GraphUtil.killWithUnusedFloatingInputs(fs);
   }
   SchedulePhase schedulePhase = new SchedulePhase(SchedulingStrategy.LATEST);
   schedulePhase.apply(graph);
   ScheduleResult schedule = graph.getLastSchedule();
   NodeMap<Block> nodeToBlock = schedule.getCFG().getNodeToBlock();
   assertTrue(graph.getNodes().filter(LoopExitNode.class).count() == 1);
   LoopExitNode loopExit = graph.getNodes().filter(LoopExitNode.class).first();
   List<Node> list = schedule.nodesFor(nodeToBlock.get(loopExit));
   for (BinaryArithmeticNode<?> node : graph.getNodes().filter(BinaryArithmeticNode.class)) {
     if (!(node instanceof AddNode)) {
       assertTrue(node.toString(), nodeToBlock.get(node) == nodeToBlock.get(loopExit));
       assertTrue(
           list.indexOf(node) + " < " + list.indexOf(loopExit) + ", " + node + ", " + loopExit,
           list.indexOf(node) < list.indexOf(loopExit));
     }
   }
 }
コード例 #6
0
 @Override
 public String toString() {
   return String.format(
       "DerivedOffsetInductionVariable base (%s) %s %s",
       base, value.getNodeClass().shortName(), offset);
 }