annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java @ 18906:48dd71b3dc03

Truffle: deprecate CompilerDirectives.unsafe* methods. to be removed soon, migrate your code!
author Andreas Woess <andreas.woess@jku.at>
date Thu, 22 Jan 2015 01:08:25 +0100
parents d079b2af3a15
children f7375de5eaa0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14906
diff changeset
31 import sun.misc.*;
12405
139b84d713bc Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11898
diff changeset
32
9244
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 /**
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 * 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
35 * 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
36 */
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
37 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
38
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
39 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
40 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
41
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 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
43 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
44
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
45 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
46
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 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 try {
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
49 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
50 } 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
51 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
52 try {
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
53 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
54 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
55 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
56 } 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
57 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
58 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
59 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
60
9244
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 /**
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 * 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
63 * 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
64 */
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 public static void transferToInterpreter() {
16535
ada0a7729b6f Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents: 15230
diff changeset
66 if (inInterpreter()) {
ada0a7729b6f Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents: 15230
diff changeset
67 Truffle.getRuntime().notifyTransferToInterpreter();
ada0a7729b6f Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents: 15230
diff changeset
68 }
9244
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
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 /**
12770
3e013f4512de temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents: 12408
diff changeset
72 * Directive for the compiler to discontinue compilation at this code position and instead
3e013f4512de temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents: 12408
diff changeset
73 * insert a transfer to the interpreter, invalidating the currently executing machine code.
3e013f4512de temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents: 12408
diff changeset
74 */
3e013f4512de temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents: 12408
diff changeset
75 public static void transferToInterpreterAndInvalidate() {
16535
ada0a7729b6f Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents: 15230
diff changeset
76 if (inInterpreter()) {
ada0a7729b6f Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents: 15230
diff changeset
77 Truffle.getRuntime().notifyTransferToInterpreter();
ada0a7729b6f Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents: 15230
diff changeset
78 }
12770
3e013f4512de temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents: 12408
diff changeset
79 }
3e013f4512de temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents: 12408
diff changeset
80
3e013f4512de temporary addition of CompilerDirectives.transferToInterpreterAndInvalidate()
Michael Haupt <michael.haupt@oracle.com>
parents: 12408
diff changeset
81 /**
11269
f00c85ee46a2 Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents: 10687
diff changeset
82 * Returns a boolean value indicating whether the method is executed in the interpreter.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
83 *
11269
f00c85ee46a2 Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents: 10687
diff changeset
84 * @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
85 */
f00c85ee46a2 Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents: 10687
diff changeset
86 public static boolean inInterpreter() {
f00c85ee46a2 Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents: 10687
diff changeset
87 return true;
f00c85ee46a2 Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents: 10687
diff changeset
88 }
f00c85ee46a2 Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents: 10687
diff changeset
89
f00c85ee46a2 Truffle: add CompilerDirectives.inInterpreter()
Andreas Woess <andreas.woess@jku.at>
parents: 10687
diff changeset
90 /**
15230
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
91 * Returns a boolean value indicating whether the method is executed in the compiled code.
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
92 *
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
93 * @return {@code false} when executed in the interpreter, {@code true} in compiled code.
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
94 */
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
95 public static boolean inCompiledCode() {
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
96 return false;
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
97 }
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
98
df724f63f776 Truffle API: Introduce new compiler directive inCompiledCode() as the negation of inInterpreter().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15064
diff changeset
99 /**
17444
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
100 * Returns a boolean indicating whether or not a given value is seen as constant in optimized
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
101 * code. If this method is called in the interpreter this method will always return
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
102 * <code>false</code>. This API may be used in combination with {@link #inCompiledCode()} to
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
103 * implement compilation constant assertions in the following way:
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
104 *
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
105 * <pre>
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
106 * <code>
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
107 * void assertCompilationConstant(Object value) {
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
108 * if (inCompiledCode()) {
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
109 * if (!isCompilationConstant(value)) {
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
110 * throw new AssertionError("Given value is not constant");
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
111 * }
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
112 * }
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
113 * }
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
114 * </code>
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
115 * </pre>
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
116 *
18309
d079b2af3a15 Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents: 18219
diff changeset
117 * Note that optimizations that a compiler will apply to code that is conditional on
d079b2af3a15 Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents: 18219
diff changeset
118 * <code>isCompilationConstant</code> may be limited. For this reason
d079b2af3a15 Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents: 18219
diff changeset
119 * <code>isCompilationConstant</code> is not recommended for use to select between alternate
d079b2af3a15 Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents: 18219
diff changeset
120 * implementations of functionality depending on whether a value is constant. Instead, it is
d079b2af3a15 Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents: 18219
diff changeset
121 * intended for use as a diagnostic mechanism, such as illustrated above.
d079b2af3a15 Truffle: more explicit warning about isCompilationConstant.
Chris Seaton <chris.seaton@oracle.com>
parents: 18219
diff changeset
122 *
17444
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
123 * @param value
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
124 * @return {@code true} when given value is seen as compilation constant, {@code false} if not
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
125 * compilation constant.
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
126 */
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
127 public static boolean isCompilationConstant(Object value) {
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
128 return false;
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
129 }
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
130
2834b4432586 Truffle: introduce CompilerDirectives.isCompilationConstant.
Christian Humer <christian.humer@gmail.com>
parents: 16535
diff changeset
131 /**
9244
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 * 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
133 * and ignored in the compiled code.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
134 *
9244
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 * @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
136 */
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137 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
138 runnable.run();
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139 }
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 /**
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 * 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
143 * interpreter.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
144 *
9244
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145 * @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
146 * @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
147 * @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
148 */
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149 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
150 return callable.call();
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
151 }
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
152
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153 /**
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
154 * 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
155 * 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
156 * between 0.0 and 1.0 (inclusive). The condition should not be a combined condition.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
157 *
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
158 * 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
159 * be greater than b is 90%):
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
160 *
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
161 * <code>
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14880
diff changeset
162 * if (injectBranchProbability(0.9, a &gt; b)) {
9319
1188b7c42196 Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9313
diff changeset
163 * // ...
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
164 * }
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
165 * </code>
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
166 *
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
167 * 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
168 * 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
169 * 10%):
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
170 *
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
171 * <code>
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14880
diff changeset
172 * if (injectBranchProbability(0.9, a &gt; b) &amp;&amp; injectBranchProbability(0.1, a == 0)) {
9319
1188b7c42196 Changed the behavior of CompilerDirectives.injectBranchProbability and added javadoc to document the new behavior. Introduced probability constants. Removed CompilerDirectives.slowpath().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9313
diff changeset
173 * // ...
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
174 * }
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
175 * </code>
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
176 *
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
177 * 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
178 * {@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
179 * {@link #FASTPATH_PROBABILITY} ).
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
180 *
9244
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 * @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
182 */
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
183 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
184 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
185 return condition;
9244
8f540423a5be Added two new classes to the Truffle API: CompilerDirectives and CompilerAsserts.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
186 }
9282
f5e58a1eca55 Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9244
diff changeset
187
f5e58a1eca55 Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9244
diff changeset
188 /**
f5e58a1eca55 Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9244
diff changeset
189 * Bails out of a compilation (e.g., for guest language features that should never be compiled).
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
190 *
9282
f5e58a1eca55 Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9244
diff changeset
191 * @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
192 */
f5e58a1eca55 Added method CompilerDirectives.bailout to the Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9244
diff changeset
193 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
194 }
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
195
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
196 /**
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
197 * 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
198 * 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
199 */
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
200 @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
201 @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
202 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
203 }
9349
0fccad3ce40d Introduce CompilerDirectives.Unsafe. Mark Frame.getArguments method as unsafe.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9319
diff changeset
204
0fccad3ce40d Introduce CompilerDirectives.Unsafe. Mark Frame.getArguments method as unsafe.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9319
diff changeset
205 /**
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
206 * 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
207 * 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
208 * circumstances this cast can be moved to an earlier location in the program.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
209 *
10649
ac8b195fd3aa New unsafe cast CompilerDirectives method in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9349
diff changeset
210 * @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
211 * @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
212 * @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
213 * program
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
214 * @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
215 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
216 @Deprecated
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
217 public static <T> T unsafeCast(Object value, Class<T> type, boolean condition) {
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
218 return unsafeCast(value, type, condition, false);
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
219 }
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
220
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
221 /**
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
222 * Casts the given value to the value of the given type without any checks. The class must
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
223 * evaluate to a constant. The condition parameter gives a hint to the compiler under which
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
224 * circumstances this cast can be moved to an earlier location in the program.
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
225 *
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
226 * @param value the value that is known to have the specified type
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
227 * @param type the specified new type of the value
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
228 * @param condition the condition that makes this cast safe also at an earlier location of the
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
229 * program
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
230 * @param nonNull whether value is known to never be null
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
231 * @return the value to be casted to the new type
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
232 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
233 @Deprecated
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
234 @SuppressWarnings("unchecked")
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
235 public static <T> T unsafeCast(Object value, Class<T> type, boolean condition, boolean nonNull) {
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
236 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
237 }
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
238
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
239 /**
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
240 * 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
241 * 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
242 * 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
243 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
244 *
11898
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 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
246 * @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
247 * @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
248 * program
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
249 * @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
250 * 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
251 * @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
252 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
253 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
254 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
255 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
256 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
257
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
258 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
259 * 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
260 * 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
261 * 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
262 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
263 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
264 * @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
265 * @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
266 * @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
267 * program
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
268 * @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
269 * 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
270 * @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
271 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
272 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
273 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
274 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
275 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
276
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
277 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
278 * 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
279 * 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
280 * 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
281 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
282 *
11898
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 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
284 * @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
285 * @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
286 * program
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
287 * @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
288 * 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
289 * @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
290 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
291 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
292 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
293 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
294 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
295
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
296 /**
13955
1541afe9cf15 add missing unsafeGetLong substitution; minor grammar fix (a/an)
Andreas Woess <andreas.woess@jku.at>
parents: 12770
diff changeset
297 * Unsafe access to an int value within an object. The condition parameter gives a hint to the
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
298 * 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
299 * 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
300 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
301 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
302 * @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
303 * @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
304 * @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
305 * program
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
306 * @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
307 * 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
308 * @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
309 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
310 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
311 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
312 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
313 }
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 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
316 * 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
317 * 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
318 * 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
319 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
320 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
321 * @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
322 * @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
323 * @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
324 * program
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
325 * @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
326 * 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
327 * @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
328 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
329 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
330 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
331 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
332 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
333
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
334 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
335 * 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
336 * 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
337 * 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
338 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
339 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
340 * @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
341 * @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
342 * @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
343 * program
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
344 * @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
345 * 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
346 * @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
347 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
348 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
349 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
350 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
351 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
352
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 * 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
355 * 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
356 * 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
357 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
358 *
11898
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 accessed
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 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
361 * @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
362 * 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
363 * @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
364 * 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
365 * @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
366 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
367 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
368 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
369 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
370 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
371
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
372 /**
13955
1541afe9cf15 add missing unsafeGetLong substitution; minor grammar fix (a/an)
Andreas Woess <andreas.woess@jku.at>
parents: 12770
diff changeset
373 * Unsafe access to an Object value within an object. The condition parameter gives a hint to
1541afe9cf15 add missing unsafeGetLong substitution; minor grammar fix (a/an)
Andreas Woess <andreas.woess@jku.at>
parents: 12770
diff changeset
374 * the compiler under which circumstances this access can be moved to an earlier location in the
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
375 * 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
376 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
377 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
378 * @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
379 * @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
380 * @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
381 * program
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
382 * @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
383 * 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
384 * @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
385 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
386 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
387 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
388 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
389 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
390
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
391 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
392 * 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
393 * for improved global value numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
394 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
395 * @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
396 * @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
397 * @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
398 * @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
399 * 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
400 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
401 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
402 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
403 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
404 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
405
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 * 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
408 * improved global value numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
409 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
410 * @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
411 * @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
412 * @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
413 * @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
414 * 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
415 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
416 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
417 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
418 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
419 }
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 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
422 * 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
423 * improved global value numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
424 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
425 * @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
426 * @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
427 * @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
428 * @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
429 * 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
430 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
431 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
432 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
433 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
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
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
436 /**
13955
1541afe9cf15 add missing unsafeGetLong substitution; minor grammar fix (a/an)
Andreas Woess <andreas.woess@jku.at>
parents: 12770
diff changeset
437 * Write an int value within an object. The location identity gives a hint to the compiler for
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
438 * improved global value numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
439 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
440 * @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
441 * @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
442 * @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
443 * @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
444 * 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
445 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
446 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
447 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
448 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
449 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
450
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
451 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
452 * 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
453 * improved global value numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
454 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
455 * @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
456 * @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
457 * @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
458 * @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
459 * 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
460 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
461 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
462 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
463 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
464 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
465
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
466 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
467 * 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
468 * improved global value numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
469 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
470 * @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
471 * @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
472 * @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
473 * @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
474 * 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
475 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
476 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
477 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
478 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
479 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
480
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
481 /**
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
482 * 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
483 * improved global value numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
484 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
485 * @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
486 * @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
487 * @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
488 * @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
489 * 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
490 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
491 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
492 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
493 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
494 }
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
495
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
496 /**
13955
1541afe9cf15 add missing unsafeGetLong substitution; minor grammar fix (a/an)
Andreas Woess <andreas.woess@jku.at>
parents: 12770
diff changeset
497 * Write an Object value within an object. The location identity gives a hint to the compiler
1541afe9cf15 add missing unsafeGetLong substitution; minor grammar fix (a/an)
Andreas Woess <andreas.woess@jku.at>
parents: 12770
diff changeset
498 * for improved global value numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
499 *
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
500 * @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
501 * @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
502 * @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
503 * @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
504 * 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
505 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
506 @Deprecated
11898
f753092f608d Adjustments to unsafe access and unsafe cast compiler directives in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11897
diff changeset
507 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
508 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
509 }
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
510
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
511 /**
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
512 * Unsafe access to a final boolean value within an object. The condition parameter gives a hint
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
513 * to the compiler under which circumstances this access can be moved to an earlier location in
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
514 * the program. The location identity gives a hint to the compiler for improved global value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
515 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
516 *
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
517 * @param receiver the object that is accessed
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
518 * @param offset the offset at which to access the object in bytes
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
519 * @param condition the condition that makes this access safe also at an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
520 * program
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
521 * @param locationIdentity the location identity token that can be used for improved global
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
522 * value numbering or null
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
523 * @return the accessed value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
524 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
525 @Deprecated
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
526 public static boolean unsafeGetFinalBoolean(Object receiver, long offset, boolean condition, Object locationIdentity) {
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
527 return UNSAFE.getBoolean(receiver, offset);
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
528 }
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
529
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
530 /**
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
531 * Unsafe access to a final byte value within an object. The condition parameter gives a hint to
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
532 * the compiler under which circumstances this access can be moved to an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
533 * program. The location identity gives a hint to the compiler for improved global value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
534 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
535 *
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
536 * @param receiver the object that is accessed
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
537 * @param offset the offset at which to access the object in bytes
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
538 * @param condition the condition that makes this access safe also at an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
539 * program
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
540 * @param locationIdentity the location identity token that can be used for improved global
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
541 * value numbering or null
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
542 * @return the accessed value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
543 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
544 @Deprecated
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
545 public static byte unsafeGetFinalByte(Object receiver, long offset, boolean condition, Object locationIdentity) {
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
546 return UNSAFE.getByte(receiver, offset);
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
547 }
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
548
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
549 /**
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
550 * Unsafe access to a final short value within an object. The condition parameter gives a hint
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
551 * to the compiler under which circumstances this access can be moved to an earlier location in
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
552 * the program. The location identity gives a hint to the compiler for improved global value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
553 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
554 *
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
555 * @param receiver the object that is accessed
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
556 * @param offset the offset at which to access the object in bytes
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
557 * @param condition the condition that makes this access safe also at an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
558 * program
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
559 * @param locationIdentity the location identity token that can be used for improved global
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
560 * value numbering or null
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
561 * @return the accessed value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
562 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
563 @Deprecated
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
564 public static short unsafeGetFinalShort(Object receiver, long offset, boolean condition, Object locationIdentity) {
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
565 return UNSAFE.getShort(receiver, offset);
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
566 }
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
567
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
568 /**
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
569 * Unsafe access to a final int value within an object. The condition parameter gives a hint to
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
570 * the compiler under which circumstances this access can be moved to an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
571 * program. The location identity gives a hint to the compiler for improved global value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
572 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
573 *
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
574 * @param receiver the object that is accessed
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
575 * @param offset the offset at which to access the object in bytes
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
576 * @param condition the condition that makes this access safe also at an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
577 * program
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
578 * @param locationIdentity the location identity token that can be used for improved global
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
579 * value numbering or null
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
580 * @return the accessed value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
581 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
582 @Deprecated
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
583 public static int unsafeGetFinalInt(Object receiver, long offset, boolean condition, Object locationIdentity) {
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
584 return UNSAFE.getInt(receiver, offset);
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
585 }
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
586
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
587 /**
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
588 * Unsafe access to a final long value within an object. The condition parameter gives a hint to
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
589 * the compiler under which circumstances this access can be moved to an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
590 * program. The location identity gives a hint to the compiler for improved global value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
591 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
592 *
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
593 * @param receiver the object that is accessed
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
594 * @param offset the offset at which to access the object in bytes
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
595 * @param condition the condition that makes this access safe also at an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
596 * program
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
597 * @param locationIdentity the location identity token that can be used for improved global
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
598 * value numbering or null
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
599 * @return the accessed value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
600 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
601 @Deprecated
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
602 public static long unsafeGetFinalLong(Object receiver, long offset, boolean condition, Object locationIdentity) {
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
603 return UNSAFE.getLong(receiver, offset);
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
604 }
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
605
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
606 /**
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
607 * Unsafe access to a final float value within an object. The condition parameter gives a hint
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
608 * to the compiler under which circumstances this access can be moved to an earlier location in
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
609 * the program. The location identity gives a hint to the compiler for improved global value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
610 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
611 *
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
612 * @param receiver the object that is accessed
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
613 * @param offset the offset at which to access the object in bytes
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
614 * @param condition the condition that makes this access safe also at an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
615 * program
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
616 * @param locationIdentity the location identity token that can be used for improved global
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
617 * value numbering or null
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
618 * @return the accessed value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
619 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
620 @Deprecated
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
621 public static float unsafeGetFinalFloat(Object receiver, long offset, boolean condition, Object locationIdentity) {
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
622 return UNSAFE.getFloat(receiver, offset);
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
623 }
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
624
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
625 /**
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
626 * Unsafe access to a final double value within an object. The condition parameter gives a hint
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
627 * to the compiler under which circumstances this access can be moved to an earlier location in
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
628 * the program. The location identity gives a hint to the compiler for improved global value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
629 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
630 *
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
631 * @param receiver the object that is accessed
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
632 * @param offset the offset at which to access the object in bytes
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
633 * @param condition the condition that makes this access safe also at an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
634 * program
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
635 * @param locationIdentity the location identity token that can be used for improved global
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
636 * value numbering or null
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
637 * @return the accessed value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
638 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
639 @Deprecated
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
640 public static double unsafeGetFinalDouble(Object receiver, long offset, boolean condition, Object locationIdentity) {
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
641 return UNSAFE.getDouble(receiver, offset);
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
642 }
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
643
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
644 /**
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
645 * Unsafe access to a final Object value within an object. The condition parameter gives a hint
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
646 * to the compiler under which circumstances this access can be moved to an earlier location in
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
647 * the program. The location identity gives a hint to the compiler for improved global value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
648 * numbering.
14880
73546bd550f0 CompilerDirectives: add optional nonNull parameter to unsafeCast
Andreas Woess <andreas.woess@jku.at>
parents: 13956
diff changeset
649 *
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
650 * @param receiver the object that is accessed
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
651 * @param offset the offset at which to access the object in bytes
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
652 * @param condition the condition that makes this access safe also at an earlier location in the
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
653 * program
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
654 * @param locationIdentity the location identity token that can be used for improved global
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
655 * value numbering or null
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
656 * @return the accessed value
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
657 */
18906
48dd71b3dc03 Truffle: deprecate CompilerDirectives.unsafe* methods.
Andreas Woess <andreas.woess@jku.at>
parents: 18309
diff changeset
658 @Deprecated
13956
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
659 public static Object unsafeGetFinalObject(Object receiver, long offset, boolean condition, Object locationIdentity) {
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
660 return UNSAFE.getObject(receiver, offset);
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
661 }
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
662
fca29edf5667 experimental CompilerDirectives.unsafeGetFinal*
Andreas Woess <andreas.woess@jku.at>
parents: 13955
diff changeset
663 /**
18130
b4e38f4ca414 Truffle: rename @SlowPath to @TruffleBoundary.
Christian Humer <christian.humer@gmail.com>
parents: 17444
diff changeset
664 * Marks a method that it is considered as a boundary for Truffle partial evaluation.
10687
d2055a110396 Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10650
diff changeset
665 */
d2055a110396 Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10650
diff changeset
666 @Retention(RetentionPolicy.RUNTIME)
d2055a110396 Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10650
diff changeset
667 @Target({ElementType.METHOD})
18130
b4e38f4ca414 Truffle: rename @SlowPath to @TruffleBoundary.
Christian Humer <christian.humer@gmail.com>
parents: 17444
diff changeset
668 public @interface TruffleBoundary {
10687
d2055a110396 Introduce CompilerDirectives.SlowPath annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10650
diff changeset
669 }
11495
3662471dcfaa Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11322
diff changeset
670
3662471dcfaa Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11322
diff changeset
671 /**
3662471dcfaa Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11322
diff changeset
672 * 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
673 * 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
674 */
3662471dcfaa Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11322
diff changeset
675 @Retention(RetentionPolicy.RUNTIME)
3662471dcfaa Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11322
diff changeset
676 @Target({ElementType.TYPE})
3662471dcfaa Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11322
diff changeset
677 public @interface ValueType {
3662471dcfaa Introduce CompilerDirectives.ValueType annotation in Truffle API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11322
diff changeset
678 }
15064
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
679
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
680 /**
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
681 * Ensures that the given object is not virtual, i.e., not removed by Escape Analysis at the
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
682 * point of this call.
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
683 *
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
684 * @param obj the object to exclude from Escape Analysis
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
685 */
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
686 public static void materialize(Object obj) {
f675818d9ad0 new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
687 }
9283
159ac409c27a Fix new line at end of file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9282
diff changeset
688 }