comparison truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/IntValueProfile.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
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>int</code> runtime values. Value 32 * Specialized value profile to capture certain properties of <code>int</code> runtime values. Value
34 * profiles require a runtime check in their initialized state to verify their profiled assumption. 33 * profiles require a runtime check in their initialized state to verify their profiled assumption.
71 * Returns a value profile that profiles the exact value of an <code>int</code>. 70 * Returns a value profile that profiles the exact value of an <code>int</code>.
72 * 71 *
73 * @see IntValueProfile 72 * @see IntValueProfile
74 */ 73 */
75 public static IntValueProfile createIdentityProfile() { 74 public static IntValueProfile 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 }