comparison truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java @ 22421:71c7a1ae8829

In ExactClassValueProfile: Perform direct class check, make profile thread-safe, avoid cast in the interpreter, add documentation.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 28 Nov 2015 00:42:25 +0100
parents dc83cc1f94f2
children a63bda98cfdb
comparison
equal deleted inserted replaced
22420:5e2dd9c3fa7d 22421:71c7a1ae8829
55 public static PrimitiveValueProfile createPrimitiveProfile() { 55 public static PrimitiveValueProfile createPrimitiveProfile() {
56 return new PrimitiveValueProfile(); 56 return new PrimitiveValueProfile();
57 } 57 }
58 58
59 /** 59 /**
60 * Returns a {@link ValueProfile} that speculates on the exact class of a value. 60 * Returns a {@link ValueProfile} that speculates on the exact class of a value. It will check
61 * the class of the profiled value and provide additional information to the compiler if only
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.
61 */ 67 */
62 public static ValueProfile createClassProfile() { 68 public static ValueProfile createClassProfile() {
63 return new ExactClassValueProfile(); 69 return new ExactClassValueProfile();
64 } 70 }
65 71