@@ -303,9 +303,27 @@ JRT_BLOCK_ENTRY(Deoptimization::UnrollBlock*, Deoptimization::fetch_unroll_info(
303
303
JRT_END
304
304
305
305
#if COMPILER2_OR_JVMCI
306
+
307
+ static Klass* get_refined_array_klass (Klass* k, frame* fr, RegisterMap* map, ObjectValue* sv, TRAPS) {
308
+ // If it's an array, get the properties
309
+ if (k->is_array_klass () && !k->is_typeArray_klass ()) {
310
+ assert (!k->is_refArray_klass () && !k->is_flatArray_klass (), " Unexpected refined klass" );
311
+ nmethod* nm = fr->cb ()->as_nmethod_or_null ();
312
+ if (nm->is_compiled_by_c2 ()) {
313
+ assert (sv->has_properties (), " Property information is missing" );
314
+ ArrayKlass::ArrayProperties props = static_cast <ArrayKlass::ArrayProperties>(StackValue::create_stack_value (fr, map, sv->properties ())->get_jint ());
315
+ k = ObjArrayKlass::cast (k)->klass_with_properties (props, THREAD);
316
+ } else {
317
+ // TODO Graal needs to be fixed. Just go with the default properties for now
318
+ k = ObjArrayKlass::cast (k)->klass_with_properties (ArrayKlass::ArrayProperties::DEFAULT, THREAD);
319
+ }
320
+ }
321
+ return k;
322
+ }
323
+
306
324
// print information about reallocated objects
307
- static void print_objects (JavaThread* deoptee_thread,
308
- GrowableArray<ScopeValue*>* objects, bool realloc_failures) {
325
+ static void print_objects (JavaThread* deoptee_thread, frame* deoptee, RegisterMap* map,
326
+ GrowableArray<ScopeValue*>* objects, bool realloc_failures, TRAPS ) {
309
327
ResourceMark rm;
310
328
stringStream st; // change to logStream with logging
311
329
st.print_cr (" REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i (deoptee_thread));
@@ -321,6 +339,7 @@ static void print_objects(JavaThread* deoptee_thread,
321
339
}
322
340
323
341
Klass* k = java_lang_Class::as_Klass (sv->klass ()->as_ConstantOopReadValue ()->value ()());
342
+ k = get_refined_array_klass (k, deoptee, map, sv, THREAD);
324
343
325
344
st.print (" object <" INTPTR_FORMAT " > of type " , p2i (sv->value ()()));
326
345
k->print_value_on (&st);
@@ -409,7 +428,7 @@ static bool rematerialize_objects(JavaThread* thread, int exec_mode, nmethod* co
409
428
JRT_END
410
429
}
411
430
if (TraceDeoptimization && objects != nullptr ) {
412
- print_objects (deoptee_thread, objects, realloc_failures);
431
+ print_objects (deoptee_thread, &deoptee, &map, objects, realloc_failures, thread );
413
432
}
414
433
}
415
434
if (save_oop_result || vk != nullptr ) {
@@ -1267,19 +1286,7 @@ bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, RegisterMap*
1267
1286
assert (objects->at (i)->is_object (), " invalid debug information" );
1268
1287
ObjectValue* sv = (ObjectValue*) objects->at (i);
1269
1288
Klass* k = java_lang_Class::as_Klass (sv->klass ()->as_ConstantOopReadValue ()->value ()());
1270
- // If it's an array, get the properties
1271
- if (k->is_array_klass () && !k->is_typeArray_klass ()) {
1272
- assert (!k->is_refArray_klass () && !k->is_flatArray_klass (), " Unexpected refined klass" );
1273
- nmethod* nm = fr->cb ()->as_nmethod_or_null ();
1274
- if (nm->is_compiled_by_c2 ()) {
1275
- assert (sv->has_properties (), " Property information is missing" );
1276
- ArrayKlass::ArrayProperties props = static_cast <ArrayKlass::ArrayProperties>(StackValue::create_stack_value (fr, reg_map, sv->properties ())->get_jint ());
1277
- k = ObjArrayKlass::cast (k)->klass_with_properties (props, THREAD);
1278
- } else {
1279
- // TODO Graal needs to be fixed. Just go with the default properties for now
1280
- k = ObjArrayKlass::cast (k)->klass_with_properties (ArrayKlass::ArrayProperties::DEFAULT, THREAD);
1281
- }
1282
- }
1289
+ k = get_refined_array_klass (k, fr, reg_map, sv, THREAD);
1283
1290
1284
1291
// Check if the object may be null and has an additional null_marker input that needs
1285
1292
// to be checked before using the field values. Skip re-allocation if it is null.
@@ -1686,19 +1693,7 @@ void Deoptimization::reassign_fields(frame* fr, RegisterMap* reg_map, GrowableAr
1686
1693
assert (objects->at (i)->is_object (), " invalid debug information" );
1687
1694
ObjectValue* sv = (ObjectValue*) objects->at (i);
1688
1695
Klass* k = java_lang_Class::as_Klass (sv->klass ()->as_ConstantOopReadValue ()->value ()());
1689
- // If it's an array, get the properties
1690
- if (k->is_array_klass () && !k->is_typeArray_klass ()) {
1691
- assert (!k->is_refArray_klass () && !k->is_flatArray_klass (), " Unexpected refined klass" );
1692
- nmethod* nm = fr->cb ()->as_nmethod_or_null ();
1693
- if (nm->is_compiled_by_c2 ()) {
1694
- assert (sv->has_properties (), " Property information is missing" );
1695
- ArrayKlass::ArrayProperties props = static_cast <ArrayKlass::ArrayProperties>(StackValue::create_stack_value (fr, reg_map, sv->properties ())->get_jint ());
1696
- k = ObjArrayKlass::cast (k)->klass_with_properties (props, THREAD);
1697
- } else {
1698
- // TODO Graal needs to be fixed. Just go with the default properties for now
1699
- k = ObjArrayKlass::cast (k)->klass_with_properties (ArrayKlass::ArrayProperties::DEFAULT, THREAD);
1700
- }
1701
- }
1696
+ k = get_refined_array_klass (k, fr, reg_map, sv, THREAD);
1702
1697
1703
1698
Handle obj = sv->value ();
1704
1699
assert (obj.not_null () || realloc_failures || sv->has_properties (), " reallocation was missed" );
0 commit comments