hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp
changeset 593 803947e176bd
parent 360 21d113ecbf6a
child 670 ddf3e9583f2f
child 1376 f7fc7a708b63
equal deleted inserted replaced
592:dbf1a1c172d6 593:803947e176bd
    88 
    88 
    89 void CollectedHeap::post_allocation_setup_array(KlassHandle klass,
    89 void CollectedHeap::post_allocation_setup_array(KlassHandle klass,
    90                                                 HeapWord* obj,
    90                                                 HeapWord* obj,
    91                                                 size_t size,
    91                                                 size_t size,
    92                                                 int length) {
    92                                                 int length) {
       
    93   // Set array length before setting the _klass field
       
    94   // in post_allocation_setup_common() because the klass field
       
    95   // indicates that the object is parsable by concurrent GC.
    93   assert(length >= 0, "length should be non-negative");
    96   assert(length >= 0, "length should be non-negative");
       
    97   ((arrayOop)obj)->set_length(length);
    94   post_allocation_setup_common(klass, obj, size);
    98   post_allocation_setup_common(klass, obj, size);
    95   // Must set length after installing klass as set_klass zeros the length
       
    96   // field in UseCompressedOops
       
    97   ((arrayOop)obj)->set_length(length);
       
    98   assert(((oop)obj)->blueprint()->oop_is_array(), "must be an array");
    99   assert(((oop)obj)->blueprint()->oop_is_array(), "must be an array");
    99   // notify jvmti and dtrace (must be after length is set for dtrace)
   100   // notify jvmti and dtrace (must be after length is set for dtrace)
   100   post_allocation_notify(klass, (oop)obj);
   101   post_allocation_notify(klass, (oop)obj);
   101 }
   102 }
   102 
   103 
   222 
   223 
   223 void CollectedHeap::init_obj(HeapWord* obj, size_t size) {
   224 void CollectedHeap::init_obj(HeapWord* obj, size_t size) {
   224   assert(obj != NULL, "cannot initialize NULL object");
   225   assert(obj != NULL, "cannot initialize NULL object");
   225   const size_t hs = oopDesc::header_size();
   226   const size_t hs = oopDesc::header_size();
   226   assert(size >= hs, "unexpected object size");
   227   assert(size >= hs, "unexpected object size");
       
   228   ((oop)obj)->set_klass_gap(0);
   227   Copy::fill_to_aligned_words(obj + hs, size - hs);
   229   Copy::fill_to_aligned_words(obj + hs, size - hs);
   228 }
   230 }
   229 
   231 
   230 oop CollectedHeap::obj_allocate(KlassHandle klass, int size, TRAPS) {
   232 oop CollectedHeap::obj_allocate(KlassHandle klass, int size, TRAPS) {
   231   debug_only(check_for_valid_allocation_state());
   233   debug_only(check_for_valid_allocation_state());