Mercurial > hg > truffle
diff truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ConditionProfile.java @ 22501:a63bda98cfdb
Extract profiles into separate package. Add isProfilingEnabled in TruffleRuntime to disable profiling in the default runtime; Add low overhead profiles for primitives; Add LoopConditionProfile; Profile footprint/threadsafety improvements; Make toString implementations more consistent; Greatly enhanced javadoc documentation for profiles; Deprecate old profiles
author | Christian Humer <christian.humer@oracle.com> |
---|---|
date | Wed, 16 Dec 2015 16:38:13 +0100 |
parents | dc83cc1f94f2 |
children |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ConditionProfile.java Wed Dec 16 12:31:17 2015 +0100 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ConditionProfile.java Wed Dec 16 16:38:13 2015 +0100 @@ -24,33 +24,12 @@ */ package com.oracle.truffle.api.utilities; -import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.nodes.NodeCloneable; /** - * Abstract utility class to speculate on conditions. Condition profiles are intended to be used as - * part of if conditions. - * - * Example usage: - * - * <pre> - * private final ConditionProfile zero = ConditionProfile.createBinaryProfile(); - * - * int value = ...; - * if (zero.profile(value == 0)) { - * return 0; - * } else { - * return value; - * } - * - * </pre> - * - * All instances of {@code ConditionProfile} (and subclasses) must be held in {@code final} fields - * for compiler optimizations to take effect. - * - * @see #createCountingProfile() - * @see #createBinaryProfile() + * @deprecated use {@link com.oracle.truffle.api.profiles.ConditionProfile} instead */ +@Deprecated public abstract class ConditionProfile extends NodeCloneable { ConditionProfile() { } @@ -58,27 +37,23 @@ public abstract boolean profile(boolean value); /** - * Returns a {@link ConditionProfile} that speculates on conditions to be never - * <code>true</code> or to be never <code>false</code>. Additionally to a binary profile this - * method returns a condition profile that also counts the number of times the condition was - * true and false. This information is reported to the underlying optimization system using - * {@link CompilerDirectives#injectBranchProbability(double, boolean)}. Condition profiles are - * intended to be used as part of if conditions. - * - * @see ConditionProfile - * @see #createBinaryProfile() + * @deprecated use + * {@link com.oracle.truffle.api.profiles.ConditionProfile#createCountingProfile()} + * instead */ + @SuppressWarnings("deprecation") + @Deprecated public static ConditionProfile createCountingProfile() { return new CountingConditionProfile(); } /** - * Returns a {@link ConditionProfile} that speculates on conditions to be never true or to be - * never false. Condition profiles are intended to be used as part of if conditions. - * - * @see ConditionProfile - * @see ConditionProfile#createCountingProfile() + * @deprecated use + * {@link com.oracle.truffle.api.profiles.ConditionProfile#createBinaryProfile()} + * instead */ + @Deprecated + @SuppressWarnings("deprecation") public static ConditionProfile createBinaryProfile() { return new BinaryConditionProfile(); }