Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/Cached.java @ 21080:3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Wed, 22 Apr 2015 16:46:57 +0200 |
parents | b249bdba508b |
children |
rev | line source |
---|---|
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * accompanied this code). |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 * questions. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 */ |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.dsl; |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import java.lang.annotation.*; |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 import com.oracle.truffle.api.*; |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 import com.oracle.truffle.api.nodes.*; |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
31 import com.oracle.truffle.api.utilities.*; |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
32 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 /** |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 * <p> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
35 * A parameter annotated with {@link Cached} in a {@link Specialization} refers to a <b>cached</b> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
36 * value of a specialization instance. A cached parameter value is initialized once using the |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
37 * initializer expression at specialization instantiation. For each call of the specialization |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
38 * method the cached value is provided by using the annotated parameter from the method body. Cache |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
39 * initializers are potentially executed before guard expressions declared in |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 * {@link Specialization#guards()}. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 * </p> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 * <p> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 * A typical specialization may define multiple dynamic and multiple cached parameters. Dynamic |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 * parameter values are typically provided by executing child nodes of the operation. Cached |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 * parameters are initialized and stored once per specialization instantiation. Cached parameters |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 * are always constant at compile time. You may verify this by invoking |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 * {@link CompilerAsserts#compilationConstant(Object)} on any cached parameter. For consistency |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 * between specialization declarations cached parameters must be declared last in a specialization |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 * method. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 * </p> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 * <p> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 * The initializer expression of a cached parameter is defined using a subset of Java. This subset |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 * includes field/parameter accesses, function calls, type exact infix comparisons (==, !=, <, <=, |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 * >, >=) and integer literals. The return type of the initializer expression must be assignable to |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 * the parameter type. If the annotated parameter type is derived from {@link Node} then the |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
56 * {@link Node} instance is allowed to use the {@link Node#replace(Node)} method to replace itself. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 * Bound elements without receivers are resolved using the following order: |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 * <ol> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 * <li>Dynamic and cached parameters of the enclosing specialization.</li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 * <li>Fields defined using {@link NodeField} for the enclosing node.</li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 * <li>Public constructors of the type of the annotated parameter using the <code>new</code> keyword |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 * as method name.</li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 * <li>Public and static methods or fields of the type of the annotated parameter.</li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 * <li>Non-private, static or virtual methods or fields of enclosing node.</li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
65 * <li>Non-private, static or virtual methods or fields of super types of the enclosing node.</li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
66 * <li>Public and static methods or fields imported using {@link ImportStatic}.</li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 * </ol> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
68 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 * The following examples explain the intended use of the {@link Cached} annotation. All of the |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
70 * examples have to be enclosed in the following node declaration: |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
71 * </p> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
72 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
73 * <pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
74 * @NodeChild("operand") |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
75 * abstract TestNode extends Node { |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 * abstract void execute(Object operandValue); |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 * // ... example here ... |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
78 * } |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
79 * </pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
81 * <ol> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
82 * <li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 * This example defines one dynamic and one cached parameter. The operand parameter is representing |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
84 * the dynamic value of the operand while the cachedOperand is initialized once at first execution |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 * of the specialization (specialization instantiation time). |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
87 * <pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 * @Specialization |
19787
b249bdba508b
Truffle-DSL: @Cached javadoc fixes.
Christian Humer <christian.humer@gmail.com>
parents:
19300
diff
changeset
|
89 * void doCached(int operand, @Cached("operand") int cachedOperand) { |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 * CompilerAsserts.compilationConstant(cachedOperand); |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 * ... |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 * } |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
93 * |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 * Example executions: |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 * execute(1) => doCached(1, 1) // new instantiation, localOperand is bound to 1 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 * execute(0) => doCached(0, 1) |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 * execute(2) => doCached(2, 1) |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 * </pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 * </li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
102 * <li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 * We extend the previous example by a guard for the cachedOperand value to be equal to the dynamic |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 * operand value. This specifies that the specialization is instantiated for each individual operand |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 * value that is provided. There are a lot of individual <code>int</code> values and for each |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 * individual <code>int</code> value a new specialization would get instantiated. The |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 * {@link Specialization#limit()} property defines a limit for the number of specializations that |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 * can get instantiated. If the specialization instantiation limit is reached then no further |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 * specializations are instantiated. Like for other specializations if there are no more |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 * specializations defined an {@link UnsupportedSpecializationException} is thrown. The default |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 * specialization instantiation limit is <code>3</code>. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 * <pre> |
19787
b249bdba508b
Truffle-DSL: @Cached javadoc fixes.
Christian Humer <christian.humer@gmail.com>
parents:
19300
diff
changeset
|
114 * @Specialization(guards = "operand == cachedOperand") |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 * void doCached(int operand, @Cached("operand") int cachedOperand) { |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
116 * CompilerAsserts.compilationConstant(cachedOperand); |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
117 * ... |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
118 * } |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
120 * Example executions: |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
121 * execute(0) => doCached(0, 0) // new instantiation, cachedOperand is bound to 0 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 * execute(1) => doCached(1, 1) // new instantiation, cachedOperand is bound to 1 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
123 * execute(1) => doCached(1, 1) |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 * execute(2) => doCached(2, 2) // new instantiation, cachedOperand is bound to 2 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 * execute(3) => throws UnsupportedSpecializationException // instantiation limit overflows |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
126 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
127 * </pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
128 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 * </li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 * <li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
131 * To handle the limit overflow we extend our example by an additional specialization named |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
132 * <code>doNormal</code>. This specialization has the same type restrictions but does not have local |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
133 * state nor the operand identity guard. It is also declared after <code>doCached</code> therefore |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
134 * it is only instantiated if the limit of the <code>doCached</code> specialization has been |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
135 * reached. In other words <code>doNormal</code> is more generic than <code>doCached</code> . The |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
136 * <code>doNormal</code> specialization uses <code>contains="doCached"</code> to specify |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
137 * that all instantiations of <code>doCached</code> get removed if <code>doNormal</code> is |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
138 * instantiated. Alternatively if the <code>contains</code> relation is omitted then all |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
139 * <code>doCached</code> instances remain but no new instances are created. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
140 * |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
141 * <code> |
19787
b249bdba508b
Truffle-DSL: @Cached javadoc fixes.
Christian Humer <christian.humer@gmail.com>
parents:
19300
diff
changeset
|
142 * @Specialization(guards = "operand == cachedOperand") |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
143 * void doCached(int operand, @Cached("operand") int cachedOperand) { |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
144 * CompilerAsserts.compilationConstant(cachedOperand); |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
145 * ... |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
146 * } |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
147 * |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
148 * @Specialization(contains = "doCached") |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
149 * void doNormal(int operand) {...} |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
150 * |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
151 * Example executions with contains = "doCached": |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
152 * execute(0) => doCached(0, 0) // new instantiation, cachedOperand is bound to 0 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
153 * execute(1) => doCached(1, 1) // new instantiation, cachedOperand is bound to 1 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
154 * execute(1) => doCached(1, 1) |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
155 * execute(2) => doCached(2, 2) // new instantiation, cachedOperand is bound to 2 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
156 * execute(3) => doNormal(3) // new instantiation of doNormal due to limit overflow; doCached gets removed. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
157 * execute(1) => doNormal(1) |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
158 * |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
159 * Example executions without contains = "doCached": |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
160 * execute(0) => doCached(0, 0) // new instantiation, cachedOperand is bound to 0 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
161 * execute(1) => doCached(1, 1) // new instantiation, cachedOperand is bound to 1 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
162 * execute(1) => doCached(1, 1) |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
163 * execute(2) => doCached(2, 2) // new instantiation, cachedOperand is bound to 2 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
164 * execute(3) => doNormal(3) // new instantiation of doNormal due to limit overflow |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
165 * execute(1) => doCached(1, 1) |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
166 * |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
167 * </code> |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
168 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
169 * </li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
170 * <li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
171 * This next example shows how methods from the enclosing node can be used to initialize cached |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
172 * parameters. Please note that the visibility of transformLocal must not be <code>private</code>. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
173 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
174 * <pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
175 * @Specialization |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
176 * void s(int operand, @Cached("transformLocal(operand)") int cachedOperand) { |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
177 * } |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
178 * |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
179 * int transformLocal(int operand) { |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
180 * return operand & 0x42; |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
181 * } |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
182 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
183 * </li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
184 * </pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
185 * <li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
186 * The <code>new</code> keyword can be used to initialize a cached parameter using a constructor of |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
187 * the parameter type. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
188 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
189 * <pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
190 * @Specialization |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
191 * void s(Object operand, @Cached("new()") OtherNode someNode) { |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
192 * someNode.execute(operand); |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
193 * } |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
194 * |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
195 * static class OtherNode extends Node { |
19300
67ab244ab689
Truffle-DSL: fix formatting issues.
Christian Humer <christian.humer@gmail.com>
parents:
19288
diff
changeset
|
196 * |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
197 * public String execute(Object value) { |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
198 * throw new UnsupportedOperationException(); |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
199 * } |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
200 * } |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
201 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
202 * </pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
203 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
204 * </li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
205 * <li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
206 * Java types without public constructor but with a static factory methods can be initialized by |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
207 * just referencing its static factory method and its parameters. In this case |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
208 * {@link BranchProfile#create()} is used to instantiate the {@link BranchProfile} instance. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
209 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
210 * <pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
211 * @Specialization |
19787
b249bdba508b
Truffle-DSL: @Cached javadoc fixes.
Christian Humer <christian.humer@gmail.com>
parents:
19300
diff
changeset
|
212 * void s(int operand, @Cached("create()") BranchProfile profile) { |
19288
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
213 * } |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
214 * </pre> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
215 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
216 * </li> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
217 * </ol> |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
218 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
219 * @see Specialization#guards() |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
220 * @see Specialization#contains() |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
221 * @see Specialization#limit() |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
222 * @see ImportStatic |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
223 */ |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
224 @Retention(RetentionPolicy.RUNTIME) |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
225 @Target({ElementType.PARAMETER}) |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
226 public @interface Cached { |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
227 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
228 /** |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
229 * Defines the initializer expression of the cached parameter value. |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
230 * |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
231 * @see Cached |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
232 */ |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
233 String value(); |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
234 |
3a37116ef37f
Truffle-DSL: added @Cached annotation, added limit property and updated @Specialization javadoc.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
235 } |