Mercurial > hg > truffle
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java @ 11320:80de3bbfa8b9
Truffle-DSL: fixed inconsistent children for polymorphic -> generic rewrites. (GRAAL-425)
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 16 Aug 2013 14:00:17 +0200 |
parents | 7fc3e1fb3965 |
children | efe58aa92f86 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java Thu Aug 15 19:46:05 2013 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java Fri Aug 16 14:00:17 2013 +0200 @@ -1769,6 +1769,12 @@ CodeTreeBuilder builder = parent.create(); builder.declaration(getContext().getTruffleTypes().getNode(), "root", currentNode); builder.startIf().string(currentNode).string(".next0 != null").end().startBlock(); + /* + * Communicates to the caller of executeAndSpecialize that it was rewritten to generic. + * Its important that this is used instead of the currentNode since the caller is this. + * CurrentNode may not be this anymore at this place. + */ + builder.statement("this.next0 = null"); builder.tree(createFindRoot(builder, node, false)); builder.end(); builder.end(); @@ -2502,9 +2508,10 @@ builder.startIf().string("depth > ").string(String.valueOf(node.getPolymorphicDepth())).end(); builder.startBlock(); - String message = ("Polymorphic limit reached (" + node.getPolymorphicDepth() + ")"); + String message = "Polymorphic limit reached (" + node.getPolymorphicDepth() + ")"; + String castRoot = "(" + baseClassName(node) + ") root"; builder.tree(createGenericInvoke(builder, node.getGenericPolymorphicSpecialization(), node.getGenericSpecialization(), - createReplaceCall(builder, node.getGenericSpecialization(), "root", "this", message), null)); + createReplaceCall(builder, node.getGenericSpecialization(), "root", castRoot, message), null)); builder.end(); builder.startElseBlock(); @@ -2521,7 +2528,9 @@ builder.declaration(node.getGenericSpecialization().getReturnType().getType(), "result", specializeCall.getRoot()); + builder.startIf().string("this.next0 != null").end().startBlock(); builder.startStatement().string("(").cast(nodePolymorphicClassName(node, node.getGenericPolymorphicSpecialization())).string("root).optimizeTypes()").end(); + builder.end(); if (Utils.isVoid(builder.findMethod().getReturnType())) { builder.returnStatement();