nextLastFixed == null in LoweringPhase.process

Gilles Duboscq duboscq at ssw.jku.at
Sun Mar 16 18:51:12 UTC 2014


Hello Tom,

I think the problem is on our side, it should be possible to do what
you describe.
In this case, the first branch should detect that what comes after the
just-lowered node is gone (nextNdoe should not be alive).
I tried some modifications to the snippet instantiation which may help
you, they've just gone through the gate and should be available on
openjdk in the next push (which should happen this night). In
particular the changes in e1a2302a42bc could help.

Let me know if it worked.

-Gilles

On Thu, Mar 13, 2014 at 7:17 PM, Tom Deneau <tom.deneau at amd.com> wrote:
> 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