< prev index next >

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

Print this page
rev 11546 : imported patch webrev.02
rev 11547 : [mq]: webrev.03

*** 94,103 **** --- 94,121 ---- !((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) { + // Set oop_size field before setting the _klass field + // in post_allocation_setup_common() because the klass field + // indicates that the object is parsable by concurrent GC. + oop new_obj = (oop)obj; + assert(size > 0, "oop_size must be positive."); + assert(size_field_offset > 0, "size_field_offset must be initialized."); + new_obj->int_field_put(size_field_offset, size); + post_allocation_setup_common(klass, obj); + assert(Universe::is_bootstrapping() || + !new_obj->is_array(), "must not be an array"); + // notify jvmti and dtrace + post_allocation_notify(klass, new_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 **** --- 223,244 ---- 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 >