Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/internal/DSLShare.java @ 16922:0ea0c4133b78
Truffle-DSL: fixed polymorphic to monomorphic transition. It remained polymorphic in some cases.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 25 Aug 2014 16:30:40 +0200 |
parents | f5541b01f374 |
children | 1680a4ddc2a7 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/internal/DSLShare.java Mon Aug 25 15:56:32 2014 +0200 +++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/internal/DSLShare.java Mon Aug 25 16:30:40 2014 +0200 @@ -99,21 +99,17 @@ public static <T extends Node & DSLNode> T rewriteToPolymorphic(Node oldNode, DSLNode uninitializedDSL, T polymorphic, DSLNode currentCopy, DSLNode newNodeDSL, String message) { assert getNext(oldNode) == null; assert getPrevious(oldNode) == null; + assert newNodeDSL != null; Node uninitialized = (Node) uninitializedDSL; Node newNode = (Node) newNodeDSL; polymorphic.adoptChildren0(oldNode, (Node) currentCopy); updateSourceSection(oldNode, uninitialized); - if (newNode == null) { - // fallback - currentCopy.adoptChildren0(null, uninitialized); - } else { - // new specialization - updateSourceSection(oldNode, newNode); - newNodeDSL.adoptChildren0(null, uninitialized); - currentCopy.adoptChildren0(null, newNode); - } + // new specialization + updateSourceSection(oldNode, newNode); + newNodeDSL.adoptChildren0(null, uninitialized); + currentCopy.adoptChildren0(null, newNode); oldNode.replace(polymorphic, message); @@ -165,7 +161,7 @@ assert prev.getCost() == NodeCost.POLYMORPHIC; updateSourceSection(prev, newNode); - if (depth == 0) { + if (depth <= 1) { newNode.adoptChildren0(prev, null); return prev.replace(newNode, "Polymorphic to monomorphic."); } else {