Mercurial > hg > graal-compiler
changeset 13495:818d2885db2f
Bugfix: Canonicalize field flags before looking up cached fields, to avoid creating the same field twice with different flags
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Fri, 03 Jan 2014 11:48:36 -0800 |
parents | ab4c3a33a8b1 |
children | a245e3585ad4 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Fri Jan 03 11:46:35 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Fri Jan 03 11:48:36 2014 -0800 @@ -418,9 +418,15 @@ return method; } - public synchronized ResolvedJavaField createField(String fieldName, JavaType type, long offset, int flags, boolean internal) { + public synchronized ResolvedJavaField createField(String fieldName, JavaType type, long offset, int rawFlags, boolean internal) { ResolvedJavaField result = null; + /* + * Filter out flags used internally by HotSpot, to get a canonical id value. When a field is + * created from a java.lang.reflect.Field, these flags would not be available anyway. + */ + int flags = rawFlags & fieldModifiers(); + long id = offset + ((long) flags << 32); // (thomaswue) Must cache the fields, because the local load elimination only works if the @@ -436,7 +442,7 @@ fieldCache.put(id, result); } else { assert result.getName().equals(fieldName); - assert result.getModifiers() == (fieldModifiers() & flags); + assert result.getModifiers() == flags; } return result;