comparison truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/ByteValueProfile.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 114a6a77b440
comparison
equal deleted inserted replaced
22503:828c67903db2 22504:d80a5ff56f51
24 */ 24 */
25 package com.oracle.truffle.api.profiles; 25 package com.oracle.truffle.api.profiles;
26 26
27 import com.oracle.truffle.api.CompilerDirectives; 27 import com.oracle.truffle.api.CompilerDirectives;
28 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; 28 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
29 import com.oracle.truffle.api.Truffle;
30 29
31 /** 30 /**
32 * <p> 31 * <p>
33 * Specialized value profile to capture certain properties of <code>byte</code> runtime values. 32 * Specialized value profile to capture certain properties of <code>byte</code> runtime values.
34 * Value profiles require a runtime check in their initialized state to verify their profiled 33 * Value profiles require a runtime check in their initialized state to verify their profiled
71 * Returns a value profile that profiles the exact value of a <code>byte</code>. 70 * Returns a value profile that profiles the exact value of a <code>byte</code>.
72 * 71 *
73 * @see ByteValueProfile 72 * @see ByteValueProfile
74 */ 73 */
75 public static ByteValueProfile createIdentityProfile() { 74 public static ByteValueProfile createIdentityProfile() {
76 if (Truffle.getRuntime().isProfilingEnabled()) { 75 if (Profile.isProfilingEnabled()) {
77 return Enabled.create(); 76 return Enabled.create();
78 } else { 77 } else {
79 return Disabled.INSTANCE; 78 return Disabled.INSTANCE;
80 } 79 }
81 } 80 }