comparison truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/PrimitiveValueProfile.java @ 22504:d80a5ff56f51

Storing the profiling enabled information in a static field; checking it only once; shielding against missing method in the TruffleRuntime interface
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 17 Dec 2015 13:45:37 +0100
parents 828c67903db2
children
comparison
equal deleted inserted replaced
22503:828c67903db2 22504:d80a5ff56f51
26 26
27 import java.util.Objects; 27 import java.util.Objects;
28 28
29 import com.oracle.truffle.api.CompilerDirectives; 29 import com.oracle.truffle.api.CompilerDirectives;
30 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; 30 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
31 import com.oracle.truffle.api.Truffle;
32 31
33 /** 32 /**
34 * <p> 33 * <p>
35 * Represents a {@link ValueProfile} that speculates on the primitive equality or object identity of 34 * Represents a {@link ValueProfile} that speculates on the primitive equality or object identity of
36 * values. Note that for {@code float} and {@code double} values we compare primitive equality via 35 * values. Note that for {@code float} and {@code double} values we compare primitive equality via
68 /** 67 /**
69 * Returns a {@link PrimitiveValueProfile} that speculates on the primitive equality or object 68 * Returns a {@link PrimitiveValueProfile} that speculates on the primitive equality or object
70 * identity of a value. 69 * identity of a value.
71 */ 70 */
72 public static PrimitiveValueProfile createEqualityProfile() { 71 public static PrimitiveValueProfile createEqualityProfile() {
73 if (Truffle.getRuntime().isProfilingEnabled()) { 72 if (Profile.isProfilingEnabled()) {
74 return Enabled.create(); 73 return Enabled.create();
75 } else { 74 } else {
76 return Disabled.INSTANCE; 75 return Disabled.INSTANCE;
77 } 76 }
78 } 77 }