Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ConditionProfile.java @ 18845:f57d86eb036f
removed Node factory methods
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Jan 2015 20:39:04 +0100 |
parents | 62aac33db669 |
children | 1cde96b96673 |
comparison
equal
deleted
inserted
replaced
18843:f2261069ba99 | 18845:f57d86eb036f |
---|---|
28 import com.oracle.truffle.api.nodes.*; | 28 import com.oracle.truffle.api.nodes.*; |
29 | 29 |
30 /** | 30 /** |
31 * Abstract utility class to speculate on conditions. Condition profiles are intended to be used as | 31 * Abstract utility class to speculate on conditions. Condition profiles are intended to be used as |
32 * part of if conditions. | 32 * part of if conditions. |
33 * | 33 * |
34 * Example usage: | 34 * Example usage: |
35 * | 35 * |
36 * <pre> | 36 * <pre> |
37 * private final ConditionProfile zero = ConditionProfile.createBinaryProfile(); | 37 * private final ConditionProfile zero = ConditionProfile.createBinaryProfile(); |
38 * | 38 * |
39 * int value = ...; | 39 * int value = ...; |
40 * if (zero.profile(value == 0)) { | 40 * if (zero.profile(value == 0)) { |
41 * return 0; | 41 * return 0; |
42 * } else { | 42 * } else { |
43 * return value; | 43 * return value; |
44 * } | 44 * } |
45 * | 45 * |
46 * </pre> | 46 * </pre> |
47 * | 47 * |
48 * All instances of {@code ConditionProfile} (and subclasses) must be held in {@code final} fields | 48 * All instances of {@code ConditionProfile} (and subclasses) must be held in {@code final} fields |
49 * for compiler optimizations to take effect. | 49 * for compiler optimizations to take effect. |
50 * | 50 * |
51 * @see #createCountingProfile() | 51 * @see #createCountingProfile() |
52 * @see #createBinaryProfile() | 52 * @see #createBinaryProfile() |
53 */ | 53 */ |
54 public abstract class ConditionProfile extends NodeCloneable { | 54 public abstract class ConditionProfile extends NodeCloneable { |
55 | 55 |
60 * <code>true</code> or to be never <code>false</code>. Additionally to a binary profile this | 60 * <code>true</code> or to be never <code>false</code>. Additionally to a binary profile this |
61 * method returns a condition profile that also counts the number of times the condition was | 61 * method returns a condition profile that also counts the number of times the condition was |
62 * true and false. This information is reported to the underlying optimization system using | 62 * true and false. This information is reported to the underlying optimization system using |
63 * {@link CompilerDirectives#injectBranchProbability(double, boolean)}. Condition profiles are | 63 * {@link CompilerDirectives#injectBranchProbability(double, boolean)}. Condition profiles are |
64 * intended to be used as part of if conditions. | 64 * intended to be used as part of if conditions. |
65 * | 65 * |
66 * @see ConditionProfile | 66 * @see ConditionProfile |
67 * @see #createBinaryProfile() | 67 * @see #createBinaryProfile() |
68 */ | 68 */ |
69 public static ConditionProfile createCountingProfile() { | 69 public static ConditionProfile createCountingProfile() { |
70 return new CountingConditionProfile(); | 70 return new CountingConditionProfile(); |
71 } | 71 } |
72 | 72 |
73 /** | 73 /** |
74 * Returns a {@link ConditionProfile} that speculates on conditions to be never true or to be | 74 * Returns a {@link ConditionProfile} that speculates on conditions to be never true or to be |
75 * never false. Condition profiles are intended to be used as part of if conditions. | 75 * never false. Condition profiles are intended to be used as part of if conditions. |
76 * | 76 * |
77 * @see ConditionProfile | 77 * @see ConditionProfile |
78 * @see ConditionProfile#createCountingProfile() | 78 * @see ConditionProfile#createCountingProfile() |
79 */ | 79 */ |
80 public static ConditionProfile createBinaryProfile() { | 80 public static ConditionProfile createBinaryProfile() { |
81 return new BinaryConditionProfile(); | 81 return new BinaryConditionProfile(); |