replacing nodes with DeoptimizeNodes

Gilles Duboscq duboscq at ssw.jku.at
Wed Mar 5 02:28:39 PST 2014


On Wed, Mar 5, 2014 at 11:18 AM, Doug Simon <doug.simon at oracle.com> wrote:
>
> On Mar 5, 2014, at 1:27 AM, Deneau, Tom <tom.deneau at amd.com> wrote:
>
>> Let's say there is some random graal node that you choose not to implement so you want it to be replaced by a DeoptimizeNode.  How does one do that if the original node is not a terminal node, ie, it has usages?
>
> The subgraph rooted at that node has to be removed (probably through use of com.oracle.graal.nodes.util.GraphUtil.killWithUnusedFloatingInputs(Node)).

Rather GraphUtil.killCFG(Node).
As an example, you can look at CanonicalizerPhase.performReplacement
(around line 297):
  //case 7
  fixed.predecessor().replaceFirstSuccessor(fixed, canonical);
  GraphUtil.killCFG(fixed);

even better would be:
  fixed.replaceAtPredecessor(canonical);
  GraphUtil.killCFG(fixed);

where in you case fixed is the node you want to replace and canonical
is the DeoptimizeNode.

>
> -Doug


More information about the graal-dev mailing list