comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java @ 1941:79d04223b8a5

Added caching for resolved types and resolved fields. This is crucial, because the local load elimination will lead to wrong results, if field equality (of two RiField objects with the same object and the same RiType) is not given. The caching makes sure that the default equals implementation is sufficient.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Tue, 28 Dec 2010 18:33:26 +0100
parents b7fb5f1e0747
children 00bc9eaf0e24
comparison
equal deleted inserted replaced
1940:e92a9a73324e 1941:79d04223b8a5
180 return new HotSpotSignature(signature); 180 return new HotSpotSignature(signature);
181 } 181 }
182 182
183 @Override 183 @Override
184 public RiField createRiField(RiType holder, String name, RiType type, int offset) { 184 public RiField createRiField(RiType holder, String name, RiType type, int offset) {
185 if (offset != -1) {
186 HotSpotTypeResolved resolved = (HotSpotTypeResolved) holder;
187 return resolved.createRiField(name, type, offset);
188 }
185 return new HotSpotField(holder, name, type, offset); 189 return new HotSpotField(holder, name, type, offset);
186 } 190 }
187 191
188 @Override 192 @Override
189 public RiType createRiType(long vmId, String name) { 193 public RiType createRiType(long vmId, String name) {
190 throw new RuntimeException("not implemented"); 194 throw new RuntimeException("not implemented");
191 } 195 }
192 196
193 @Override 197 @Override
194 public RiType createRiTypePrimitive(int basicType) { 198 public RiType createRiTypePrimitive(int basicType) {
195 CiKind kind = null;
196 switch (basicType) { 199 switch (basicType) {
197 case 4: 200 case 4:
198 kind = CiKind.Boolean; 201 return HotSpotTypePrimitive.Boolean;
199 break;
200 case 5: 202 case 5:
201 kind = CiKind.Char; 203 return HotSpotTypePrimitive.Char;
202 break;
203 case 6: 204 case 6:
204 kind = CiKind.Float; 205 return HotSpotTypePrimitive.Float;
205 break;
206 case 7: 206 case 7:
207 kind = CiKind.Double; 207 return HotSpotTypePrimitive.Double;
208 break;
209 case 8: 208 case 8:
210 kind = CiKind.Byte; 209 return HotSpotTypePrimitive.Byte;
211 break;
212 case 9: 210 case 9:
213 kind = CiKind.Short; 211 return HotSpotTypePrimitive.Short;
214 break;
215 case 10: 212 case 10:
216 kind = CiKind.Int; 213 return HotSpotTypePrimitive.Int;
217 break;
218 case 11: 214 case 11:
219 kind = CiKind.Long; 215 return HotSpotTypePrimitive.Long;
220 break;
221 case 14: 216 case 14:
222 kind = CiKind.Void; 217 return HotSpotTypePrimitive.Void;
223 break;
224 default: 218 default:
225 throw new IllegalArgumentException("Unknown basic type: " + basicType); 219 throw new IllegalArgumentException("Unknown basic type: " + basicType);
226 } 220 }
227 return new HotSpotTypePrimitive(kind); 221 }
228 } 222
229 223 @Override
230 @Override 224 public RiType createRiTypeUnresolved(String name) {
231 public RiType createRiTypeUnresolved(String name, long accessingClassVmId) { 225 return new HotSpotTypeUnresolved(name);
232 return new HotSpotTypeUnresolved(name, accessingClassVmId);
233 } 226 }
234 227
235 @Override 228 @Override
236 public RiConstantPool createRiConstantPool(long vmId) { 229 public RiConstantPool createRiConstantPool(long vmId) {
237 return new HotSpotConstantPool(vmId); 230 return new HotSpotConstantPool(vmId);