# HG changeset patch # User Lukas Stadler # Date 1427716864 -7200 # Node ID 405257253e59f55952b710fd81e1a6147d85bf17 # Parent a7ee2e1f0d4ece014306fb5189df56a1e03e9ef1 ExactClassValueProfile: do not create isInstance check for generic (object) profiles diff -r a7ee2e1f0d4e -r 405257253e59 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ExactClassValueProfile.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ExactClassValueProfile.java Mon Mar 30 13:59:59 2015 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ExactClassValueProfile.java Mon Mar 30 14:01:04 2015 +0200 @@ -40,14 +40,16 @@ @SuppressWarnings("unchecked") @Override public T profile(T value) { - if (cachedClass != null && cachedClass.isInstance(value)) { - return (T) cachedClass.cast(value); - } else { - CompilerDirectives.transferToInterpreterAndInvalidate(); - if (cachedClass == null && value != null) { - cachedClass = value.getClass(); + if (cachedClass != Object.class) { + if (cachedClass != null && cachedClass.isInstance(value)) { + return (T) cachedClass.cast(value); } else { - cachedClass = Object.class; + CompilerDirectives.transferToInterpreterAndInvalidate(); + if (cachedClass == null && value != null) { + cachedClass = value.getClass(); + } else { + cachedClass = Object.class; + } } } return value;