Mercurial > hg > graal-compiler
diff graal/Runtime/src/com/sun/hotspot/c1x/HotSpotTypeResolvedImpl.java @ 2492:4e5515d09314
Fixed merge issues.
- Accessing static fields from the java.lang.Class object instead of the klassOop (1-line-change)
- Fixed issue with RiField object caching (the caching was only taking the offset as a field ID, but need to take offset+is_static)
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 22 Apr 2011 19:00:07 +0200 |
parents | 099e697d8934 |
children | c737ee310b39 |
line wrap: on
line diff
--- a/graal/Runtime/src/com/sun/hotspot/c1x/HotSpotTypeResolvedImpl.java Fri Apr 22 15:30:53 2011 +0200 +++ b/graal/Runtime/src/com/sun/hotspot/c1x/HotSpotTypeResolvedImpl.java Fri Apr 22 19:00:07 2011 +0200 @@ -45,7 +45,7 @@ private boolean isInterface; private int instanceSize; private RiType componentType; - private HashMap<Integer, RiField> fieldCache; + private HashMap<Long, RiField> fieldCache; private RiConstantPool pool; private HotSpotTypeResolvedImpl() { @@ -93,7 +93,7 @@ case ObjectHub: return CiConstant.forObject(this); case StaticFields: - return CiConstant.forObject(this); + return CiConstant.forObject(javaClass()); case TypeInfo: return CiConstant.forObject(this); default: @@ -193,19 +193,25 @@ } @Override - public RiField createRiField(String name, RiType type, int offset) { + public RiField createRiField(String name, RiType type, int offset, int flags) { RiField result = null; + long id = offset + ((long) flags << 32); + // (tw) Must cache the fields, because the local load elimination only works if the objects from two field lookups are equal. if (fieldCache == null) { - fieldCache = new HashMap<Integer, RiField>(8); + fieldCache = new HashMap<Long, RiField>(8); } else { - result = fieldCache.get(offset); + result = fieldCache.get(id); } if (result == null) { - result = new HotSpotField(compiler, this, name, type, offset); - fieldCache.put(offset, result); + result = new HotSpotField(compiler, this, name, type, offset, flags); + fieldCache.put(id, result); + } else { + assert result.type().equals(type); + assert result.name().equals(name); + assert result.accessFlags() == flags; } return result;