Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java Thu Nov 26 14:22:48 2015 +0100 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java Sat Nov 28 00:42:25 2015 +0100 @@ -57,7 +57,13 @@ } /** - * Returns a {@link ValueProfile} that speculates on the exact class of a value. + * Returns a {@link ValueProfile} that speculates on the exact class of a value. It will check + * the class of the profiled value and provide additional information to the compiler if only + * non-null values of exactly one concrete Java class are passed as a parameter to the + * {@link ValueProfile#profile} method. This can be beneficial if subsequent code can take + * advantage of knowing the concrete class of the value. The profile will degrade to the generic + * case if a null value or if at least two instances of two different Java classes are + * registered. */ public static ValueProfile createClassProfile() { return new ExactClassValueProfile();