nextLastFixed == null in LoweringPhase.process

Deneau, Tom tom.deneau at amd.com
Thu Mar 13 18:17:11 UTC 2014


Question from a newbie snippet writer...

I have a snippet (for NewInstanceNode replacement) that is calling Deoptimize.deopt conditionally but in the particular simple test case I am running it will generate code that unconditionally takes the deopt path.

When I get to this part of the code (LoweringPhase.process) after the replacement of the snippet into the graph, nextLastFixed is null, so we hit a nullPointerException.  Does this mean there is something wrong with my snippet or should there be some logic in here to handle the case where nextLastFixed == null?

-- Tom
               

               if (!nextNode.isAlive()) {
                    // can happen when the rest of the block is killed by lowering
                    // (e.g. by an unconditional deopt)
                    break;
                } else {
                    Node nextLastFixed = nextNode.predecessor();
                    if (!(nextLastFixed instanceof FixedWithNextNode)) {
                        // insert begin node, to have a valid last fixed for next lowerable node.
                        // This is about lowering a FixedWithNextNode to a control split while this
                        // FixedWithNextNode is followed by some kind of BeginNode.
                        // For example the when a FixedGuard followed by a loop exit is lowered to a
                        // control-split + deopt.
                        BeginNode begin = node.graph().add(new BeginNode());
                        nextLastFixed.replaceFirstSuccessor(nextNode, begin);
                        begin.setNext(nextNode);
                        nextLastFixed = begin;
                    }
                    loweringTool.setLastFixedNode((FixedWithNextNode) nextLastFixed);
                }



More information about the graal-dev mailing list