Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java @ 22157:dc83cc1f94f2
Using fully qualified imports
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 16 Sep 2015 11:33:22 +0200 |
parents | 130e5f69d1a6 |
children | 863f7bb5f645 |
rev | line source |
---|---|
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
19309
c386ace07981
Truffle: move unsafe access methods out of CompilerDirectives
Andreas Woess <andreas.woess@oracle.com>
parents:
19013
diff
changeset
|
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
11279
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11269
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11269
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11269
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 * questions. |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 */ |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api; |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
22157
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22009
diff
changeset
|
27 import com.oracle.truffle.api.nodes.ControlFlowException; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22009
diff
changeset
|
28 import java.lang.annotation.ElementType; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22009
diff
changeset
|
29 import java.lang.annotation.Retention; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22009
diff
changeset
|
30 import java.lang.annotation.RetentionPolicy; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22009
diff
changeset
|
31 import java.lang.annotation.Target; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22009
diff
changeset
|
32 import java.util.concurrent.Callable; |
21991
169f5c55704c
added throwsControlFlowException element to @TruffleBoundary
Doug Simon <doug.simon@oracle.com>
parents:
21951
diff
changeset
|
33 |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 /** |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 * Directives that influence the optimizations of the Truffle compiler. All of the operations have |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 * no effect when executed in the Truffle interpreter. |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 */ |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
38 public final class CompilerDirectives { |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
40 public static final double LIKELY_PROBABILITY = 0.75; |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
41 public static final double UNLIKELY_PROBABILITY = 1.0 - LIKELY_PROBABILITY; |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
42 |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
43 public static final double SLOWPATH_PROBABILITY = 0.0001; |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
44 public static final double FASTPATH_PROBABILITY = 1.0 - SLOWPATH_PROBABILITY; |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 /** |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 * Directive for the compiler to discontinue compilation at this code position and instead |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 * insert a transfer to the interpreter. |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 */ |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 public static void transferToInterpreter() { |
16535
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15230
diff
changeset
|
51 if (inInterpreter()) { |
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15230
diff
changeset
|
52 Truffle.getRuntime().notifyTransferToInterpreter(); |
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15230
diff
changeset
|
53 } |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 } |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 /** |
12770
3e013f4512de
temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents:
12408
diff
changeset
|
57 * Directive for the compiler to discontinue compilation at this code position and instead |
3e013f4512de
temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents:
12408
diff
changeset
|
58 * insert a transfer to the interpreter, invalidating the currently executing machine code. |
3e013f4512de
temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents:
12408
diff
changeset
|
59 */ |
3e013f4512de
temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents:
12408
diff
changeset
|
60 public static void transferToInterpreterAndInvalidate() { |
16535
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15230
diff
changeset
|
61 if (inInterpreter()) { |
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15230
diff
changeset
|
62 Truffle.getRuntime().notifyTransferToInterpreter(); |
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15230
diff
changeset
|
63 } |
12770
3e013f4512de
temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents:
12408
diff
changeset
|
64 } |
3e013f4512de
temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents:
12408
diff
changeset
|
65 |
3e013f4512de
temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents:
12408
diff
changeset
|
66 /** |
11269
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
67 * Returns a boolean value indicating whether the method is executed in the interpreter. |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
68 * |
11269
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
69 * @return {@code true} when executed in the interpreter, {@code false} in compiled code. |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
70 */ |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
71 public static boolean inInterpreter() { |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
72 return true; |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
73 } |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
74 |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
75 /** |
15230
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
76 * Returns a boolean value indicating whether the method is executed in the compiled code. |
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
77 * |
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
78 * @return {@code false} when executed in the interpreter, {@code true} in compiled code. |
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
79 */ |
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
80 public static boolean inCompiledCode() { |
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
81 return false; |
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
82 } |
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
83 |
df724f63f776
Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15064
diff
changeset
|
84 /** |
17444
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
85 * Returns a boolean indicating whether or not a given value is seen as constant in optimized |
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
86 * code. If this method is called in the interpreter this method will always return |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19309
diff
changeset
|
87 * <code>true</code>. |
17444
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
88 * |
18309
d079b2af3a15
Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents:
18219
diff
changeset
|
89 * Note that optimizations that a compiler will apply to code that is conditional on |
d079b2af3a15
Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents:
18219
diff
changeset
|
90 * <code>isCompilationConstant</code> may be limited. For this reason |
d079b2af3a15
Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents:
18219
diff
changeset
|
91 * <code>isCompilationConstant</code> is not recommended for use to select between alternate |
d079b2af3a15
Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents:
18219
diff
changeset
|
92 * implementations of functionality depending on whether a value is constant. Instead, it is |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19309
diff
changeset
|
93 * intended for use as a diagnostic mechanism. |
18309
d079b2af3a15
Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents:
18219
diff
changeset
|
94 * |
17444
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
95 * @param value |
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
96 * @return {@code true} when given value is seen as compilation constant, {@code false} if not |
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
97 * compilation constant. |
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
98 */ |
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
99 public static boolean isCompilationConstant(Object value) { |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19309
diff
changeset
|
100 return CompilerDirectives.inInterpreter(); |
17444
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
101 } |
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
102 |
2834b4432586
Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents:
16535
diff
changeset
|
103 /** |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 * Directive for the compiler that the given runnable should only be executed in the interpreter |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 * and ignored in the compiled code. |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
106 * |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 * @param runnable the closure that should only be executed in the interpreter |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
108 */ |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 public static void interpreterOnly(Runnable runnable) { |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 runnable.run(); |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 } |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 /** |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
114 * Directive for the compiler that the given callable should only be executed in the |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 * interpreter. |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
116 * |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 * @param callable the closure that should only be executed in the interpreter |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 * @return the result of executing the closure in the interpreter and null in the compiled code |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 * @throws Exception If the closure throws an exception when executed in the interpreter. |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 */ |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 public static <T> T interpreterOnly(Callable<T> callable) throws Exception { |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 return callable.call(); |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 } |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 /** |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
126 * Injects a probability for the given condition into the probability information of the |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
127 * immediately succeeding branch instruction for the condition. The probability must be a value |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
128 * between 0.0 and 1.0 (inclusive). The condition should not be a combined condition. |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
129 * |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
130 * Example usage immediately before an if statement (it specifies that the likelihood for a to |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
131 * be greater than b is 90%): |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
132 * |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
133 * <code> |
14906 | 134 * if (injectBranchProbability(0.9, a > b)) { |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
135 * // ... |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
136 * } |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
137 * </code> |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
138 * |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
139 * Example usage for a combined condition (it specifies that the likelihood for a to be greater |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
140 * than b is 90% and under the assumption that this is true, the likelihood for a being 0 is |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
141 * 10%): |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
142 * |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
143 * <code> |
14906 | 144 * if (injectBranchProbability(0.9, a > b) && injectBranchProbability(0.1, a == 0)) { |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
145 * // ... |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
146 * } |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
147 * </code> |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
148 * |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
149 * There are predefined constants for commonly used probabilities (see |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
150 * {@link #LIKELY_PROBABILITY} , {@link #UNLIKELY_PROBABILITY}, {@link #SLOWPATH_PROBABILITY}, |
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
151 * {@link #FASTPATH_PROBABILITY} ). |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
152 * |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 * @param probability the probability value between 0.0 and 1.0 that should be injected |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 */ |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
155 public static boolean injectBranchProbability(double probability, boolean condition) { |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 assert probability >= 0.0 && probability <= 1.0; |
9319
1188b7c42196
Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9313
diff
changeset
|
157 return condition; |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 } |
9282
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
159 |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
160 /** |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
161 * Bails out of a compilation (e.g., for guest language features that should never be compiled). |
14880
73546bd550f0
CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents:
13956
diff
changeset
|
162 * |
9282
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
163 * @param reason the reason for the bailout |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
164 */ |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
165 public static void bailout(String reason) { |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
166 } |
9313
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
167 |
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
168 /** |
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
169 * Marks fields that should be considered final for a Truffle compilation although they are not |
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
170 * final while executing in the interpreter. |
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
171 */ |
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
172 @Retention(RetentionPolicy.RUNTIME) |
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
173 @Target({ElementType.FIELD}) |
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
174 public @interface CompilationFinal { |
6369d37b37d1
Added annotation CompilerDirectives.CompilationFinal for fields that should be considered final during compilation, but are not final while executing in the Truffle interpreter.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9283
diff
changeset
|
175 } |
9349
0fccad3ce40d
Introduce CompilerDirectives.Unsafe. Mark Frame.getArguments method as unsafe.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9319
diff
changeset
|
176 |
0fccad3ce40d
Introduce CompilerDirectives.Unsafe. Mark Frame.getArguments method as unsafe.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9319
diff
changeset
|
177 /** |
18130
b4e38f4ca414
Truffle: rename @SlowPath to @TruffleBoundary.
Christian Humer <christian.humer@gmail.com>
parents:
17444
diff
changeset
|
178 * Marks a method that it is considered as a boundary for Truffle partial evaluation. |
10687
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
179 */ |
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
180 @Retention(RetentionPolicy.RUNTIME) |
19013
f7375de5eaa0
Truffle: allow @TruffleBoundary on constructors
Andreas Woess <andreas.woess@jku.at>
parents:
18906
diff
changeset
|
181 @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) |
18130
b4e38f4ca414
Truffle: rename @SlowPath to @TruffleBoundary.
Christian Humer <christian.humer@gmail.com>
parents:
17444
diff
changeset
|
182 public @interface TruffleBoundary { |
21991
169f5c55704c
added throwsControlFlowException element to @TruffleBoundary
Doug Simon <doug.simon@oracle.com>
parents:
21951
diff
changeset
|
183 /** |
169f5c55704c
added throwsControlFlowException element to @TruffleBoundary
Doug Simon <doug.simon@oracle.com>
parents:
21951
diff
changeset
|
184 * Determines whether this method throws a {@link ControlFlowException}. |
169f5c55704c
added throwsControlFlowException element to @TruffleBoundary
Doug Simon <doug.simon@oracle.com>
parents:
21951
diff
changeset
|
185 */ |
169f5c55704c
added throwsControlFlowException element to @TruffleBoundary
Doug Simon <doug.simon@oracle.com>
parents:
21951
diff
changeset
|
186 boolean throwsControlFlowException() default false; |
10687
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
187 } |
11495
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
188 |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
189 /** |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
190 * Marks classes as value types. Reference comparisons (==) between instances of those classes |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
191 * have undefined semantics and can either return true or false. |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
192 */ |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
193 @Retention(RetentionPolicy.RUNTIME) |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
194 @Target({ElementType.TYPE}) |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
195 public @interface ValueType { |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
196 } |
15064
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
197 |
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
198 /** |
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
199 * Ensures that the given object is not virtual, i.e., not removed by Escape Analysis at the |
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
200 * point of this call. |
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
201 * |
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
202 * @param obj the object to exclude from Escape Analysis |
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
203 */ |
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
204 public static void materialize(Object obj) { |
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
205 } |
22009
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
206 |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
207 /** |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
208 * Ensures that the given object will be virtual (escape analyzed) at all points that are |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
209 * dominated by the current position. |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
210 */ |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
211 public static void ensureVirtualized(@SuppressWarnings("unused") Object object) { |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
212 } |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
213 |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
214 /** |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
215 * Ensures that the given object will be virtual at the current position. |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
216 */ |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
217 public static void ensureVirtualizedHere(@SuppressWarnings("unused") Object object) { |
130e5f69d1a6
Lukas wants there methods to be available for Truffle language implementors.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21991
diff
changeset
|
218 } |
9283
159ac409c27a
Fix new line at end of file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9282
diff
changeset
|
219 } |