@SuppressWarnings("unchecked") @Override public <T> T profile(T value) { // Field needs to be cached in local variable for thread safety and startup speed. Class<?> clazz = cachedClass; if (clazz != Object.class) { if (clazz != null && value != null && value.getClass() == clazz) { return (T) CompilerDirectives.castExact(value, clazz); } else { CompilerDirectives.transferToInterpreterAndInvalidate(); if (clazz == null && value != null) { cachedClass = value.getClass(); } else { cachedClass = Object.class; } } } return value; }
@SuppressWarnings("unchecked") @Override public <T> T profile(T value) { // Field needs to be cached in local variable for thread safety and startup speed. Class<?> clazz = cachedClass; if (clazz != Object.class) { if (clazz != null && value != null && value.getClass() == clazz) { return (T) CompilerDirectives.castExact(value, clazz); } else { CompilerDirectives.transferToInterpreterAndInvalidate(); if (clazz == null && value != null) { cachedClass = value.getClass(); } else { cachedClass = Object.class; } } } return value; }
return apiAccess.newValue(receiver, cache); } else if (value.getClass() == cachedClassLocal && cachedContextLocal == languageContext) { receiver = CompilerDirectives.inInterpreter() ? receiver : CompilerDirectives.castExact(receiver, cachedClassLocal); cache = cachedValue; if (cache == null) {