Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java @ 22501:a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
author | Christian Humer <christian.humer@oracle.com> |
---|---|
date | Wed, 16 Dec 2015 16:38:13 +0100 |
parents | 71c7a1ae8829 |
children |
comparison
equal
deleted
inserted
replaced
22500:fbe1eb7b4172 | 22501:a63bda98cfdb |
---|---|
25 package com.oracle.truffle.api.utilities; | 25 package com.oracle.truffle.api.utilities; |
26 | 26 |
27 import com.oracle.truffle.api.nodes.NodeCloneable; | 27 import com.oracle.truffle.api.nodes.NodeCloneable; |
28 | 28 |
29 /** | 29 /** |
30 * Utility class to speculate on certain properties of values. | 30 * @deprecated use {@link com.oracle.truffle.api.profiles.ValueProfile} instead |
31 * | |
32 * Example usage: | |
33 * | |
34 * <pre> | |
35 * private final ValueProfile classProfile = ValueProfile.createClassProfile(); | |
36 * | |
37 * return classProfile.profile(value); | |
38 * </pre> | |
39 * | |
40 * All instances of {@code ValueProfile} (and subclasses) must be held in {@code final} fields for | |
41 * compiler optimizations to take effect. | |
42 * | |
43 * @see #createPrimitiveProfile() | |
44 * @see #createIdentityProfile() | |
45 * @see #createClassProfile() | |
46 */ | 31 */ |
32 @Deprecated | |
33 @SuppressWarnings("deprecation") | |
47 public abstract class ValueProfile extends NodeCloneable { | 34 public abstract class ValueProfile extends NodeCloneable { |
48 | 35 |
49 public abstract <T> T profile(T value); | 36 public abstract <T> T profile(T value); |
50 | 37 |
51 /** | 38 /** |
52 * Returns a {@link PrimitiveValueProfile} that speculates on the primitive equality or object | 39 * @deprecated use |
53 * identity of a value. | 40 * {@link com.oracle.truffle.api.profiles.PrimitiveValueProfile#createEqualityProfile()} |
41 * instead | |
54 */ | 42 */ |
43 @Deprecated | |
55 public static PrimitiveValueProfile createPrimitiveProfile() { | 44 public static PrimitiveValueProfile createPrimitiveProfile() { |
56 return new PrimitiveValueProfile(); | 45 return new PrimitiveValueProfile(); |
57 } | 46 } |
58 | 47 |
59 /** | 48 /** |
60 * Returns a {@link ValueProfile} that speculates on the exact class of a value. It will check | 49 * @deprecated use {@link com.oracle.truffle.api.profiles.ValueProfile#createClassProfile()} |
61 * the class of the profiled value and provide additional information to the compiler if only | 50 * instead |
62 * non-null values of exactly one concrete Java class are passed as a parameter to the | |
63 * {@link ValueProfile#profile} method. This can be beneficial if subsequent code can take | |
64 * advantage of knowing the concrete class of the value. The profile will degrade to the generic | |
65 * case if a null value or if at least two instances of two different Java classes are | |
66 * registered. | |
67 */ | 51 */ |
52 @Deprecated | |
68 public static ValueProfile createClassProfile() { | 53 public static ValueProfile createClassProfile() { |
69 return new ExactClassValueProfile(); | 54 return new ExactClassValueProfile(); |
70 } | 55 } |
71 | 56 |
72 /** | 57 /** |
73 * Returns a {@link ValueProfile} that speculates on the object identity of a value. | 58 * @deprecated use {@link com.oracle.truffle.api.profiles.ValueProfile#createIdentityProfile()} |
59 * instead | |
74 */ | 60 */ |
61 @Deprecated | |
75 public static ValueProfile createIdentityProfile() { | 62 public static ValueProfile createIdentityProfile() { |
76 return new IdentityValueProfile(); | 63 return new IdentityValueProfile(); |
77 } | 64 } |
78 | 65 |
79 } | 66 } |