Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/FloatValueProfile.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>float</code> runtime values. | 32 * Specialized value profile to capture certain properties of <code>float</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 |
72 * {@link Float#floatToRawIntBits(float)}. | 71 * {@link Float#floatToRawIntBits(float)}. |
73 * | 72 * |
74 * @see IntValueProfile | 73 * @see IntValueProfile |
75 */ | 74 */ |
76 public static FloatValueProfile createRawIdentityProfile() { | 75 public static FloatValueProfile createRawIdentityProfile() { |
77 if (Truffle.getRuntime().isProfilingEnabled()) { | 76 if (Profile.isProfilingEnabled()) { |
78 return Enabled.create(); | 77 return Enabled.create(); |
79 } else { | 78 } else { |
80 return Disabled.INSTANCE; | 79 return Disabled.INSTANCE; |
81 } | 80 } |
82 } | 81 } |