Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Assumption.java @ 16868:db090a8d3705
clarify documentation about assumption and profile storage in final fields
author | Michael Haupt <michael.haupt@oracle.com> |
---|---|
date | Wed, 20 Aug 2014 15:16:11 +0200 |
parents | 494b818b527c |
children |
comparison
equal
deleted
inserted
replaced
16867:7af9301efe6b | 16868:db090a8d3705 |
---|---|
32 * invalidated, an assumption can never get valid again. Assumptions can be created using the | 32 * invalidated, an assumption can never get valid again. Assumptions can be created using the |
33 * {@link TruffleRuntime#createAssumption()} or the {@link TruffleRuntime#createAssumption(String)} | 33 * {@link TruffleRuntime#createAssumption()} or the {@link TruffleRuntime#createAssumption(String)} |
34 * method. The Truffle compiler has special knowledge of this class in order to produce efficient | 34 * method. The Truffle compiler has special knowledge of this class in order to produce efficient |
35 * machine code for checking an assumption in case the assumption object is a compile time constant. | 35 * machine code for checking an assumption in case the assumption object is a compile time constant. |
36 * Therefore, assumptions should be stored in final fields in Truffle nodes. | 36 * Therefore, assumptions should be stored in final fields in Truffle nodes. |
37 * | |
38 * All instances of classes implementing {@code Assumption} must be held in {@code final} fields for | |
39 * compiler optimizations to take effect. | |
37 */ | 40 */ |
38 public interface Assumption { | 41 public interface Assumption { |
39 | 42 |
40 /** | 43 /** |
41 * Checks that this assumption is still valid. The method throws an exception, if this is no | 44 * Checks that this assumption is still valid. The method throws an exception, if this is no |
42 * longer the case. This method is preferred over the {@link #isValid()} method when writing | 45 * longer the case. This method is preferred over the {@link #isValid()} method when writing |
43 * guest language interpreter code. The catch block should perform a node rewrite (see | 46 * guest language interpreter code. The catch block should perform a node rewrite (see |
44 * {@link Node#replace(Node)}) with a node that no longer relies on the assumption. | 47 * {@link Node#replace(Node)}) with a node that no longer relies on the assumption. |
45 * | 48 * |
46 * @throws InvalidAssumptionException If the assumption is no longer valid. | 49 * @throws InvalidAssumptionException If the assumption is no longer valid. |
47 */ | 50 */ |
48 void check() throws InvalidAssumptionException; | 51 void check() throws InvalidAssumptionException; |
49 | 52 |
50 /** | 53 /** |
51 * Checks whether the assumption is still valid. | 54 * Checks whether the assumption is still valid. |
52 * | 55 * |
53 * @return a boolean value indicating the validity of the assumption | 56 * @return a boolean value indicating the validity of the assumption |
54 */ | 57 */ |
55 boolean isValid(); | 58 boolean isValid(); |
56 | 59 |
57 /** | 60 /** |
59 */ | 62 */ |
60 void invalidate(); | 63 void invalidate(); |
61 | 64 |
62 /** | 65 /** |
63 * A name for the assumption that is used for debug output. | 66 * A name for the assumption that is used for debug output. |
64 * | 67 * |
65 * @return the name of the assumption | 68 * @return the name of the assumption |
66 */ | 69 */ |
67 String getName(); | 70 String getName(); |
68 } | 71 } |