Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java @ 12408:a9837a03127e
Fix wrong modification of ReplacementsImpl macro node method handling.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 15 Oct 2013 00:31:43 +0200 |
parents | 139b84d713bc |
children | 3e013f4512de |
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 /* |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
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 |
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
|
27 import java.lang.annotation.*; |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
28 import java.lang.reflect.*; |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import java.util.concurrent.*; |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
31 import com.oracle.truffle.api.frame.*; |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
32 |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
33 import sun.misc.*; |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
34 |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 /** |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 * 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
|
37 * 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
|
38 */ |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
39 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
|
40 |
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
|
41 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
|
42 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
|
43 |
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 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
|
45 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
|
46 |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
47 private static final Unsafe UNSAFE = getUnsafe(); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
48 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
49 private static Unsafe getUnsafe() { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
50 try { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
51 return Unsafe.getUnsafe(); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
52 } catch (SecurityException e) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
53 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
54 try { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
55 Field theUnsafeInstance = Unsafe.class.getDeclaredField("theUnsafe"); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
56 theUnsafeInstance.setAccessible(true); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
57 return (Unsafe) theUnsafeInstance.get(Unsafe.class); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
58 } catch (Exception e) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
59 throw new RuntimeException("exception while trying to get Unsafe.theUnsafe via reflection:", e); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
60 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
61 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
62 |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 /** |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 * 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
|
65 * 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
|
66 */ |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 public static void transferToInterpreter() { |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 } |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 /** |
11269
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
71 * Returns a boolean value indicating whether the method is executed in the interpreter. |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
72 * |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
73 * @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
|
74 */ |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
75 public static boolean inInterpreter() { |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
76 return true; |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
77 } |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
78 |
f00c85ee46a2
Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents:
10687
diff
changeset
|
79 /** |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 * 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
|
81 * and ignored 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
|
82 * |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 * @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
|
84 */ |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 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
|
86 runnable.run(); |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 } |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
88 |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 /** |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 * 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
|
91 * interpreter. |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 * |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 * @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
|
94 * @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
|
95 * @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
|
96 */ |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 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
|
98 return callable.call(); |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 } |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 /** |
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
|
102 * 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
|
103 * 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
|
104 * between 0.0 and 1.0 (inclusive). The condition should not be a combined condition. |
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
|
105 * |
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
|
106 * 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
|
107 * be greater than b is 90%): |
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
|
108 * |
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
|
109 * <code> |
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
|
110 * if (injectBranchProbability(0.9, a > b)) { |
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
|
111 * // ... |
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
|
112 * } |
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
|
113 * </code> |
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
|
114 * |
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
|
115 * 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
|
116 * 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
|
117 * 10%): |
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
|
118 * |
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
|
119 * <code> |
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
|
120 * if (injectBranchProbability(0.9, a > b) && injectBranchProbability(0.1, a == 0)) { |
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
|
121 * // ... |
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
|
122 * } |
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
|
123 * </code> |
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
|
124 * |
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
|
125 * 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
|
126 * {@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
|
127 * {@link #FASTPATH_PROBABILITY} ). |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 * |
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 * @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
|
130 */ |
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
|
131 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
|
132 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
|
133 return condition; |
9244
8f540423a5be
Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 } |
9282
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
135 |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
136 /** |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
137 * Bails out of a compilation (e.g., for guest language features that should never be compiled). |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
138 * |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
139 * @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
|
140 */ |
f5e58a1eca55
Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9244
diff
changeset
|
141 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
|
142 } |
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
|
143 |
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
|
144 /** |
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
|
145 * 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
|
146 * 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
|
147 */ |
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
|
148 @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
|
149 @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
|
150 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
|
151 } |
9349
0fccad3ce40d
Introduce CompilerDirectives.Unsafe. Mark Frame.getArguments method as unsafe.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9319
diff
changeset
|
152 |
0fccad3ce40d
Introduce CompilerDirectives.Unsafe. Mark Frame.getArguments method as unsafe.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9319
diff
changeset
|
153 /** |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
154 * Casts the given value to the value of the given type without any checks. The class must |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
155 * evaluate to a constant. The condition parameter gives a hint to the compiler under which |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
156 * circumstances this cast can be moved to an earlier location in the program. |
10649
ac8b195fd3aa
New unsafe cast CompilerDirectives method in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9349
diff
changeset
|
157 * |
ac8b195fd3aa
New unsafe cast CompilerDirectives method in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9349
diff
changeset
|
158 * @param value the value that is known to have the specified type |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
159 * @param type the specified new type of the value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
160 * @param condition the condition that makes this cast safe also at an earlier location of the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
161 * program |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
162 * @return the value to be casted to the new type |
11303
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
163 */ |
11312
f0c8303cf88e
Restructure Truffle API node intrinsics and introduce new intrinsics for type system modelling.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11307
diff
changeset
|
164 @SuppressWarnings("unchecked") |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
165 public static <T> T unsafeCast(Object value, Class<T> type, boolean condition) { |
11312
f0c8303cf88e
Restructure Truffle API node intrinsics and introduce new intrinsics for type system modelling.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11307
diff
changeset
|
166 return (T) value; |
11303
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
167 } |
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
168 |
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
169 /** |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
170 * Asserts that this value is not null and retrieved from a call to Frame.materialize. |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
171 * |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
172 * @param value the value that is known to have been obtained via Frame.materialize |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
173 * @return the value to be casted to the new type |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
174 */ |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
175 public static MaterializedFrame unsafeFrameCast(MaterializedFrame value) { |
12408
a9837a03127e
Fix wrong modification of ReplacementsImpl macro node method handling.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
176 return unsafeCast(value, getUnsafeFrameType(), true); |
a9837a03127e
Fix wrong modification of ReplacementsImpl macro node method handling.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
177 } |
a9837a03127e
Fix wrong modification of ReplacementsImpl macro node method handling.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
178 |
a9837a03127e
Fix wrong modification of ReplacementsImpl macro node method handling.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
179 private static Class<? extends MaterializedFrame> getUnsafeFrameType() { |
a9837a03127e
Fix wrong modification of ReplacementsImpl macro node method handling.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12405
diff
changeset
|
180 return MaterializedFrame.class; |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
181 } |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
182 |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11898
diff
changeset
|
183 /** |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
184 * Unsafe access to a boolean value within an object. The condition parameter gives a hint to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
185 * the compiler under which circumstances this access can be moved to an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
186 * program. The location identity gives a hint to the compiler for improved global value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
187 * numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
188 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
189 * @param receiver the object that is accessed |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
190 * @param offset the offset at which to access the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
191 * @param condition the condition that makes this access safe also at an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
192 * program |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
193 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
194 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
195 * @return the accessed value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
196 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
197 public static boolean unsafeGetBoolean(Object receiver, long offset, boolean condition, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
198 return UNSAFE.getBoolean(receiver, offset); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
199 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
200 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
201 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
202 * Unsafe access to a byte value within an object. The condition parameter gives a hint to the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
203 * compiler under which circumstances this access can be moved to an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
204 * program. The location identity gives a hint to the compiler for improved global value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
205 * numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
206 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
207 * @param receiver the object that is accessed |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
208 * @param offset the offset at which to access the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
209 * @param condition the condition that makes this access safe also at an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
210 * program |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
211 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
212 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
213 * @return the accessed value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
214 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
215 public static byte unsafeGetByte(Object receiver, long offset, boolean condition, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
216 return UNSAFE.getByte(receiver, offset); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
217 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
218 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
219 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
220 * Unsafe access to a short value within an object. The condition parameter gives a hint to the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
221 * compiler under which circumstances this access can be moved to an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
222 * program. The location identity gives a hint to the compiler for improved global value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
223 * numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
224 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
225 * @param receiver the object that is accessed |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
226 * @param offset the offset at which to access the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
227 * @param condition the condition that makes this access safe also at an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
228 * program |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
229 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
230 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
231 * @return the accessed value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
232 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
233 public static short unsafeGetShort(Object receiver, long offset, boolean condition, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
234 return UNSAFE.getShort(receiver, offset); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
235 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
236 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
237 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
238 * Unsafe access to a int value within an object. The condition parameter gives a hint to the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
239 * compiler under which circumstances this access can be moved to an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
240 * program. The location identity gives a hint to the compiler for improved global value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
241 * numbering. |
11303
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
242 * |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
243 * @param receiver the object that is accessed |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
244 * @param offset the offset at which to access the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
245 * @param condition the condition that makes this access safe also at an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
246 * program |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
247 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
248 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
249 * @return the accessed value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
250 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
251 public static int unsafeGetInt(Object receiver, long offset, boolean condition, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
252 return UNSAFE.getInt(receiver, offset); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
253 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
254 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
255 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
256 * Unsafe access to a long value within an object. The condition parameter gives a hint to the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
257 * compiler under which circumstances this access can be moved to an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
258 * program. The location identity gives a hint to the compiler for improved global value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
259 * numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
260 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
261 * @param receiver the object that is accessed |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
262 * @param offset the offset at which to access the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
263 * @param condition the condition that makes this access safe also at an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
264 * program |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
265 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
266 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
267 * @return the accessed value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
268 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
269 public static long unsafeGetLong(Object receiver, long offset, boolean condition, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
270 return UNSAFE.getLong(receiver, offset); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
271 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
272 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
273 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
274 * Unsafe access to a float value within an object. The condition parameter gives a hint to the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
275 * compiler under which circumstances this access can be moved to an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
276 * program. The location identity gives a hint to the compiler for improved global value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
277 * numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
278 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
279 * @param receiver the object that is accessed |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
280 * @param offset the offset at which to access the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
281 * @param condition the condition that makes this access safe also at an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
282 * program |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
283 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
284 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
285 * @return the accessed value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
286 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
287 public static float unsafeGetFloat(Object receiver, long offset, boolean condition, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
288 return UNSAFE.getFloat(receiver, offset); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
289 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
290 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
291 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
292 * Unsafe access to a double value within an object. The condition parameter gives a hint to the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
293 * compiler under which circumstances this access can be moved to an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
294 * program. The location identity gives a hint to the compiler for improved global value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
295 * numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
296 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
297 * @param receiver the object that is accessed |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
298 * @param offset the offset at which to access the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
299 * @param condition the condition that makes this access safe also at an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
300 * program |
11303
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
301 * @param locationIdentity the location identity token that can be used for improved global |
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
302 * value numbering or null |
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
303 * @return the accessed value |
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
304 */ |
11898
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
305 public static double unsafeGetDouble(Object receiver, long offset, boolean condition, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
306 return UNSAFE.getDouble(receiver, offset); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
307 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
308 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
309 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
310 * Unsafe access to a Object value within an object. The condition parameter gives a hint to the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
311 * compiler under which circumstances this access can be moved to an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
312 * program. The location identity gives a hint to the compiler for improved global value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
313 * numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
314 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
315 * @param receiver the object that is accessed |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
316 * @param offset the offset at which to access the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
317 * @param condition the condition that makes this access safe also at an earlier location in the |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
318 * program |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
319 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
320 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
321 * @return the accessed value |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
322 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
323 public static Object unsafeGetObject(Object receiver, long offset, boolean condition, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
324 return UNSAFE.getObject(receiver, offset); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
325 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
326 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
327 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
328 * Write a boolean value within an object. The location identity gives a hint to the compiler |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
329 * for improved global value numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
330 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
331 * @param receiver the object that is written to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
332 * @param offset the offset at which to write to the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
333 * @param value the value to be written |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
334 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
335 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
336 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
337 public static void unsafePutBoolean(Object receiver, long offset, boolean value, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
338 UNSAFE.putBoolean(receiver, offset, value); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
339 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
340 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
341 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
342 * Write a byte value within an object. The location identity gives a hint to the compiler for |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
343 * improved global value numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
344 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
345 * @param receiver the object that is written to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
346 * @param offset the offset at which to write to the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
347 * @param value the value to be written |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
348 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
349 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
350 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
351 public static void unsafePutByte(Object receiver, long offset, byte value, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
352 UNSAFE.putByte(receiver, offset, value); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
353 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
354 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
355 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
356 * Write a short value within an object. The location identity gives a hint to the compiler for |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
357 * improved global value numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
358 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
359 * @param receiver the object that is written to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
360 * @param offset the offset at which to write to the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
361 * @param value the value to be written |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
362 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
363 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
364 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
365 public static void unsafePutShort(Object receiver, long offset, short value, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
366 UNSAFE.putShort(receiver, offset, value); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
367 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
368 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
369 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
370 * Write a int value within an object. The location identity gives a hint to the compiler for |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
371 * improved global value numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
372 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
373 * @param receiver the object that is written to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
374 * @param offset the offset at which to write to the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
375 * @param value the value to be written |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
376 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
377 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
378 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
379 public static void unsafePutInt(Object receiver, long offset, int value, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
380 UNSAFE.putInt(receiver, offset, value); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
381 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
382 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
383 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
384 * Write a long value within an object. The location identity gives a hint to the compiler for |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
385 * improved global value numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
386 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
387 * @param receiver the object that is written to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
388 * @param offset the offset at which to write to the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
389 * @param value the value to be written |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
390 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
391 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
392 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
393 public static void unsafePutLong(Object receiver, long offset, long value, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
394 UNSAFE.putLong(receiver, offset, value); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
395 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
396 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
397 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
398 * Write a float value within an object. The location identity gives a hint to the compiler for |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
399 * improved global value numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
400 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
401 * @param receiver the object that is written to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
402 * @param offset the offset at which to write to the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
403 * @param value the value to be written |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
404 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
405 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
406 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
407 public static void unsafePutFloat(Object receiver, long offset, float value, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
408 UNSAFE.putFloat(receiver, offset, value); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
409 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
410 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
411 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
412 * Write a double value within an object. The location identity gives a hint to the compiler for |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
413 * improved global value numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
414 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
415 * @param receiver the object that is written to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
416 * @param offset the offset at which to write to the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
417 * @param value the value to be written |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
418 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
419 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
420 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
421 public static void unsafePutDouble(Object receiver, long offset, double value, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
422 UNSAFE.putDouble(receiver, offset, value); |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
423 } |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
424 |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
425 /** |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
426 * Write a Object value within an object. The location identity gives a hint to the compiler for |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
427 * improved global value numbering. |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
428 * |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
429 * @param receiver the object that is written to |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
430 * @param offset the offset at which to write to the object in bytes |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
431 * @param value the value to be written |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
432 * @param locationIdentity the location identity token that can be used for improved global |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
433 * value numbering or null |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
434 */ |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
435 public static void unsafePutObject(Object receiver, long offset, Object value, Object locationIdentity) { |
f753092f608d
Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11897
diff
changeset
|
436 UNSAFE.putObject(receiver, offset, value); |
11303
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
437 } |
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
438 |
28da427847c5
New Truffle API methods for efficient implementation of a custom type system on top of the JVM.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11279
diff
changeset
|
439 /** |
10687
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
440 * Marks methods that are considered slowpath and should therefore not be inlined by default. |
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
441 */ |
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
442 @Retention(RetentionPolicy.RUNTIME) |
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
443 @Target({ElementType.METHOD}) |
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
444 public @interface SlowPath { |
d2055a110396
Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10650
diff
changeset
|
445 } |
11495
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
446 |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
447 /** |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
448 * 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
|
449 * 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
|
450 */ |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
451 @Retention(RetentionPolicy.RUNTIME) |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
452 @Target({ElementType.TYPE}) |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
453 public @interface ValueType { |
3662471dcfaa
Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11322
diff
changeset
|
454 } |
9283
159ac409c27a
Fix new line at end of file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9282
diff
changeset
|
455 } |