comparison 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
comparison
equal deleted inserted replaced
2491:0654ee04b214 2492:4e5515d09314
43 private boolean isArrayClass; 43 private boolean isArrayClass;
44 private boolean isInstanceClass; 44 private boolean isInstanceClass;
45 private boolean isInterface; 45 private boolean isInterface;
46 private int instanceSize; 46 private int instanceSize;
47 private RiType componentType; 47 private RiType componentType;
48 private HashMap<Integer, RiField> fieldCache; 48 private HashMap<Long, RiField> fieldCache;
49 private RiConstantPool pool; 49 private RiConstantPool pool;
50 50
51 private HotSpotTypeResolvedImpl() { 51 private HotSpotTypeResolvedImpl() {
52 super(null); 52 super(null);
53 } 53 }
91 case JavaClass: 91 case JavaClass:
92 return CiConstant.forObject(javaClass()); 92 return CiConstant.forObject(javaClass());
93 case ObjectHub: 93 case ObjectHub:
94 return CiConstant.forObject(this); 94 return CiConstant.forObject(this);
95 case StaticFields: 95 case StaticFields:
96 return CiConstant.forObject(this); 96 return CiConstant.forObject(javaClass());
97 case TypeInfo: 97 case TypeInfo:
98 return CiConstant.forObject(this); 98 return CiConstant.forObject(this);
99 default: 99 default:
100 return null; 100 return null;
101 } 101 }
191 public int instanceSize() { 191 public int instanceSize() {
192 return instanceSize; 192 return instanceSize;
193 } 193 }
194 194
195 @Override 195 @Override
196 public RiField createRiField(String name, RiType type, int offset) { 196 public RiField createRiField(String name, RiType type, int offset, int flags) {
197 RiField result = null; 197 RiField result = null;
198
199 long id = offset + ((long) flags << 32);
198 200
199 // (tw) Must cache the fields, because the local load elimination only works if the objects from two field lookups are equal. 201 // (tw) Must cache the fields, because the local load elimination only works if the objects from two field lookups are equal.
200 if (fieldCache == null) { 202 if (fieldCache == null) {
201 fieldCache = new HashMap<Integer, RiField>(8); 203 fieldCache = new HashMap<Long, RiField>(8);
202 } else { 204 } else {
203 result = fieldCache.get(offset); 205 result = fieldCache.get(id);
204 } 206 }
205 207
206 if (result == null) { 208 if (result == null) {
207 result = new HotSpotField(compiler, this, name, type, offset); 209 result = new HotSpotField(compiler, this, name, type, offset, flags);
208 fieldCache.put(offset, result); 210 fieldCache.put(id, result);
211 } else {
212 assert result.type().equals(type);
213 assert result.name().equals(name);
214 assert result.accessFlags() == flags;
209 } 215 }
210 216
211 return result; 217 return result;
212 } 218 }
213 219