Mercurial > hg > graal-compiler
diff graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java @ 13915:d6b340b757a2
Truffle: refactorings
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Sat, 08 Feb 2014 06:33:29 +0100 |
parents | e86d32f4803f |
children | 1c9dbfc5b510 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Fri Feb 07 17:46:38 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Sat Feb 08 06:33:29 2014 +0100 @@ -38,7 +38,7 @@ /** * Call target that is optimized by Graal upon surpassing a specific invocation threshold. */ -public final class OptimizedCallTarget extends DefaultCallTarget implements FrameFactory, LoopCountReceiver, ReplaceObserver { +public final class OptimizedCallTarget extends DefaultCallTarget implements LoopCountReceiver, ReplaceObserver { private static final PrintStream OUT = TTY.out().out(); @@ -52,7 +52,7 @@ private int callCount; private SpeculationLog speculationLog = new SpeculationLog(); - protected OptimizedCallTarget(RootNode rootNode, TruffleCompiler compiler, int invokeCounter, int compilationThreshold) { + OptimizedCallTarget(RootNode rootNode, TruffleCompiler compiler, int invokeCounter, int compilationThreshold, boolean compilationEnabled) { super(rootNode); this.compiler = compiler; this.compilationProfile = new CompilationProfile(compilationThreshold, invokeCounter, rootNode.toString()); @@ -62,7 +62,7 @@ } else { compilationPolicy = new DefaultCompilationPolicy(); } - this.compilationEnabled = true; + this.compilationEnabled = compilationEnabled; if (TruffleCallTargetProfiling.getValue()) { registerCallTarget(this); @@ -79,13 +79,7 @@ private Object callHelper(PackedFrame caller, Arguments args) { if (installedCode != null && installedCode.isValid()) { - TruffleRuntime runtime = Truffle.getRuntime(); - if (runtime instanceof GraalTruffleRuntime) { - if (TraceTruffleCompilation.getValue()) { - OUT.println("[truffle] reinstall OptimizedCallTarget.call code with frame prolog shortcut."); - } - GraalTruffleRuntime.installOptimizedCallTargetCallMethod(); - } + reinstallCallMethodShortcut(); } if (TruffleCallTargetProfiling.getValue()) { callCount++; @@ -101,6 +95,13 @@ } } + private static void reinstallCallMethodShortcut() { + if (TraceTruffleCompilation.getValue()) { + OUT.println("[truffle] reinstall OptimizedCallTarget.call code with frame prolog shortcut."); + } + GraalTruffleRuntime.installOptimizedCallTargetCallMethod(); + } + public CompilationProfile getCompilationProfile() { return compilationProfile; } @@ -117,7 +118,7 @@ installedCode = null; compilationProfile.reportInvalidated(); if (TraceTruffleCompilation.getValue()) { - OUT.printf("[truffle] invalidated %-48s |Inv# %d |Replace# %d\n", getRootNode(), compilationProfile.getInvalidationCount(), + OUT.printf("[truffle] invalidated %-48s %08x |InvalidationCount %2d |ReplaceCount %3d\n", getRootNode(), getRootNode().hashCode(), compilationProfile.getInvalidationCount(), compilationProfile.getNodeReplaceCount()); } } @@ -221,11 +222,6 @@ } @Override - public VirtualFrame create(FrameDescriptor descriptor, PackedFrame caller, Arguments args) { - return createFrame(descriptor, caller, args); - } - - @Override public void reportLoopCount(int count) { compilationProfile.reportLoopCount(count); } @@ -236,6 +232,10 @@ invalidate(); } + public SpeculationLog getSpeculationLog() { + return speculationLog; + } + private static void printProfiling() { List<OptimizedCallTarget> sortedCallTargets = new ArrayList<>(OptimizedCallTarget.callTargets.keySet()); Collections.sort(sortedCallTargets, new Comparator<OptimizedCallTarget>() { @@ -306,8 +306,4 @@ }); } } - - public SpeculationLog getSpeculationLog() { - return speculationLog; - } }