< prev index next >

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

Print this page

        

*** 38,102 **** #include "services/lowMemoryDetector.hpp" #include "utilities/copy.hpp" // Inline allocation implementations. ! void CollectedHeap::post_allocation_setup_common(KlassHandle klass, HeapWord* obj_ptr) { post_allocation_setup_no_klass_install(klass, obj_ptr); oop obj = (oop)obj_ptr; #if ! INCLUDE_ALL_GCS ! obj->set_klass(klass()); #else // Need a release store to ensure array/class length, mark word, and // object zeroing are visible before setting the klass non-NULL, for // concurrent collectors. ! obj->release_set_klass(klass()); #endif } ! void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass, HeapWord* obj_ptr) { oop obj = (oop)obj_ptr; assert(obj != NULL, "NULL object pointer"); ! if (UseBiasedLocking && (klass() != NULL)) { obj->set_mark(klass->prototype_header()); } else { // May be bootstrapping obj->set_mark(markOopDesc::prototype()); } } // Support for jvmti and dtrace ! inline void post_allocation_notify(KlassHandle klass, oop obj, int size) { // support low memory notifications (no-op if not enabled) LowMemoryDetector::detect_low_memory_for_collected_pools(); // support for JVMTI VMObjectAlloc event (no-op if not enabled) JvmtiExport::vm_object_alloc_event_collector(obj); if (DTraceAllocProbes) { // support for Dtrace object alloc event (no-op most of the time) ! if (klass() != NULL && klass()->name() != NULL) { SharedRuntime::dtrace_object_alloc(obj, size); } } } ! void CollectedHeap::post_allocation_setup_obj(KlassHandle klass, HeapWord* obj_ptr, int size) { post_allocation_setup_common(klass, obj_ptr); oop obj = (oop)obj_ptr; assert(Universe::is_bootstrapping() || !obj->is_array(), "must not be an array"); // notify jvmti and dtrace post_allocation_notify(klass, obj, size); } ! void CollectedHeap::post_allocation_setup_class(KlassHandle klass, HeapWord* obj_ptr, int size) { // Set oop_size field before setting the _klass field because a // non-NULL _klass field indicates that the object is parsable by // concurrent GC. --- 38,102 ---- #include "services/lowMemoryDetector.hpp" #include "utilities/copy.hpp" // Inline allocation implementations. ! void CollectedHeap::post_allocation_setup_common(Klass* klass, HeapWord* obj_ptr) { post_allocation_setup_no_klass_install(klass, obj_ptr); oop obj = (oop)obj_ptr; #if ! INCLUDE_ALL_GCS ! obj->set_klass(klass); #else // Need a release store to ensure array/class length, mark word, and // object zeroing are visible before setting the klass non-NULL, for // concurrent collectors. ! obj->release_set_klass(klass); #endif } ! void CollectedHeap::post_allocation_setup_no_klass_install(Klass* klass, HeapWord* obj_ptr) { oop obj = (oop)obj_ptr; assert(obj != NULL, "NULL object pointer"); ! if (UseBiasedLocking && (klass != NULL)) { obj->set_mark(klass->prototype_header()); } else { // May be bootstrapping obj->set_mark(markOopDesc::prototype()); } } // Support for jvmti and dtrace ! inline void post_allocation_notify(Klass* klass, oop obj, int size) { // support low memory notifications (no-op if not enabled) LowMemoryDetector::detect_low_memory_for_collected_pools(); // support for JVMTI VMObjectAlloc event (no-op if not enabled) JvmtiExport::vm_object_alloc_event_collector(obj); if (DTraceAllocProbes) { // support for Dtrace object alloc event (no-op most of the time) ! if (klass != NULL && klass->name() != NULL) { SharedRuntime::dtrace_object_alloc(obj, size); } } } ! void CollectedHeap::post_allocation_setup_obj(Klass* klass, HeapWord* obj_ptr, int size) { post_allocation_setup_common(klass, obj_ptr); oop obj = (oop)obj_ptr; assert(Universe::is_bootstrapping() || !obj->is_array(), "must not be an array"); // notify jvmti and dtrace post_allocation_notify(klass, obj, size); } ! void CollectedHeap::post_allocation_setup_class(Klass* klass, HeapWord* obj_ptr, int size) { // Set oop_size field before setting the _klass field because a // non-NULL _klass field indicates that the object is parsable by // concurrent GC.
*** 108,118 **** !new_cls->is_array(), "must not be an array"); // notify jvmti and dtrace post_allocation_notify(klass, new_cls, size); } ! void CollectedHeap::post_allocation_setup_array(KlassHandle klass, HeapWord* obj_ptr, int length) { // Set array length before setting the _klass field because a // non-NULL klass field indicates that the object is parsable by // concurrent GC. --- 108,118 ---- !new_cls->is_array(), "must not be an array"); // notify jvmti and dtrace post_allocation_notify(klass, new_cls, size); } ! void CollectedHeap::post_allocation_setup_array(Klass* klass, HeapWord* obj_ptr, int length) { // Set array length before setting the _klass field because a // non-NULL klass field indicates that the object is parsable by // concurrent GC.
*** 123,133 **** assert(new_obj->is_array(), "must be an array"); // notify jvmti and dtrace (must be after length is set for dtrace) post_allocation_notify(klass, new_obj, new_obj->size()); } ! HeapWord* CollectedHeap::common_mem_allocate_noinit(KlassHandle klass, size_t size, TRAPS) { // Clear unhandled oops for memory allocation. Memory allocation might // not take out a lock if from tlab, so clear here. CHECK_UNHANDLED_OOPS_ONLY(THREAD->clear_unhandled_oops();) --- 123,133 ---- assert(new_obj->is_array(), "must be an array"); // notify jvmti and dtrace (must be after length is set for dtrace) post_allocation_notify(klass, new_obj, new_obj->size()); } ! HeapWord* CollectedHeap::common_mem_allocate_noinit(Klass* klass, size_t size, TRAPS) { // Clear unhandled oops for memory allocation. Memory allocation might // not take out a lock if from tlab, so clear here. CHECK_UNHANDLED_OOPS_ONLY(THREAD->clear_unhandled_oops();)
*** 184,200 **** THROW_OOP_0(Universe::out_of_memory_error_gc_overhead_limit()); } } ! HeapWord* CollectedHeap::common_mem_allocate_init(KlassHandle klass, size_t size, TRAPS) { HeapWord* obj = common_mem_allocate_noinit(klass, size, CHECK_NULL); init_obj(obj, size); return obj; } ! HeapWord* CollectedHeap::allocate_from_tlab(KlassHandle klass, Thread* thread, size_t size) { assert(UseTLAB, "should use UseTLAB"); HeapWord* obj = thread->tlab().allocate(size); if (obj != NULL) { return obj; --- 184,200 ---- THROW_OOP_0(Universe::out_of_memory_error_gc_overhead_limit()); } } ! HeapWord* CollectedHeap::common_mem_allocate_init(Klass* klass, size_t size, TRAPS) { HeapWord* obj = common_mem_allocate_noinit(klass, size, CHECK_NULL); init_obj(obj, size); return obj; } ! HeapWord* CollectedHeap::allocate_from_tlab(Klass* klass, Thread* thread, size_t size) { assert(UseTLAB, "should use UseTLAB"); HeapWord* obj = thread->tlab().allocate(size); if (obj != NULL) { return obj;
*** 209,239 **** assert(size >= hs, "unexpected object size"); ((oop)obj)->set_klass_gap(0); Copy::fill_to_aligned_words(obj + hs, size - hs); } ! oop CollectedHeap::obj_allocate(KlassHandle klass, int size, 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_obj(klass, obj, size); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); return (oop)obj; } ! oop CollectedHeap::class_allocate(KlassHandle klass, int size, 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); // 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()); assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); --- 209,239 ---- assert(size >= hs, "unexpected object size"); ((oop)obj)->set_klass_gap(0); Copy::fill_to_aligned_words(obj + hs, size - hs); } ! oop CollectedHeap::obj_allocate(Klass* klass, int size, 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_obj(klass, obj, size); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); return (oop)obj; } ! oop CollectedHeap::class_allocate(Klass* klass, int size, 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); // set oop_size NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); return (oop)obj; } ! oop CollectedHeap::array_allocate(Klass* klass, int size, int length, TRAPS) { debug_only(check_for_valid_allocation_state()); assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
*** 242,252 **** post_allocation_setup_array(klass, obj, length); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); return (oop)obj; } ! oop CollectedHeap::array_allocate_nozero(KlassHandle klass, int size, int length, TRAPS) { debug_only(check_for_valid_allocation_state()); assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); --- 242,252 ---- post_allocation_setup_array(klass, obj, length); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); return (oop)obj; } ! oop CollectedHeap::array_allocate_nozero(Klass* klass, int size, int length, TRAPS) { debug_only(check_for_valid_allocation_state()); assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
< prev index next >