< prev index next >

src/share/vm/gc/shared/collectedHeap.inline.hpp

Print this page
rev 11484 : [mq]: webrev.02

*** 94,103 **** --- 94,119 ---- !((oop)obj)->is_array(), "must not be an array"); // notify jvmti and dtrace post_allocation_notify(klass, (oop)obj, size); } + void CollectedHeap::post_allocation_setup_class(KlassHandle klass, + HeapWord* obj, + int size, + int size_field_offset) { + post_allocation_setup_no_klass_install(klass, obj); + + // set the j.l.Class instance's oop_size field BEFORE setting the header: + ((oop)obj)->int_field_put(size_field_offset, size); + + post_allocation_install_obj_klass(klass, oop(obj)); // set the header + assert(Universe::is_bootstrapping() || + !((oop)obj)->is_array(), "must not be an array"); + // notify jvmti and dtrace + post_allocation_notify(klass, (oop)obj, size); + } + void CollectedHeap::post_allocation_setup_array(KlassHandle klass, HeapWord* obj, int length) { // Set array length before setting the _klass field // in post_allocation_setup_common() because the klass field
*** 205,214 **** --- 221,242 ---- post_allocation_setup_obj(klass, obj, size); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); return (oop)obj; } + // Instances of j.l.Class have an oop_size field that must be set before the + // the header is set in order to parse the instances's size correctly. + oop CollectedHeap::class_allocate(KlassHandle klass, int size, int size_field_offset, TRAPS) { + debug_only(check_for_valid_allocation_state()); + assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); + assert(size >= 0, "int won't convert to size_t"); + HeapWord* obj = common_mem_allocate_init(klass, size, CHECK_NULL); + post_allocation_setup_class(klass, obj, size, size_field_offset); // set oop_size + NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); + return (oop)obj; + } + oop CollectedHeap::array_allocate(KlassHandle klass, int size, int length, TRAPS) { debug_only(check_for_valid_allocation_state());
< prev index next >