< prev index next >

src/share/vm/gc/g1/g1CollectedHeap.cpp

Print this page
rev 12240 : [mq]: filler_comments


 283   // the first region.
 284   HeapWord* new_obj = first_hr->bottom();
 285   // This will be the new top of the new object.
 286   HeapWord* obj_top = new_obj + word_size;
 287 
 288   // First, we need to zero the header of the space that we will be
 289   // allocating. When we update top further down, some refinement
 290   // threads might try to scan the region. By zeroing the header we
 291   // ensure that any thread that will try to scan the region will
 292   // come across the zero klass word and bail out.
 293   //
 294   // NOTE: It would not have been correct to have used
 295   // CollectedHeap::fill_with_object() and make the space look like
 296   // an int array. The thread that is doing the allocation will
 297   // later update the object header to a potentially different array
 298   // type and, for a very short period of time, the klass and length
 299   // fields will be inconsistent. This could cause a refinement
 300   // thread to calculate the object size incorrectly.
 301   Copy::fill_to_words(new_obj, oopDesc::header_size(), 0);
 302 


 303   // How many words we use for filler objects.
 304   size_t word_fill_size = word_size_sum - word_size;
 305 
 306   // How many words memory we "waste" which cannot hold a filler object.
 307   size_t words_not_fillable = 0;
 308 
 309   if (word_fill_size >= min_fill_size()) {
 310     fill_with_objects(obj_top, word_fill_size);
 311   } else if (word_fill_size > 0) {
 312     // We have space to fill, but we cannot fit an object there.
 313     words_not_fillable = word_fill_size;
 314     word_fill_size = 0;
 315   }
 316 
 317   // We will set up the first region as "starts humongous". This
 318   // will also update the BOT covering all the regions to reflect
 319   // that there is a single object that starts at the bottom of the
 320   // first region.
 321   first_hr->set_starts_humongous(obj_top, word_fill_size);
 322   first_hr->set_allocation_context(context);




 283   // the first region.
 284   HeapWord* new_obj = first_hr->bottom();
 285   // This will be the new top of the new object.
 286   HeapWord* obj_top = new_obj + word_size;
 287 
 288   // First, we need to zero the header of the space that we will be
 289   // allocating. When we update top further down, some refinement
 290   // threads might try to scan the region. By zeroing the header we
 291   // ensure that any thread that will try to scan the region will
 292   // come across the zero klass word and bail out.
 293   //
 294   // NOTE: It would not have been correct to have used
 295   // CollectedHeap::fill_with_object() and make the space look like
 296   // an int array. The thread that is doing the allocation will
 297   // later update the object header to a potentially different array
 298   // type and, for a very short period of time, the klass and length
 299   // fields will be inconsistent. This could cause a refinement
 300   // thread to calculate the object size incorrectly.
 301   Copy::fill_to_words(new_obj, oopDesc::header_size(), 0);
 302 
 303   // Next, pad out the unused tail of the last region with filler
 304   // objects, for improved usage accounting.
 305   // How many words we use for filler objects.
 306   size_t word_fill_size = word_size_sum - word_size;
 307 
 308   // How many words memory we "waste" which cannot hold a filler object.
 309   size_t words_not_fillable = 0;
 310 
 311   if (word_fill_size >= min_fill_size()) {
 312     fill_with_objects(obj_top, word_fill_size);
 313   } else if (word_fill_size > 0) {
 314     // We have space to fill, but we cannot fit an object there.
 315     words_not_fillable = word_fill_size;
 316     word_fill_size = 0;
 317   }
 318 
 319   // We will set up the first region as "starts humongous". This
 320   // will also update the BOT covering all the regions to reflect
 321   // that there is a single object that starts at the bottom of the
 322   // first region.
 323   first_hr->set_starts_humongous(obj_top, word_fill_size);
 324   first_hr->set_allocation_context(context);


< prev index next >