--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Mon Mar 14 12:35:48 2016 +0300
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Mon Mar 14 12:35:48 2016 +0300
@@ -335,6 +335,7 @@
NOT_PRODUCT(_new_instance_slowcase_cnt++;)
assert(klass->is_klass(), "not a class");
+ Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
instanceKlassHandle h(thread, klass);
h->check_valid_for_instantiation(true, CHECK);
// make sure klass is initialized
@@ -370,6 +371,7 @@
// anymore after new_objArray() and no GC can happen before.
// (This may have to change if this code changes!)
assert(array_klass->is_klass(), "not a class");
+ Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK);
thread->set_vm_result(obj);
@@ -386,6 +388,7 @@
assert(klass->is_klass(), "not a class");
assert(rank >= 1, "rank must be nonzero");
+ Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
thread->set_vm_result(obj);
JRT_END