Mercurial > hg > graal-compiler
changeset 20075:405257253e59
ExactClassValueProfile: do not create isInstance check for generic (object) profiles
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Mon, 30 Mar 2015 14:01:04 +0200 |
parents | a7ee2e1f0d4e |
children | 126ab00f859c |
files | graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ExactClassValueProfile.java |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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> 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;