# HG changeset patch # User Christian Wimmer # Date 1431645550 25200 # Node ID 01e38e103f956c25ea2d55abc7414eb7a1169566 # Parent d17e1af43e8a7d1f239f1a373a4b7731633735a3 Do not cache option values in static final fields diff -r d17e1af43e8a -r 01e38e103f95 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/CompilationProfile.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/CompilationProfile.java Thu May 14 16:17:56 2015 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/CompilationProfile.java Thu May 14 16:19:10 2015 -0700 @@ -28,8 +28,6 @@ public class CompilationProfile { - private static final int TIMESTAMP_THRESHOLD = Math.max(TruffleCompilationThreshold.getValue() / 2, 1); - /** * Number of times an installed code for this tree was invalidated. */ @@ -112,7 +110,7 @@ interpreterCallAndLoopCount++; int callsMissing = compilationCallAndLoopThreshold - interpreterCallAndLoopCount; - if (callsMissing == TIMESTAMP_THRESHOLD) { + if (callsMissing == getTimestampThreshold()) { timestamp = System.nanoTime(); } } @@ -130,7 +128,7 @@ } public void deferCompilation() { - ensureProfiling(0, TIMESTAMP_THRESHOLD + 1); + ensureProfiling(0, getTimestampThreshold() + 1); timestamp = 0; deferedCount++; } @@ -139,7 +137,7 @@ interpreterCallAndLoopCount += count; int callsMissing = compilationCallAndLoopThreshold - interpreterCallAndLoopCount; - if (callsMissing <= TIMESTAMP_THRESHOLD && callsMissing + count > TIMESTAMP_THRESHOLD) { + if (callsMissing <= getTimestampThreshold() && callsMissing + count > getTimestampThreshold()) { timestamp = System.nanoTime(); } } @@ -154,4 +152,7 @@ return timestamp; } + private static int getTimestampThreshold() { + return Math.max(TruffleCompilationThreshold.getValue() / 2, 1); + } } diff -r d17e1af43e8a -r 01e38e103f95 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedOSRLoopNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedOSRLoopNode.java Thu May 14 16:17:56 2015 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedOSRLoopNode.java Thu May 14 16:19:10 2015 -0700 @@ -28,8 +28,6 @@ public final class OptimizedOSRLoopNode extends LoopNode implements ReplaceObserver { - private static final int OSR_THRESHOLD = TruffleCompilerOptions.TruffleOSRCompilationThreshold.getValue(); - private int interpreterLoopCount; private OptimizedCallTarget compiledTarget; @@ -75,7 +73,8 @@ } private boolean profilingLoop(VirtualFrame frame) { - int overflowLoopCount = Integer.MAX_VALUE - OSR_THRESHOLD + interpreterLoopCount; + int osrThreshold = TruffleCompilerOptions.TruffleOSRCompilationThreshold.getValue(); + int overflowLoopCount = Integer.MAX_VALUE - osrThreshold + interpreterLoopCount; try { while (repeatableNode.executeRepeating(frame)) { try { @@ -86,7 +85,7 @@ } } } finally { - reportLoopCount(overflowLoopCount - Integer.MAX_VALUE + OSR_THRESHOLD - interpreterLoopCount); + reportLoopCount(overflowLoopCount - Integer.MAX_VALUE + osrThreshold - interpreterLoopCount); } return true; }