Skip to content

Commit 8881f29

Browse files
committedNov 17, 2021
8277310: ciReplay: @CPI MethodHandle references not resolved
Reviewed-by: chagedorn, thartmann
1 parent 262d070 commit 8881f29

File tree

1 file changed

+44
-45
lines changed

1 file changed

+44
-45
lines changed
 

‎src/hotspot/share/ci/ciReplay.cpp

+44-45
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ class CompileReplay : public StackObj {
436436
} else if (strcmp(dyno_ref, "<bsm>") == 0) {
437437
int pool_index = cp_cache_entry->constant_pool_index();
438438
BootstrapInfo bootstrap_specifier(cp, pool_index, index);
439-
obj = cp->resolve_possibly_cached_constant_at(bootstrap_specifier.bsm_index(), thread);
439+
obj = cp->resolve_possibly_cached_constant_at(bootstrap_specifier.bsm_index(), CHECK_NULL);
440440
} else {
441441
report_error("unrecognized token");
442442
return NULL;
@@ -465,58 +465,57 @@ class CompileReplay : public StackObj {
465465
report_error("no method handle found at cpi");
466466
return NULL;
467467
}
468-
{
469-
bool found_it;
470-
ik->link_class(CHECK_NULL);
471-
obj = cp->find_cached_constant_at(cpi, found_it, thread);
472-
}
468+
ik->link_class(CHECK_NULL);
469+
obj = cp->resolve_possibly_cached_constant_at(cpi, CHECK_NULL);
470+
}
471+
if (obj == NULL) {
472+
report_error("null cp object found");
473+
return NULL;
473474
}
474475
Klass* k = NULL;
475-
if (obj != NULL) {
476-
skip_ws();
477-
// loop: read fields
478-
char* field = NULL;
479-
do {
480-
field = parse_string();
481-
if (field == NULL) {
482-
report_error("no field found");
476+
skip_ws();
477+
// loop: read fields
478+
char* field = NULL;
479+
do {
480+
field = parse_string();
481+
if (field == NULL) {
482+
report_error("no field found");
483+
return NULL;
484+
}
485+
if (strcmp(field, ";") == 0) {
486+
break;
487+
}
488+
// raw Method*
489+
if (strcmp(field, "<vmtarget>") == 0) {
490+
Method* vmtarget = java_lang_invoke_MemberName::vmtarget(obj);
491+
k = (vmtarget == NULL) ? NULL : vmtarget->method_holder();
492+
if (k == NULL) {
493+
report_error("null vmtarget found");
483494
return NULL;
484495
}
485-
if (strcmp(field, ";") == 0) {
486-
break;
487-
}
488-
// raw Method*
489-
if (strcmp(field, "<vmtarget>") == 0) {
490-
Method* vmtarget = java_lang_invoke_MemberName::vmtarget(obj);
491-
k = (vmtarget == NULL) ? NULL : vmtarget->method_holder();
492-
if (k == NULL) {
493-
report_error("null vmtarget found");
494-
return NULL;
495-
}
496-
if (!parse_terminator()) {
497-
report_error("missing terminator");
498-
return NULL;
499-
}
500-
return k;
496+
if (!parse_terminator()) {
497+
report_error("missing terminator");
498+
return NULL;
501499
}
502-
obj = ciReplay::obj_field(obj, field);
503-
// array
504-
if (obj != NULL && obj->is_objArray()) {
505-
objArrayOop arr = (objArrayOop)obj;
506-
int index = parse_int("index");
507-
if (index >= arr->length()) {
508-
report_error("bad array index");
509-
return NULL;
510-
}
511-
obj = arr->obj_at(index);
500+
return k;
501+
}
502+
obj = ciReplay::obj_field(obj, field);
503+
// array
504+
if (obj != NULL && obj->is_objArray()) {
505+
objArrayOop arr = (objArrayOop)obj;
506+
int index = parse_int("index");
507+
if (index >= arr->length()) {
508+
report_error("bad array index");
509+
return NULL;
512510
}
513-
} while (obj != NULL);
514-
if (obj == NULL) {
515-
report_error("null field found");
516-
return NULL;
511+
obj = arr->obj_at(index);
517512
}
518-
k = obj->klass();
513+
} while (obj != NULL);
514+
if (obj == NULL) {
515+
report_error("null field found");
516+
return NULL;
519517
}
518+
k = obj->klass();
520519
return k;
521520
}
522521

0 commit comments

Comments
 (0)
Please sign in to comment.