< prev index next >
src/share/vm/oops/instanceMirrorKlass.cpp
Print this page
rev 11484 : [mq]: webrev.02
*** 48,63 ****
instanceOop InstanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
// Query before forming handle.
int size = instance_size(k);
KlassHandle h_k(THREAD, this);
! instanceOop i = (instanceOop)CollectedHeap::obj_allocate(h_k, size, CHECK_NULL);
! // Since mirrors can be variable sized because of the static fields, store
! // the size in the mirror itself.
! java_lang_Class::set_oop_size(i, size);
return i;
}
int InstanceMirrorKlass::oop_size(oop obj) const {
return java_lang_Class::oop_size(obj);
--- 48,64 ----
instanceOop InstanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
// Query before forming handle.
int size = instance_size(k);
KlassHandle h_k(THREAD, this);
! int field_offset = java_lang_Class::oop_size_offset();
! assert(field_offset != 0, "must be set");
! assert(size > 0, "total object size must be positive: %d", size);
+ instanceOop i = (instanceOop)CollectedHeap::class_allocate(h_k, size, field_offset, CHECK_NULL);
+ // oop_size is set by class_allocate() before the header is set.
return i;
}
int InstanceMirrorKlass::oop_size(oop obj) const {
return java_lang_Class::oop_size(obj);
< prev index next >