Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java @ 18220:890d284b2771
Truffle: add TruffleRuntime#getCapability method
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Thu, 30 Oct 2014 17:04:16 +0100 |
parents | c489edfac1c7 |
children | 1d430dfce76d |
rev | line source |
---|---|
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
18208
abe9758da9d9
Truffle: add headers for new compilation listener files.
Christian Humer <christian.humer@gmail.com>
parents:
18207
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
10484
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 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
25 import static com.oracle.graal.truffle.TruffleCompilerOptions.*; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
26 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
27 import java.util.*; |
17005
112ab4a3de3a
Truffle: added Graal runtime API to wait for the completion of a compilation.
Christian Humer <christian.humer@gmail.com>
parents:
15222
diff
changeset
|
28 import java.util.concurrent.*; |
112ab4a3de3a
Truffle: added Graal runtime API to wait for the completion of a compilation.
Christian Humer <christian.humer@gmail.com>
parents:
15222
diff
changeset
|
29 |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
30 import com.oracle.graal.api.code.*; |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
31 import com.oracle.graal.api.code.stack.*; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
32 import com.oracle.graal.api.meta.*; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
33 import com.oracle.graal.api.runtime.*; |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
34 import com.oracle.graal.nodes.*; |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.nodes.spi.*; |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
36 import com.oracle.graal.truffle.debug.*; |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 import com.oracle.truffle.api.*; |
18130
b4e38f4ca414
Truffle: rename @SlowPath to @TruffleBoundary.
Christian Humer <christian.humer@gmail.com>
parents:
17192
diff
changeset
|
38 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
39 import com.oracle.truffle.api.frame.*; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
40 import com.oracle.truffle.api.nodes.*; |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
42 public abstract class GraalTruffleRuntime implements TruffleRuntime { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
43 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
44 private ArrayList<String> includes; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
45 private ArrayList<String> excludes; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
46 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
47 private StackIntrospection stackIntrospection; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
48 protected ResolvedJavaMethod[] callNodeMethod; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
49 protected ResolvedJavaMethod[] callTargetMethod; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
50 protected ResolvedJavaMethod[] anyFrameMethod; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
51 |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
52 private final List<GraalTruffleCompilationListener> compilationListeners = new ArrayList<>(); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
53 private final GraalTruffleCompilationListener compilationNotify = new DispatchTruffleCompilationListener(); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
54 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
55 public GraalTruffleRuntime() { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
56 Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
57 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
58 |
18200
62de94d5cf73
Truffle: refactor implementation of TraceTruffleCompilation, TraceTruffleCompilationDetails into separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
18199
diff
changeset
|
59 protected void installDefaultListeners() { |
62de94d5cf73
Truffle: refactor implementation of TraceTruffleCompilation, TraceTruffleCompilationDetails into separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
18199
diff
changeset
|
60 TraceCompilationFailureListener.install(this); |
62de94d5cf73
Truffle: refactor implementation of TraceTruffleCompilation, TraceTruffleCompilationDetails into separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
18199
diff
changeset
|
61 TraceCompilationListener.install(this); |
62de94d5cf73
Truffle: refactor implementation of TraceTruffleCompilation, TraceTruffleCompilationDetails into separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
18199
diff
changeset
|
62 TraceCompilationPolymorphismListener.install(this); |
18203
b1607c3ebe4f
Truffle: refactor TraceTruffleCompilationCallTree into a separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18202
diff
changeset
|
63 TraceCompilationCallTreeListener.install(this); |
18204
a1873eefea65
Truffle: refactor TraceTrufflePerformanceWarnings into separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18203
diff
changeset
|
64 TracePerformanceWarningsListener.install(this); |
18202
b3f6b210f723
Truffle: refactor TraceTruffleInlining into a separte class.
Christian Humer <christian.humer@gmail.com>
parents:
18201
diff
changeset
|
65 TraceInliningListener.install(this); |
18207
881aa0ed3904
Truffle: refactor TraceTruffleSplitting into separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18204
diff
changeset
|
66 TraceSplittingListener.install(this); |
18201
ae3b7695f0fb
Truffle: refactor TruffleCallTargetProfiling into a separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18200
diff
changeset
|
67 PrintCallTargetProfiling.install(this); |
18213
c489edfac1c7
Truffle: implemented new flag -G:+TruffleCompilationStatistics
Christian Humer <christian.humer@gmail.com>
parents:
18212
diff
changeset
|
68 CompilationStatisticsListener.install(this); |
18200
62de94d5cf73
Truffle: refactor implementation of TraceTruffleCompilation, TraceTruffleCompilationDetails into separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
18199
diff
changeset
|
69 } |
62de94d5cf73
Truffle: refactor implementation of TraceTruffleCompilation, TraceTruffleCompilationDetails into separate classes.
Christian Humer <christian.humer@gmail.com>
parents:
18199
diff
changeset
|
70 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
71 protected void lookupCallMethods(MetaAccessProvider metaAccess) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
72 callNodeMethod = new ResolvedJavaMethod[]{metaAccess.lookupJavaMethod(GraalFrameInstance.CallNodeFrame.METHOD)}; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
73 callTargetMethod = new ResolvedJavaMethod[]{metaAccess.lookupJavaMethod(GraalFrameInstance.CallTargetFrame.METHOD)}; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
74 anyFrameMethod = new ResolvedJavaMethod[]{callNodeMethod[0], callTargetMethod[0]}; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
75 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
76 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
77 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
78 public LoopNode createLoopNode(RepeatingNode repeating) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
79 if (!(repeating instanceof Node)) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
80 throw new IllegalArgumentException("Repeating node must be of type Node."); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
81 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
82 return new OptimizedLoopNode(repeating); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
83 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
84 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
85 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
86 public DirectCallNode createDirectCallNode(CallTarget target) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
87 if (target instanceof OptimizedCallTarget) { |
18207
881aa0ed3904
Truffle: refactor TraceTruffleSplitting into separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18204
diff
changeset
|
88 return new OptimizedDirectCallNode(this, (OptimizedCallTarget) target); |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
89 } else { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
90 throw new IllegalStateException(String.format("Unexpected call target class %s!", target.getClass())); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
91 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
92 } |
12529
23dc5dfdb9c7
Add OptimizedCallTarget.call(PackedFrame, Arguments) frame prologue injection
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
11934
diff
changeset
|
93 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
94 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
95 public IndirectCallNode createIndirectCallNode() { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
96 return new OptimizedIndirectCallNode(); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
97 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
98 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
99 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
100 public VirtualFrame createVirtualFrame(Object[] arguments, FrameDescriptor frameDescriptor) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
101 return OptimizedCallTarget.createFrame(frameDescriptor, arguments); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
102 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
103 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
104 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
105 public MaterializedFrame createMaterializedFrame(Object[] arguments) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
106 return createMaterializedFrame(arguments, new FrameDescriptor()); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
107 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
108 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
109 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
110 public MaterializedFrame createMaterializedFrame(Object[] arguments, FrameDescriptor frameDescriptor) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
111 return new FrameWithoutBoxing(frameDescriptor, arguments); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
112 } |
15210
201f6858a4f3
Restructure the interaction between OptimizedCallTarget and GraalTruffleRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15018
diff
changeset
|
113 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
114 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
115 public Assumption createAssumption() { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
116 return createAssumption(null); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
117 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
118 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
119 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
120 public Assumption createAssumption(String name) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
121 return new OptimizedAssumption(name); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
122 } |
15210
201f6858a4f3
Restructure the interaction between OptimizedCallTarget and GraalTruffleRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15018
diff
changeset
|
123 |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
124 public GraalTruffleCompilationListener getCompilationNotify() { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
125 return compilationNotify; |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
126 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
127 |
18130
b4e38f4ca414
Truffle: rename @SlowPath to @TruffleBoundary.
Christian Humer <christian.humer@gmail.com>
parents:
17192
diff
changeset
|
128 @TruffleBoundary |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
129 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
130 public <T> T iterateFrames(FrameInstanceVisitor<T> visitor) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
131 initStackIntrospection(); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
132 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
133 InspectedFrameVisitor<T> inspectedFrameVisitor = new InspectedFrameVisitor<T>() { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
134 private boolean skipNext = false; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
135 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
136 public T visitFrame(InspectedFrame frame) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
137 if (skipNext) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
138 assert frame.isMethod(callTargetMethod[0]); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
139 skipNext = false; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
140 return null; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
141 } |
15210
201f6858a4f3
Restructure the interaction between OptimizedCallTarget and GraalTruffleRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15018
diff
changeset
|
142 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
143 if (frame.isMethod(callNodeMethod[0])) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
144 skipNext = true; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
145 return visitor.visitFrame(new GraalFrameInstance.CallNodeFrame(frame)); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
146 } else { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
147 assert frame.isMethod(callTargetMethod[0]); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
148 return visitor.visitFrame(new GraalFrameInstance.CallTargetFrame(frame, false)); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
149 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
150 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
151 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
152 }; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
153 return stackIntrospection.iterateFrames(anyFrameMethod, anyFrameMethod, 1, inspectedFrameVisitor); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
154 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
155 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
156 private void initStackIntrospection() { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
157 if (stackIntrospection == null) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
158 stackIntrospection = Graal.getRequiredCapability(StackIntrospection.class); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
159 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
160 } |
17005
112ab4a3de3a
Truffle: added Graal runtime API to wait for the completion of a compilation.
Christian Humer <christian.humer@gmail.com>
parents:
15222
diff
changeset
|
161 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
162 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
163 public FrameInstance getCallerFrame() { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
164 return iterateFrames(frame -> frame); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
165 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
166 |
18130
b4e38f4ca414
Truffle: rename @SlowPath to @TruffleBoundary.
Christian Humer <christian.humer@gmail.com>
parents:
17192
diff
changeset
|
167 @TruffleBoundary |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
168 @Override |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
169 public FrameInstance getCurrentFrame() { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
170 initStackIntrospection(); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
171 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
172 return stackIntrospection.iterateFrames(callTargetMethod, callTargetMethod, 0, frame -> new GraalFrameInstance.CallTargetFrame(frame, true)); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
173 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
174 |
18220
890d284b2771
Truffle: add TruffleRuntime#getCapability method
Andreas Woess <andreas.woess@jku.at>
parents:
18213
diff
changeset
|
175 public <T> T getCapability(Class<T> capability) { |
890d284b2771
Truffle: add TruffleRuntime#getCapability method
Andreas Woess <andreas.woess@jku.at>
parents:
18213
diff
changeset
|
176 return null; |
890d284b2771
Truffle: add TruffleRuntime#getCapability method
Andreas Woess <andreas.woess@jku.at>
parents:
18213
diff
changeset
|
177 } |
890d284b2771
Truffle: add TruffleRuntime#getCapability method
Andreas Woess <andreas.woess@jku.at>
parents:
18213
diff
changeset
|
178 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
179 protected boolean acceptForCompilation(RootNode rootNode) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
180 if (TruffleCompileOnly.getValue() != null) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
181 if (includes == null) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
182 parseCompileOnly(); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
183 } |
15211
59f71608aa9a
Clean up of relationship between compilation policy and optimized call target.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15210
diff
changeset
|
184 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
185 String name = rootNode.toString(); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
186 boolean included = includes.isEmpty(); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
187 for (int i = 0; !included && i < includes.size(); i++) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
188 if (name.contains(includes.get(i))) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
189 included = true; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
190 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
191 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
192 if (!included) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
193 return false; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
194 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
195 for (String exclude : excludes) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
196 if (name.contains(exclude)) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
197 return false; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
198 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
199 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
200 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
201 return true; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
202 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
203 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
204 protected void parseCompileOnly() { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
205 includes = new ArrayList<>(); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
206 excludes = new ArrayList<>(); |
15222
58d2c5bdb9cd
Truffle: Add option TruffleReturnTypeSpeculation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15211
diff
changeset
|
207 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
208 String[] items = TruffleCompileOnly.getValue().split(","); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
209 for (String item : items) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
210 if (item.startsWith("~")) { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
211 excludes.add(item.substring(1)); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
212 } else { |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
213 includes.add(item); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
214 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
215 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
216 } |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
217 |
18162
ab62800259ff
Truffle: renamed the splitting to callTargetCloning. Made RootNode cloning an implementation detail of the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
18130
diff
changeset
|
218 public abstract RootCallTarget createClonedCallTarget(OptimizedCallTarget sourceCallTarget, RootNode root); |
ab62800259ff
Truffle: renamed the splitting to callTargetCloning. Made RootNode cloning an implementation detail of the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
18130
diff
changeset
|
219 |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
220 public void addCompilationListener(GraalTruffleCompilationListener listener) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
221 compilationListeners.add(listener); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
222 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
223 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
224 public void removeCompilationListener(GraalTruffleCompilationListener listener) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
225 compilationListeners.remove(listener); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
226 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
227 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
228 private void shutdown() { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
229 getCompilationNotify().notifyShutdown(this); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
230 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
231 |
18212
546cfe7a19b6
Truffle: add getQueuedCallTargets to GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18209
diff
changeset
|
232 public abstract Collection<OptimizedCallTarget> getQueuedCallTargets(); |
546cfe7a19b6
Truffle: add getQueuedCallTargets to GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18209
diff
changeset
|
233 |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
234 public abstract Replacements getReplacements(); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
235 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
236 public abstract void compile(OptimizedCallTarget optimizedCallTarget, boolean mayBeAsynchronous); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
237 |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
238 public abstract boolean cancelInstalledTask(OptimizedCallTarget optimizedCallTarget, Object source, CharSequence reason); |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
239 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
240 public abstract void waitForCompilation(OptimizedCallTarget optimizedCallTarget, long timeout) throws ExecutionException, TimeoutException; |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
241 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
242 public abstract boolean isCompiling(OptimizedCallTarget optimizedCallTarget); |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
243 |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
244 public abstract void invalidateInstalledCode(OptimizedCallTarget optimizedCallTarget, Object source, CharSequence reason); |
17192
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
245 |
d0d76deeacb9
Make more Truffle code HotSpot independent, and allow more customization by subclasses
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17005
diff
changeset
|
246 public abstract void reinstallStubs(); |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
247 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
248 private final class DispatchTruffleCompilationListener implements GraalTruffleCompilationListener { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
249 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
250 public void notifyCompilationQueued(OptimizedCallTarget target) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
251 compilationListeners.forEach(l -> l.notifyCompilationQueued(target)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
252 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
253 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
254 public void notifyCompilationInvalidated(OptimizedCallTarget target, Object source, CharSequence reason) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
255 compilationListeners.forEach(l -> l.notifyCompilationInvalidated(target, source, reason)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
256 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
257 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
258 public void notifyCompilationDequeued(OptimizedCallTarget target, Object source, CharSequence reason) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
259 compilationListeners.forEach(l -> l.notifyCompilationDequeued(target, source, reason)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
260 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
261 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
262 public void notifyCompilationFailed(OptimizedCallTarget target, StructuredGraph graph, Throwable t) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
263 compilationListeners.forEach(l -> l.notifyCompilationFailed(target, graph, t)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
264 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
265 |
18207
881aa0ed3904
Truffle: refactor TraceTruffleSplitting into separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18204
diff
changeset
|
266 public void notifyCompilationSplit(OptimizedDirectCallNode callNode) { |
881aa0ed3904
Truffle: refactor TraceTruffleSplitting into separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18204
diff
changeset
|
267 compilationListeners.forEach(l -> l.notifyCompilationSplit(callNode)); |
881aa0ed3904
Truffle: refactor TraceTruffleSplitting into separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18204
diff
changeset
|
268 } |
881aa0ed3904
Truffle: refactor TraceTruffleSplitting into separate class.
Christian Humer <christian.humer@gmail.com>
parents:
18204
diff
changeset
|
269 |
18209
dc6b023513b8
Truffle: added compilation graal tier finished event to compilation listener.
Christian Humer <christian.humer@gmail.com>
parents:
18208
diff
changeset
|
270 public void notifyCompilationGraalTierFinished(OptimizedCallTarget target, StructuredGraph graph) { |
dc6b023513b8
Truffle: added compilation graal tier finished event to compilation listener.
Christian Humer <christian.humer@gmail.com>
parents:
18208
diff
changeset
|
271 compilationListeners.forEach(l -> l.notifyCompilationGraalTierFinished(target, graph)); |
dc6b023513b8
Truffle: added compilation graal tier finished event to compilation listener.
Christian Humer <christian.humer@gmail.com>
parents:
18208
diff
changeset
|
272 } |
dc6b023513b8
Truffle: added compilation graal tier finished event to compilation listener.
Christian Humer <christian.humer@gmail.com>
parents:
18208
diff
changeset
|
273 |
18199
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
274 public void notifyCompilationSuccess(OptimizedCallTarget target, StructuredGraph graph, CompilationResult result) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
275 compilationListeners.forEach(l -> l.notifyCompilationSuccess(target, graph, result)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
276 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
277 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
278 public void notifyCompilationStarted(OptimizedCallTarget target) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
279 compilationListeners.forEach(l -> l.notifyCompilationStarted(target)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
280 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
281 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
282 public void notifyCompilationTruffleTierFinished(OptimizedCallTarget target, StructuredGraph graph) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
283 compilationListeners.forEach(l -> l.notifyCompilationTruffleTierFinished(target, graph)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
284 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
285 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
286 public void notifyShutdown(TruffleRuntime runtime) { |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
287 compilationListeners.forEach(l -> l.notifyShutdown(runtime)); |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
288 } |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
289 |
c5c80abc3fc6
Truffle: add support for a CompilationListener in GraalTruffleRuntime.
Christian Humer <christian.humer@gmail.com>
parents:
18162
diff
changeset
|
290 } |
10484
0097fb11c16f
Add basic version of Graal's Truffle runtime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 } |