8257917: [JVMCI] crash when materializing boxed values under -Xcomp

Reviewed-by: iveresov, kvn
This commit is contained in:
Doug Simon 2020-12-09 20:26:55 +00:00
parent fd5f6e2e19
commit baf4c1a4af
4 changed files with 47 additions and 11 deletions

View file

@ -1022,12 +1022,16 @@ GrowableArray<ScopeValue*>* CodeInstaller::record_virtual_objects(JVMCIObject de
}
GrowableArray<ScopeValue*>* objects = new GrowableArray<ScopeValue*>(JVMCIENV->get_length(virtualObjects), JVMCIENV->get_length(virtualObjects), NULL);
// Create the unique ObjectValues
bool has_auto_box = false;
for (int i = 0; i < JVMCIENV->get_length(virtualObjects); i++) {
// HandleMark hm(THREAD);
JVMCIObject value = JVMCIENV->get_object_at(virtualObjects, i);
int id = jvmci_env()->get_VirtualObject_id(value);
JVMCIObject type = jvmci_env()->get_VirtualObject_type(value);
bool is_auto_box = jvmci_env()->get_VirtualObject_isAutoBox(value);
if (is_auto_box) {
has_auto_box = true;
}
Klass* klass = jvmci_env()->asKlass(type);
oop javaMirror = klass->java_mirror();
ScopeValue *klass_sv = new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror));
@ -1049,6 +1053,11 @@ GrowableArray<ScopeValue*>* CodeInstaller::record_virtual_objects(JVMCIObject de
record_object_value(objects->at(id)->as_ObjectValue(), value, objects, JVMCI_CHECK_NULL);
}
_debug_recorder->dump_object_pool(objects);
if (has_auto_box) {
JavaThread* THREAD = JavaThread::current();
JVMCI::ensure_box_caches_initialized(CHECK_NULL);
}
return objects;
}