comparison src/share/vm/graal/graalCodeInstaller.cpp @ 15018:db4254246f9a

Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
author Christian Wimmer <christian.wimmer@oracle.com>
date Mon, 07 Apr 2014 16:09:17 -0700
parents 8db730993642
children 5c71dcf0915d
comparison
equal deleted inserted replaced
15017:ff5660822992 15018:db4254246f9a
178 } 178 }
179 } 179 }
180 180
181 // Records any Metadata values embedded in a Constant (e.g., the value returned by HotSpotResolvedObjectType.klass()). 181 // Records any Metadata values embedded in a Constant (e.g., the value returned by HotSpotResolvedObjectType.klass()).
182 static void record_metadata_in_constant(oop constant, OopRecorder* oop_recorder) { 182 static void record_metadata_in_constant(oop constant, OopRecorder* oop_recorder) {
183 char kind = Kind::typeChar(Constant::kind(constant)); 183 if (constant->is_a(HotSpotMetaspaceConstant::klass())) {
184 char wordKind = 'j'; 184 oop obj = HotSpotMetaspaceConstant::metaspaceObject(constant);
185 if (kind == wordKind) { 185 jlong prim = HotSpotMetaspaceConstant::primitive(constant);
186 oop obj = Constant::object(constant); 186 assert(Kind::typeChar(Constant::kind(constant)) == 'j', "must have word kind");
187 jlong prim = Constant::primitive(constant); 187 assert(obj != NULL, "must have an object");
188 if (obj != NULL) { 188 assert(prim != 0, "must have a primitive value");
189 record_metadata_reference(obj, prim, false, oop_recorder); 189
190 } 190 record_metadata_reference(obj, prim, false, oop_recorder);
191 } 191 }
192 } 192 }
193 193
194 static void record_metadata_in_patch(oop data, OopRecorder* oop_recorder) { 194 static void record_metadata_in_patch(oop data, OopRecorder* oop_recorder) {
195 record_metadata_reference(MetaspaceData::annotation(data), MetaspaceData::value(data), MetaspaceData::compressed(data) != 0, oop_recorder); 195 record_metadata_reference(MetaspaceData::annotation(data), MetaspaceData::value(data), MetaspaceData::compressed(data) != 0, oop_recorder);
261 second = value; 261 second = value;
262 } 262 }
263 return value; 263 return value;
264 } else if (value->is_a(Constant::klass())){ 264 } else if (value->is_a(Constant::klass())){
265 record_metadata_in_constant(value, oop_recorder); 265 record_metadata_in_constant(value, oop_recorder);
266 jlong prim = Constant::primitive(value);
267 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) { 266 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) {
267 jlong prim = PrimitiveConstant::primitive(value);
268 return new ConstantIntValue(*(jint*)&prim); 268 return new ConstantIntValue(*(jint*)&prim);
269 } else if (type == T_LONG || type == T_DOUBLE) { 269 } else if (type == T_LONG || type == T_DOUBLE) {
270 jlong prim = PrimitiveConstant::primitive(value);
270 second = new ConstantIntValue(0); 271 second = new ConstantIntValue(0);
271 return new ConstantLongValue(prim); 272 return new ConstantLongValue(prim);
272 } else if (type == T_OBJECT) { 273 } else if (type == T_OBJECT) {
273 oop obj = Constant::object(value); 274 if (value->is_a(NullConstant::klass())) {
274 if (obj == NULL) {
275 return new ConstantOopWriteValue(NULL); 275 return new ConstantOopWriteValue(NULL);
276 } else { 276 } else {
277 oop obj = HotSpotObjectConstant::object(value);
278 assert(obj != NULL, "null value must be in NullConstant");
277 return new ConstantOopWriteValue(JNIHandles::make_local(obj)); 279 return new ConstantOopWriteValue(JNIHandles::make_local(obj));
278 } 280 }
279 } else if (type == T_ADDRESS) { 281 } else if (type == T_ADDRESS) {
280 ShouldNotReachHere(); 282 ShouldNotReachHere();
281 } 283 }