comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotSignature.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 9e5e83ca2259
children 3c0a889a176b
comparison
equal deleted inserted replaced
1940:e92a9a73324e 1941:79d04223b8a5
114 if (argumentTypes == null) { 114 if (argumentTypes == null) {
115 argumentTypes = new RiType[arguments.size()]; 115 argumentTypes = new RiType[arguments.size()];
116 } 116 }
117 RiType type = argumentTypes[index]; 117 RiType type = argumentTypes[index];
118 if (type == null) { 118 if (type == null) {
119 long accessor = 0; 119 type = Compiler.getVMEntries().RiSignature_lookupType(arguments.get(index), (HotSpotTypeResolved) accessingClass);
120 if (accessingClass instanceof HotSpotTypeResolved) {
121 accessor = (Long) ((HotSpotTypeResolved) accessingClass).getVmId();
122 }
123 type = Compiler.getVMEntries().RiSignature_lookupType(arguments.get(index), accessor);
124 argumentTypes[index] = type; 120 argumentTypes[index] = type;
125 } 121 }
126 return type; 122 return type;
127 } 123 }
128 124
137 } 133 }
138 134
139 @Override 135 @Override
140 public RiType returnType(RiType accessingClass) { 136 public RiType returnType(RiType accessingClass) {
141 if (returnTypeCache == null) { 137 if (returnTypeCache == null) {
142 long accessor = 0; 138 returnTypeCache = Compiler.getVMEntries().RiSignature_lookupType(returnType, (HotSpotTypeResolved) accessingClass);
143 if (accessingClass instanceof HotSpotTypeResolved) {
144 accessor = (Long) ((HotSpotTypeResolved) accessingClass).getVmId();
145 }
146 returnTypeCache = Compiler.getVMEntries().RiSignature_lookupType(returnType, accessor);
147 } 139 }
148 return returnTypeCache; 140 return returnTypeCache;
149 } 141 }
150 142
151 @Override 143 @Override