Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/LongValueProfile.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>long</code> runtime values. | 32 * Specialized value profile to capture certain properties of <code>long</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 |
70 * Returns a value profile that profiles the exact value of an <code>long</code>. | 69 * Returns a value profile that profiles the exact value of an <code>long</code>. |
71 * | 70 * |
72 * @see LongValueProfile | 71 * @see LongValueProfile |
73 */ | 72 */ |
74 public static LongValueProfile createIdentityProfile() { | 73 public static LongValueProfile createIdentityProfile() { |
75 if (Truffle.getRuntime().isProfilingEnabled()) { | 74 if (Profile.isProfilingEnabled()) { |
76 return Enabled.create(); | 75 return Enabled.create(); |
77 } else { | 76 } else { |
78 return Disabled.INSTANCE; | 77 return Disabled.INSTANCE; |
79 } | 78 } |
80 } | 79 } |