/** * Returns a {@link PrimitiveValueProfile} that speculates on the primitive equality or object * identity of a value. */ public static PrimitiveValueProfile createPrimitiveProfile() { return new PrimitiveValueProfile(); }
public double profile(double value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Double && exactCompare((double) snapshot, value)) { return (double) snapshot; } else { cacheMiss(value); } } return value; }
public byte profile(byte value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Byte && (byte) snapshot == value) { return (byte) snapshot; } else { cacheMiss(value); } } return value; }
@Override public String toString() { return String.format("%s(%s)@%x", getClass().getSimpleName(), formatValue(), hashCode()); }
public short profile(short value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Short && (short) snapshot == value) { return (short) snapshot; } else { cacheMiss(value); } } return value; }
public float profile(float value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Float && exactCompare((float) snapshot, value)) { return (float) snapshot; } else { cacheMiss(value); } } return value; }
public long profile(long value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Long && (long) snapshot == value) { return (long) snapshot; } else { cacheMiss(value); } } return value; }
if (value instanceof Float && exactCompare((float) snapshot, (float) value)) { return snapshot; if (value instanceof Double && exactCompare((double) snapshot, (double) value)) { return snapshot; return snapshot; cacheMiss(value);
public boolean profile(boolean value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Boolean && (boolean) snapshot == value) { return (boolean) snapshot; } else { cacheMiss(value); } } return value; }
public char profile(char value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Character && (char) snapshot == value) { return (char) snapshot; } else { cacheMiss(value); } } return value; }
public int profile(int value) { Object snapshot = this.cachedValue; if (snapshot != GENERIC) { if (snapshot instanceof Integer && (int) snapshot == value) { return (int) snapshot; } else { cacheMiss(value); } } return value; }