< prev index next > src/hotspot/share/prims/jvm.cpp
Print this page
ResourceMark rm(THREAD);
THROW_MSG_NULL(vmSymbols::java_lang_CloneNotSupportedException(), klass->external_name());
}
// Make shallow object copy
! const size_t size = obj->size();
oop new_obj_oop = nullptr;
if (obj->is_array()) {
const int length = ((arrayOop)obj())->length();
new_obj_oop = Universe::heap()->array_allocate(klass, size, length,
/* do_zero */ true, CHECK_NULL);
ResourceMark rm(THREAD);
THROW_MSG_NULL(vmSymbols::java_lang_CloneNotSupportedException(), klass->external_name());
}
// Make shallow object copy
! // With compact object headers, the original might have been expanded by GC
+ // for the identity hash. The clone must be allocated at the base size, since
+ // it will get a fresh (not-hashed, not-expanded) mark word.
+ const size_t size = UseCompactObjectHeaders
+ ? obj->base_size_given_klass(obj->mark(), klass)
+ : obj->size();
oop new_obj_oop = nullptr;
if (obj->is_array()) {
const int length = ((arrayOop)obj())->length();
new_obj_oop = Universe::heap()->array_allocate(klass, size, length,
/* do_zero */ true, CHECK_NULL);
< prev index next >