# HG changeset patch # User Benoit Daloze # Date 1425664291 -3600 # Node ID 48eeda5dfdbf0337e0eb02abdf656f0293138735 # Parent 678a3de139adbf091fd52e394c2a71557f60090b Move linking of RootNode to CallTarget to ensure final semantics. * "this" was published before complete initialization by being in the constructor. * Make the constructor protected where possible. diff -r 678a3de139ad -r 48eeda5dfdbf graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java --- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Thu Mar 05 14:19:23 2015 +0100 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Fri Mar 06 18:51:31 2015 +0100 @@ -137,6 +137,7 @@ compilationPolicy = new InterpreterOnlyCompilationPolicy(); } OptimizedCallTarget target = new OptimizedCallTarget(source, rootNode, this, compilationPolicy, new HotSpotSpeculationLog()); + rootNode.setCallTarget(target); callTargets.put(target, null); return target; diff -r 678a3de139ad -r 48eeda5dfdbf graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Thu Mar 05 14:19:23 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Fri Mar 06 18:51:31 2015 +0100 @@ -91,7 +91,6 @@ this.compilationPolicy = compilationPolicy; this.rootNode.adoptChildren(); this.rootNode.applyInstrumentation(); - this.rootNode.setCallTarget(this); this.uninitializedRootNode = sourceCallTarget == null ? cloneRootNode(rootNode) : sourceCallTarget.uninitializedRootNode; if (TruffleCallTargetProfiling.getValue()) { this.compilationProfile = new TraceCompilationProfile(); diff -r 678a3de139ad -r 48eeda5dfdbf graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java Thu Mar 05 14:19:23 2015 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java Fri Mar 06 18:51:31 2015 +0100 @@ -36,11 +36,10 @@ private final RootNode rootNode; - public DefaultCallTarget(RootNode function) { + protected DefaultCallTarget(RootNode function) { this.rootNode = function; this.rootNode.adoptChildren(); this.rootNode.applyInstrumentation(); - this.rootNode.setCallTarget(this); } @Override diff -r 678a3de139ad -r 48eeda5dfdbf graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java Thu Mar 05 14:19:23 2015 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java Fri Mar 06 18:51:31 2015 +0100 @@ -55,6 +55,7 @@ @Override public RootCallTarget createCallTarget(RootNode rootNode) { DefaultCallTarget target = new DefaultCallTarget(rootNode); + rootNode.setCallTarget(target); callTargets.put(target, null); return target; }