src/share/vm/gc_interface/collectedHeap.inline.hpp

changeset 548
ba764ed4b6f2
parent 435
a61af66fc99e
child 602
feeb96a45707
child 777
37f87013dfd8
     1.1 --- a/src/share/vm/gc_interface/collectedHeap.inline.hpp	Fri Apr 11 09:56:35 2008 -0400
     1.2 +++ b/src/share/vm/gc_interface/collectedHeap.inline.hpp	Sun Apr 13 17:43:42 2008 -0400
     1.3 @@ -61,7 +61,10 @@
     1.4    obj->set_klass(klass());
     1.5    assert(!Universe::is_fully_initialized() || obj->blueprint() != NULL,
     1.6           "missing blueprint");
     1.7 +}
     1.8  
     1.9 +// Support for jvmti and dtrace
    1.10 +inline void post_allocation_notify(KlassHandle klass, oop obj) {
    1.11    // support for JVMTI VMObjectAlloc event (no-op if not enabled)
    1.12    JvmtiExport::vm_object_alloc_event_collector(obj);
    1.13  
    1.14 @@ -79,18 +82,22 @@
    1.15    post_allocation_setup_common(klass, obj, size);
    1.16    assert(Universe::is_bootstrapping() ||
    1.17           !((oop)obj)->blueprint()->oop_is_array(), "must not be an array");
    1.18 +  // notify jvmti and dtrace
    1.19 +  post_allocation_notify(klass, (oop)obj);
    1.20  }
    1.21  
    1.22  void CollectedHeap::post_allocation_setup_array(KlassHandle klass,
    1.23                                                  HeapWord* obj,
    1.24                                                  size_t size,
    1.25                                                  int length) {
    1.26 -  // Set array length before posting jvmti object alloc event
    1.27 -  // in post_allocation_setup_common()
    1.28    assert(length >= 0, "length should be non-negative");
    1.29 +  post_allocation_setup_common(klass, obj, size);
    1.30 +  // Must set length after installing klass as set_klass zeros the length
    1.31 +  // field in UseCompressedOops
    1.32    ((arrayOop)obj)->set_length(length);
    1.33 -  post_allocation_setup_common(klass, obj, size);
    1.34    assert(((oop)obj)->blueprint()->oop_is_array(), "must be an array");
    1.35 +  // notify jvmti and dtrace (must be after length is set for dtrace)
    1.36 +  post_allocation_notify(klass, (oop)obj);
    1.37  }
    1.38  
    1.39  HeapWord* CollectedHeap::common_mem_allocate_noinit(size_t size, bool is_noref, TRAPS) {

mercurial