private String formatSpecialization() { if (!isUninitialized() && !isGeneric()) { Object snapshot = this.cachedValue; if (snapshot == null) { return String.format("value == null"); } else { if (snapshot instanceof Byte || snapshot instanceof Short || snapshot instanceof Integer || snapshot instanceof Long || snapshot instanceof Float || snapshot instanceof Double || snapshot instanceof Boolean || snapshot instanceof Character) { return String.format("value == (%s)%s", snapshot.getClass().getSimpleName(), snapshot); } else { String simpleName = snapshot.getClass().getSimpleName(); return String.format("value == %s@%x", simpleName, Objects.hash(snapshot)); } } } return null; }
if (value instanceof Float && exactCompare((float) snapshot, (float) value)) { return (T) snapshot; if (value instanceof Double && exactCompare((double) snapshot, (double) value)) { return (T) snapshot; slowPath(value);
if (value instanceof Float && exactCompare((float) snapshot, (float) value)) { return (T) snapshot; if (value instanceof Double && exactCompare((double) snapshot, (double) value)) { return (T) snapshot; slowPath(value);
private String formatSpecialization() { if (!isUninitialized() && !isGeneric()) { Object snapshot = this.cachedValue; if (snapshot == null) { return String.format("value == null"); } else { if (snapshot instanceof Byte || snapshot instanceof Short || snapshot instanceof Integer || snapshot instanceof Long || snapshot instanceof Float || snapshot instanceof Double || snapshot instanceof Boolean || snapshot instanceof Character) { return String.format("value == (%s)%s", snapshot.getClass().getSimpleName(), snapshot); } else { String simpleName = snapshot.getClass().getSimpleName(); return String.format("value == %s@%x", simpleName, Objects.hash(snapshot)); } } } return null; }
/** @since 0.8 or earlier */ @Override public char profile(char value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Character && (char) snapshot == value) { return (char) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public long profile(long value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Long && (long) snapshot == value) { return (long) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public byte profile(byte value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Byte && (byte) snapshot == value) { return (byte) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public char profile(char value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Character && (char) snapshot == value) { return (char) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public byte profile(byte value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Byte && (byte) snapshot == value) { return (byte) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public float profile(float value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Float && exactCompare((float) snapshot, value)) { return (float) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public boolean profile(boolean value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Boolean && (boolean) snapshot == value) { return (boolean) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public short profile(short value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Short && (short) snapshot == value) { return (short) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public boolean profile(boolean value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Boolean && (boolean) snapshot == value) { return (boolean) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** * Returns a {@link PrimitiveValueProfile} that speculates on the primitive equality or object * identity of a value. * * @since 0.10 */ public static PrimitiveValueProfile createEqualityProfile() { if (Profile.isProfilingEnabled()) { return Enabled.create(); } else { return Disabled.INSTANCE; } }
/** @since 0.8 or earlier */ @Override public int profile(int value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Integer && (int) snapshot == value) { return (int) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public double profile(double value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Double && exactCompare((double) snapshot, value)) { return (double) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public long profile(long value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Long && (long) snapshot == value) { return (long) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public short profile(short value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Short && (short) snapshot == value) { return (short) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** @since 0.8 or earlier */ @Override public double profile(double value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Double && exactCompare((double) snapshot, value)) { return (double) snapshot; } else { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPath(value); } } return value; }
/** * Returns a {@link PrimitiveValueProfile} that speculates on the primitive equality or object * identity of a value. * * @since 0.10 */ public static PrimitiveValueProfile createEqualityProfile() { if (Profile.isProfilingEnabled()) { return Enabled.create(); } else { return Disabled.INSTANCE; } }