Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java @ 14079:ca92db718c74
Truffle: refined split/inlining heuristics.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 05 Mar 2014 23:33:25 +0100 |
parents | 61bc19c3dcdc |
children | 13072c084e6f |
rev | line source |
---|---|
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.truffle; |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.truffle.TruffleCompilerOptions.*; |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import java.io.*; |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 import java.util.*; |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
29 import java.util.concurrent.*; |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 import com.oracle.graal.api.code.*; |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 import com.oracle.graal.debug.*; |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.truffle.api.*; |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.truffle.api.frame.*; |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.truffle.api.impl.*; |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 import com.oracle.truffle.api.nodes.*; |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
37 import com.oracle.truffle.api.nodes.NodeInfo.Kind; |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 /** |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 * Call target that is optimized by Graal upon surpassing a specific invocation threshold. |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 */ |
13915
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
42 public final class OptimizedCallTarget extends DefaultCallTarget implements LoopCountReceiver, ReplaceObserver { |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 private static final PrintStream OUT = TTY.out().out(); |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
45 |
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
46 private InstalledCode installedCode; |
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
47 private Future<InstalledCode> installedCodeTask; |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
48 private boolean compilationEnabled; |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
49 private boolean inlined; |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
50 private int callCount; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
51 |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
52 private final TruffleCompiler compiler; |
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
53 private final CompilationProfile compilationProfile; |
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
54 private final CompilationPolicy compilationPolicy; |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
55 private final SpeculationLog speculationLog = new SpeculationLog(); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
56 private OptimizedCallTarget splitSource; |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 |
13915
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
58 OptimizedCallTarget(RootNode rootNode, TruffleCompiler compiler, int invokeCounter, int compilationThreshold, boolean compilationEnabled) { |
13705
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
13703
diff
changeset
|
59 super(rootNode); |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 this.compiler = compiler; |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
61 this.compilationProfile = new CompilationProfile(compilationThreshold, invokeCounter, rootNode.toString()); |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
62 |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
63 if (TruffleUseTimeForCompilationDecision.getValue()) { |
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
64 compilationPolicy = new TimedCompilationPolicy(); |
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
65 } else { |
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
66 compilationPolicy = new DefaultCompilationPolicy(); |
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
67 } |
13915
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
68 this.compilationEnabled = compilationEnabled; |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
69 |
10844
3cf5f371dc9f
Truffle: print inlined call target and rename profiling option.
Andreas Woess <andreas.woess@jku.at>
parents:
10797
diff
changeset
|
70 if (TruffleCallTargetProfiling.getValue()) { |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
71 registerCallTarget(this); |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
72 } |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
73 } |
13703
03b42f0fb635
Truffle: extend inlining interface with custom reprofile counters.
Christian Humer <christian.humer@gmail.com>
parents:
13208
diff
changeset
|
74 |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
75 public OptimizedCallTarget getSplitSource() { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
76 return splitSource; |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
77 } |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
78 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
79 public void setSplitSource(OptimizedCallTarget splitSource) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
80 this.splitSource = splitSource; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
81 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
82 |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
83 @Override |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
84 public String toString() { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
85 String superString = super.toString(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
86 if (installedCode != null) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
87 superString += " <compiled>"; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
88 } |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
89 if (splitSource != null) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
90 superString += " <split>"; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
91 } |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
92 return superString; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
93 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
94 |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
95 public boolean isOptimized() { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
96 return installedCode != null || installedCodeTask != null; |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 } |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 |
13720
4281521dc39a
Truffle: fix non-local control flow using exceptions
Andreas Woess <andreas.woess@jku.at>
parents:
13705
diff
changeset
|
99 @CompilerDirectives.SlowPath |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 @Override |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 public Object call(PackedFrame caller, Arguments args) { |
12534
b34114019fd0
Re-add OptimizedCallTarget.callHelper - prevents frequent reinstallation of frame injection
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12531
diff
changeset
|
102 return callHelper(caller, args); |
b34114019fd0
Re-add OptimizedCallTarget.callHelper - prevents frequent reinstallation of frame injection
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12531
diff
changeset
|
103 } |
b34114019fd0
Re-add OptimizedCallTarget.callHelper - prevents frequent reinstallation of frame injection
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12531
diff
changeset
|
104 |
b34114019fd0
Re-add OptimizedCallTarget.callHelper - prevents frequent reinstallation of frame injection
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12531
diff
changeset
|
105 private Object callHelper(PackedFrame caller, Arguments args) { |
12601
48bc171026d1
Merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12599
diff
changeset
|
106 if (installedCode != null && installedCode.isValid()) { |
13915
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
107 reinstallCallMethodShortcut(); |
12529
23dc5dfdb9c7
Add OptimizedCallTarget.call(PackedFrame, Arguments) frame prologue injection
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12488
diff
changeset
|
108 } |
10844
3cf5f371dc9f
Truffle: print inlined call target and rename profiling option.
Andreas Woess <andreas.woess@jku.at>
parents:
10797
diff
changeset
|
109 if (TruffleCallTargetProfiling.getValue()) { |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
110 callCount++; |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
111 } |
12591
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
112 if (CompilerDirectives.injectBranchProbability(CompilerDirectives.FASTPATH_PROBABILITY, installedCode != null)) { |
10654
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
113 try { |
12591
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
114 return installedCode.execute(this, caller, args); |
10654
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
115 } catch (InvalidInstalledCodeException ex) { |
10659
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
116 return compiledCodeInvalidated(caller, args); |
10654
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
117 } |
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
118 } else { |
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
119 return interpreterCall(caller, args); |
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
120 } |
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
121 } |
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
122 |
13915
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
123 private static void reinstallCallMethodShortcut() { |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
124 if (TraceTruffleCompilation.getValue()) { |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
125 OUT.println("[truffle] reinstall OptimizedCallTarget.call code with frame prolog shortcut."); |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
126 } |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
127 GraalTruffleRuntime.installOptimizedCallTargetCallMethod(); |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
128 } |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
129 |
12711
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
130 public CompilationProfile getCompilationProfile() { |
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
131 return compilationProfile; |
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
132 } |
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
133 |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
134 private Object compiledCodeInvalidated(PackedFrame caller, Arguments args) { |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
135 invalidate(null, null, "Compiled code invalidated"); |
12591
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
136 return call(caller, args); |
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
137 } |
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
138 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
139 private void invalidate(Node oldNode, Node newNode, String reason) { |
12591
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
140 InstalledCode m = this.installedCode; |
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
141 if (m != null) { |
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
142 CompilerAsserts.neverPartOfCompilation(); |
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
143 installedCode = null; |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
144 compilationProfile.reportInvalidated(); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
145 logOptimizedInvalidated(this, oldNode, newNode, reason); |
10659
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
146 } |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
147 cancelInstalledTask(oldNode, newNode, reason); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
148 } |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
149 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
150 private void cancelInstalledTask(Node oldNode, Node newNode, String reason) { |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
151 Future<InstalledCode> task = this.installedCodeTask; |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
152 if (task != null) { |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
153 task.cancel(true); |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
154 this.installedCodeTask = null; |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
155 logOptimizingUnqueued(this, oldNode, newNode, reason); |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
156 compilationProfile.reportInvalidated(); |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
157 } |
10659
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
158 } |
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
159 |
10654
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10643
diff
changeset
|
160 private Object interpreterCall(PackedFrame caller, Arguments args) { |
10857
94cf5df0727f
Backout changeset 4c12d3756015; ensure compiledCodeInvalidated() is never inlined.
Andreas Woess <andreas.woess@jku.at>
parents:
10844
diff
changeset
|
161 CompilerAsserts.neverPartOfCompilation(); |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
162 compilationProfile.reportInterpreterCall(); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
163 |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
164 if (compilationEnabled && compilationPolicy.shouldCompile(compilationProfile)) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
165 InstalledCode code = compile(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
166 if (code != null && code.isValid()) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
167 this.installedCode = code; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
168 try { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
169 return code.execute(this, caller, args); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
170 } catch (InvalidInstalledCodeException ex) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
171 return compiledCodeInvalidated(caller, args); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
172 } |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
173 } |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
174 } |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
175 return executeHelper(caller, args); |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 } |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
178 public void performInlining() { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
179 if (!TruffleCompilerOptions.TruffleFunctionInlining.getValue()) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
180 return; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
181 } |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
182 if (inlined) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
183 return; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
184 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
185 inlined = true; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
186 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
187 logInliningStart(this); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
188 PriorityQueue<TruffleInliningProfile> queue = new PriorityQueue<>(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
189 |
13988
83b20e343f73
Truffle: added visited set to avoid duplicate inlinings when operating on truffle trees violating the tree property.
Christian Humer <christian.humer@gmail.com>
parents:
13984
diff
changeset
|
190 // Used to avoid running in cycles or inline nodes in Truffle trees |
14076
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
191 // which do not suffice the tree property. |
13988
83b20e343f73
Truffle: added visited set to avoid duplicate inlinings when operating on truffle trees violating the tree property.
Christian Humer <christian.humer@gmail.com>
parents:
13984
diff
changeset
|
192 Set<CallNode> visitedCallNodes = new HashSet<>(); |
83b20e343f73
Truffle: added visited set to avoid duplicate inlinings when operating on truffle trees violating the tree property.
Christian Humer <christian.humer@gmail.com>
parents:
13984
diff
changeset
|
193 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
194 queueCallSitesForInlining(this, getRootNode(), visitedCallNodes, queue); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
195 TruffleInliningProfile callSite = queue.poll(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
196 while (callSite != null) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
197 if (callSite.isInliningAllowed()) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
198 OptimizedCallNode callNode = callSite.getCallNode(); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
199 logInlined(this, callSite); |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
200 RootNode inlinedRoot = callNode.inlineImpl().getCurrentRootNode(); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
201 assert inlinedRoot != null; |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
202 queueCallSitesForInlining(this, inlinedRoot, visitedCallNodes, queue); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
203 } else { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
204 logInliningFailed(callSite); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
205 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
206 callSite = queue.poll(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
207 } |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
208 logInliningDone(this); |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
209 } |
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
210 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
211 private static void queueCallSitesForInlining(final OptimizedCallTarget target, RootNode rootNode, final Set<CallNode> visitedCallSites, final PriorityQueue<TruffleInliningProfile> queue) { |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
212 rootNode.accept(new NodeVisitor() { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
213 public boolean visit(Node node) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
214 if (node instanceof OptimizedCallNode) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
215 OptimizedCallNode call = ((OptimizedCallNode) node); |
14079
ca92db718c74
Truffle: refined split/inlining heuristics.
Christian Humer <christian.humer@gmail.com>
parents:
14076
diff
changeset
|
216 if (!call.isInlined() && !visitedCallSites.contains(call)) { |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
217 queue.add(call.createInliningProfile(target)); |
13988
83b20e343f73
Truffle: added visited set to avoid duplicate inlinings when operating on truffle trees violating the tree property.
Christian Humer <christian.humer@gmail.com>
parents:
13984
diff
changeset
|
218 visitedCallSites.add(call); |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
219 } |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
220 RootNode root = call.getCurrentRootNode(); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
221 if (root != null && call.isInlined()) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
222 root.accept(this); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
223 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
224 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
225 return true; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
226 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
227 }); |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
228 } |
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
229 |
12711
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
230 private boolean isCompiling() { |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
231 Future<InstalledCode> codeTask = this.installedCodeTask; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
232 if (codeTask != null) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
233 if (codeTask.isCancelled()) { |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
234 installedCodeTask = null; |
12711
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
235 return false; |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
236 } |
12711
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
237 return true; |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
238 } |
12711
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
239 return false; |
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
240 } |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
241 |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
242 public InstalledCode compile() { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
243 if (isCompiling()) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
244 if (installedCodeTask.isDone()) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
245 return receiveInstalledCode(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
246 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
247 return null; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
248 } else { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
249 performInlining(); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
250 logOptimizingQueued(this); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
251 this.installedCodeTask = compiler.compile(this); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
252 if (!TruffleBackgroundCompilation.getValue()) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
253 return receiveInstalledCode(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
254 } |
10862
8c570011b86f
Truffle: when a node is replaced, notify optimized call target and delay compilation.
Andreas Woess <andreas.woess@jku.at>
parents:
10858
diff
changeset
|
255 } |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
256 return null; |
12711
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
257 } |
fb4658e16b5d
Truffle: some regression fixes to previous cleanup
Christian Humer <christian.humer@gmail.com>
parents:
12710
diff
changeset
|
258 |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
259 private InstalledCode receiveInstalledCode() { |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
260 try { |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
261 return installedCodeTask.get(); |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
262 } catch (InterruptedException | ExecutionException e) { |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
263 compilationEnabled = false; |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
264 logOptimizingFailed(this, e.getMessage()); |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
265 if (e.getCause() instanceof BailoutException) { |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
266 // Bailout => move on. |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
267 } else { |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
268 if (TraceTruffleCompilationExceptions.getValue()) { |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
269 e.printStackTrace(OUT); |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
270 } |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
271 if (TruffleCompilationExceptionsAreFatal.getValue()) { |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
272 System.exit(-1); |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
273 } |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
274 } |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
275 return null; |
12592
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
276 } |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
277 } |
42c8f76a98bf
Move Truffle compilations to background compilation thread.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12591
diff
changeset
|
278 |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 public Object executeHelper(PackedFrame caller, Arguments args) { |
13760
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13720
diff
changeset
|
280 VirtualFrame frame = createFrame(getRootNode().getFrameDescriptor(), caller, args); |
a12017c18d5d
Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13720
diff
changeset
|
281 return getRootNode().execute(frame); |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 } |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
283 |
11934
dca16d6f9d65
TruffleRuntime.createVirtualFrame.
Chris Seaton <chris.seaton@oracle.com>
parents:
11722
diff
changeset
|
284 protected static FrameWithoutBoxing createFrame(FrameDescriptor descriptor, PackedFrame caller, Arguments args) { |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 return new FrameWithoutBoxing(descriptor, caller, args); |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 } |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
287 |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
288 @Override |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 public void reportLoopCount(int count) { |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
290 compilationProfile.reportLoopCount(count); |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
291 |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
292 // delegate to inlined call sites |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
293 for (CallNode callNode : getRootNode().getCachedCallNodes()) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
294 if (callNode.isInlined()) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
295 callNode.getRootNode().reportLoopCount(count); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
296 } |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
297 } |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 } |
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 |
10862
8c570011b86f
Truffle: when a node is replaced, notify optimized call target and delay compilation.
Andreas Woess <andreas.woess@jku.at>
parents:
10858
diff
changeset
|
300 @Override |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
301 public void nodeReplaced(Node oldNode, Node newNode, String reason) { |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
302 compilationProfile.reportNodeReplaced(); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
303 invalidate(oldNode, newNode, reason); |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
304 |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
305 // delegate to inlined call sites |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
306 for (CallNode callNode : getRootNode().getCachedCallNodes()) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
307 if (callNode.isInlined()) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
308 CallTarget target = callNode.getRootNode().getCallTarget(); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
309 if (target instanceof ReplaceObserver) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
310 ((ReplaceObserver) target).nodeReplaced(oldNode, newNode, reason); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
311 } |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
312 } |
14076
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
313 if (callNode instanceof OptimizedCallNode) { |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
314 ((OptimizedCallNode) callNode).nodeReplaced(oldNode, newNode, reason); |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
315 } |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
316 } |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 } |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
318 |
13915
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
319 public SpeculationLog getSpeculationLog() { |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
320 return speculationLog; |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
321 } |
d6b340b757a2
Truffle: refactorings
Andreas Woess <andreas.woess@jku.at>
parents:
13851
diff
changeset
|
322 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
323 public Map<String, Object> getDebugProperties() { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
324 Map<String, Object> properties = new LinkedHashMap<>(); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
325 addASTSizeProperty(getRootNode(), properties); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
326 properties.putAll(getCompilationProfile().getDebugProperties()); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
327 return properties; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
328 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
329 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
330 |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
331 private static void logInliningFailed(TruffleInliningProfile callSite) { |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
332 if (TraceTruffleInliningDetails.getValue()) { |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
333 log(2, "inline failed", callSite.getCallNode().getCurrentCallTarget().toString(), callSite.getDebugProperties()); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
334 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
335 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
336 |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
337 private static void logInlined(@SuppressWarnings("unused") final OptimizedCallTarget target, TruffleInliningProfile callSite) { |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
338 if (TraceTruffleInliningDetails.getValue() || TraceTruffleInlining.getValue()) { |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
339 log(2, "inline success", callSite.getCallNode().getCurrentCallTarget().toString(), callSite.getDebugProperties()); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
340 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
341 if (TraceTruffleInliningDetails.getValue()) { |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
342 RootNode root = callSite.getCallNode().getCurrentCallTarget().getRootNode(); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
343 root.accept(new NodeVisitor() { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
344 int depth = 1; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
345 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
346 public boolean visit(Node node) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
347 if (node instanceof OptimizedCallNode) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
348 OptimizedCallNode callNode = ((OptimizedCallNode) node); |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
349 RootNode inlinedRoot = callNode.getCurrentRootNode(); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
350 |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
351 if (inlinedRoot != null && callNode.isInlined()) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
352 Map<String, Object> properties = new LinkedHashMap<>(); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
353 addASTSizeProperty(callNode.getCurrentRootNode(), properties); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
354 log(2 + (depth * 2), "inline success", callNode.getCurrentCallTarget().toString(), properties); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
355 depth++; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
356 inlinedRoot.accept(this); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
357 depth--; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
358 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
359 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
360 return true; |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
361 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
362 }); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
363 } |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
364 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
365 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
366 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
367 private static void logInliningStart(OptimizedCallTarget target) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
368 if (TraceTruffleInliningDetails.getValue()) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
369 log(0, "inline start", target.toString(), target.getDebugProperties()); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
370 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
371 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
372 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
373 private static void logInliningDone(OptimizedCallTarget target) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
374 if (TraceTruffleInliningDetails.getValue()) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
375 log(0, "inline done", target.toString(), target.getDebugProperties()); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
376 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
377 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
378 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
379 private static void logOptimizingQueued(OptimizedCallTarget target) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
380 if (TraceTruffleCompilationDetails.getValue()) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
381 log(0, "opt queued", target.toString(), target.getDebugProperties()); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
382 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
383 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
384 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
385 private static void logOptimizingUnqueued(OptimizedCallTarget target, Node oldNode, Node newNode, String reason) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
386 if (TraceTruffleCompilationDetails.getValue()) { |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
387 Map<String, Object> properties = new LinkedHashMap<>(); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
388 addReplaceProperties(properties, oldNode, newNode); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
389 properties.put("Reason", reason); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
390 log(0, "opt unqueued", target.toString(), properties); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
391 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
392 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
393 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
394 private static void addReplaceProperties(Map<String, Object> properties, Node oldNode, Node newNode) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
395 if (oldNode != null && newNode != null) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
396 properties.put("OldClass", oldNode.getClass().getSimpleName()); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
397 properties.put("NewClass", newNode.getClass().getSimpleName()); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
398 properties.put("Node", newNode); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
399 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
400 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
401 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
402 static void logOptimizingStart(OptimizedCallTarget target) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
403 if (TraceTruffleCompilationDetails.getValue()) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
404 log(0, "opt start", target.toString(), target.getDebugProperties()); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
405 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
406 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
407 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
408 private static void logOptimizedInvalidated(OptimizedCallTarget target, Node oldNode, Node newNode, String reason) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
409 if (TraceTruffleCompilation.getValue()) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
410 Map<String, Object> properties = new LinkedHashMap<>(); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
411 addReplaceProperties(properties, oldNode, newNode); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
412 properties.put("Reason", reason); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
413 log(0, "opt invalidated", target.toString(), properties); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
414 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
415 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
416 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
417 private static void logOptimizingFailed(OptimizedCallTarget callSite, String reason) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
418 Map<String, Object> properties = new LinkedHashMap<>(); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
419 properties.put("Reason", reason); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
420 log(0, "opt fail", callSite.toString(), properties); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
421 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
422 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
423 static void logOptimizingDone(OptimizedCallTarget target, Map<String, Object> properties) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
424 if (TraceTruffleCompilationDetails.getValue() || TraceTruffleCompilation.getValue()) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
425 log(0, "opt done", target.toString(), properties); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
426 } |
14076
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
427 if (TraceTruffleCompilationPolymorphism.getValue()) { |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
428 |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
429 target.getRootNode().accept(new NodeVisitor() { |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
430 public boolean visit(Node node) { |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
431 Kind kind = node.getKind(); |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
432 if (kind == Kind.POLYMORPHIC || kind == Kind.GENERIC) { |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
433 Map<String, Object> props = new LinkedHashMap<>(); |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
434 props.put("simpleName", node.getClass().getSimpleName()); |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
435 String msg = kind == Kind.GENERIC ? "generic" : "polymorphic"; |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
436 log(0, msg, node.toString(), props); |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
437 } |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
438 if (node instanceof CallNode) { |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
439 CallNode callNode = (CallNode) node; |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
440 if (callNode.isInlined()) { |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
441 callNode.getCurrentRootNode().accept(this); |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
442 } |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
443 } |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
444 return true; |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
445 } |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
446 }); |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
447 |
61bc19c3dcdc
Truffle: implemented new tracing flag TraceTruffleCompilationPolymorphism.
Christian Humer <christian.humer@gmail.com>
parents:
14074
diff
changeset
|
448 } |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
449 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
450 |
14074
ed4b5d1ef667
Truffle: Added separate option to trace splitting.
Christian Humer <christian.humer@gmail.com>
parents:
14073
diff
changeset
|
451 private static int splitCount = 0; |
ed4b5d1ef667
Truffle: Added separate option to trace splitting.
Christian Humer <christian.humer@gmail.com>
parents:
14073
diff
changeset
|
452 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
453 static void logSplit(OptimizedCallNode callNode, OptimizedCallTarget target, OptimizedCallTarget newTarget) { |
14074
ed4b5d1ef667
Truffle: Added separate option to trace splitting.
Christian Humer <christian.humer@gmail.com>
parents:
14073
diff
changeset
|
454 if (TraceTruffleSplitting.getValue()) { |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
455 Map<String, Object> properties = new LinkedHashMap<>(); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
456 addASTSizeProperty(target.getRootNode(), properties); |
14074
ed4b5d1ef667
Truffle: Added separate option to trace splitting.
Christian Humer <christian.humer@gmail.com>
parents:
14073
diff
changeset
|
457 properties.put("Split#", ++splitCount); |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
458 properties.put("Source", callNode.getEncapsulatingSourceSection()); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
459 log(0, "split", newTarget.toString(), properties); |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
460 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
461 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
462 |
13996
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
463 static void addASTSizeProperty(RootNode target, Map<String, Object> properties) { |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
464 String value = String.format("%4d (%d/%d)", NodeUtil.countNodes(target.getRootNode(), null, true), // |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
465 NodeUtil.countNodes(target.getRootNode(), null, Kind.POLYMORPHIC, true), NodeUtil.countNodes(target.getRootNode(), null, Kind.GENERIC, true)); // |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
466 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
467 properties.put("ASTSize", value); |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
468 } |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
469 |
c7ac129e17e9
Truffle: further tweaks to the inlinig/split heuristic.
Christian Humer <christian.humer@gmail.com>
parents:
13988
diff
changeset
|
470 static synchronized void log(int indent, String msg, String details, Map<String, Object> properties) { |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
471 OUT.printf("[truffle] %-16s ", msg); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
472 for (int i = 0; i < indent; i++) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
473 OUT.print(" "); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
474 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
475 OUT.printf("%-" + (60 - indent) + "s", details); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
476 if (properties != null) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
477 for (String property : properties.keySet()) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
478 Object value = properties.get(property); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
479 if (value == null) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
480 continue; |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
481 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
482 OUT.print("|"); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
483 OUT.print(property); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
484 |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
485 StringBuilder propertyBuilder = new StringBuilder(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
486 if (value instanceof Integer) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
487 propertyBuilder.append(String.format("%6d", value)); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
488 } else if (value instanceof Double) { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
489 propertyBuilder.append(String.format("%8.2f", value)); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
490 } else { |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
491 propertyBuilder.append(value); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
492 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
493 |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
494 int length = Math.max(1, 20 - property.length()); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
495 OUT.printf(" %" + length + "s ", propertyBuilder.toString()); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
496 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
497 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
498 OUT.println(); |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
499 } |
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
500 |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
501 private static void printProfiling() { |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
502 List<OptimizedCallTarget> sortedCallTargets = new ArrayList<>(OptimizedCallTarget.callTargets.keySet()); |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
503 Collections.sort(sortedCallTargets, new Comparator<OptimizedCallTarget>() { |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
504 |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
505 @Override |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
506 public int compare(OptimizedCallTarget o1, OptimizedCallTarget o2) { |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
507 return o2.callCount - o1.callCount; |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
508 } |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
509 }); |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
510 |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
511 int totalCallCount = 0; |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
512 int totalInlinedCallSiteCount = 0; |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
513 int totalNodeCount = 0; |
10858
f2008a93ad54
Truffle: add invalidation count to call target profiling / trace compilation.
Andreas Woess <andreas.woess@jku.at>
parents:
10857
diff
changeset
|
514 int totalInvalidationCount = 0; |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
515 |
10794
3fe325c3f31c
Truffle: add InlinedCallSite interface and an InlinableCallSite method to query the inlined call target
Andreas Woess <andreas.woess@jku.at>
parents:
10752
diff
changeset
|
516 OUT.println(); |
10858
f2008a93ad54
Truffle: add invalidation count to call target profiling / trace compilation.
Andreas Woess <andreas.woess@jku.at>
parents:
10857
diff
changeset
|
517 OUT.printf("%-50s | %-10s | %s / %s | %s | %s\n", "Call Target", "Call Count", "Calls Sites Inlined", "Not Inlined", "Node Count", "Inv"); |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
518 for (OptimizedCallTarget callTarget : sortedCallTargets) { |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
519 if (callTarget.callCount == 0) { |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
520 continue; |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
521 } |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
522 |
13811
641f22b1c6b8
Truffle: further fixes to the new CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13806
diff
changeset
|
523 int nodeCount = NodeUtil.countNodes(callTarget.getRootNode(), null, true); |
13806 | 524 int inlinedCallSiteCount = countInlinedNodes(callTarget.getRootNode()); |
12591
33fe56e68abd
Simplifications of OptimizedCallTarget.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
525 String comment = callTarget.installedCode == null ? " int" : ""; |
12710
60142b15ed42
Truffle: fixed bug where invocation counter was decremented twice after inlining; cleanup of optimized call target and profile.
Christian Humer <christian.humer@gmail.com>
parents:
12709
diff
changeset
|
526 comment += callTarget.compilationEnabled ? "" : " fail"; |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
527 OUT.printf("%-50s | %10d | %15d | %10d | %3d%s\n", callTarget.getRootNode(), callTarget.callCount, inlinedCallSiteCount, nodeCount, |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
528 callTarget.getCompilationProfile().getInvalidationCount(), comment); |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
529 |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
530 totalCallCount += callTarget.callCount; |
10794
3fe325c3f31c
Truffle: add InlinedCallSite interface and an InlinableCallSite method to query the inlined call target
Andreas Woess <andreas.woess@jku.at>
parents:
10752
diff
changeset
|
531 totalInlinedCallSiteCount += inlinedCallSiteCount; |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
532 totalNodeCount += nodeCount; |
12709
d2d0c44662bb
Truffle: refactored CompilationProfile to separate the profile and the policy in separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
12708
diff
changeset
|
533 totalInvalidationCount += callTarget.getCompilationProfile().getInvalidationCount(); |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
534 } |
13984
1c9dbfc5b510
Truffle: New more reliable inlining strategy for the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13915
diff
changeset
|
535 OUT.printf("%-50s | %10d | %15d | %10d | %3d\n", "Total", totalCallCount, totalInlinedCallSiteCount, totalNodeCount, totalInvalidationCount); |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
536 } |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
537 |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
538 private static int countInlinedNodes(Node rootNode) { |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
539 List<CallNode> callers = NodeUtil.findAllNodeInstances(rootNode, CallNode.class); |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
540 int count = 0; |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
541 for (CallNode callNode : callers) { |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
542 if (callNode.isInlined()) { |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
543 count++; |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
544 RootNode root = callNode.getCurrentRootNode(); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
545 if (root != null) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
546 count += countInlinedNodes(root); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13996
diff
changeset
|
547 } |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
548 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
549 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
550 return count; |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
551 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13720
diff
changeset
|
552 |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
553 private static void registerCallTarget(OptimizedCallTarget callTarget) { |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
554 callTargets.put(callTarget, 0); |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
555 } |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
556 |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
557 private static Map<OptimizedCallTarget, Integer> callTargets; |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
558 static { |
10844
3cf5f371dc9f
Truffle: print inlined call target and rename profiling option.
Andreas Woess <andreas.woess@jku.at>
parents:
10797
diff
changeset
|
559 if (TruffleCallTargetProfiling.getValue()) { |
10752
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
560 callTargets = new WeakHashMap<>(); |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
561 |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
562 Runtime.getRuntime().addShutdownHook(new Thread() { |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
563 |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
564 @Override |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
565 public void run() { |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
566 printProfiling(); |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
567 } |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
568 }); |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
569 } |
e2f5ae9afdc5
Truffle: introduce profiling option
Andreas Woess <andreas.woess@jku.at>
parents:
10751
diff
changeset
|
570 } |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
571 } |