src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc_implementation/parNew

src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp

Print this page
rev 5732 : [mq]: comments2


 196   cur_chunk_index           = cur_chunk_index - lowest_non_clean_base_chunk_index;
 197 
 198   NOISY(tty->print_cr("===========================================================================");)
 199   NOISY(tty->print_cr(" process_chunk_boundary: Called with [" PTR_FORMAT "," PTR_FORMAT ")",
 200                       chunk_mr.start(), chunk_mr.end());)
 201 
 202   // First, set "our" lowest_non_clean entry, which would be
 203   // used by the thread scanning an adjoining left chunk with
 204   // a non-array object straddling the mutual boundary.
 205   // Find the object that spans our boundary, if one exists.
 206   // first_block is the block possibly straddling our left boundary.
 207   HeapWord* first_block = sp->block_start(chunk_mr.start());
 208   assert((chunk_mr.start() != used.start()) || (first_block == chunk_mr.start()),
 209          "First chunk should always have a co-initial block");
 210   // Does the block straddle the chunk's left boundary, and is it
 211   // a non-array object?
 212   if (first_block < chunk_mr.start()        // first block straddles left bdry
 213       && sp->block_is_obj(first_block)      // first block is an object
 214       && !(oop(first_block)->is_objArray()  // first block is not an array (arrays are precisely dirtied)
 215            || oop(first_block)->is_typeArray())) {
 216     // Find our least non-clean card, so that a left neighbour
 217     // does not scan an object straddling the mutual boundary
 218     // too far to the right, and attempt to scan a portion of
 219     // that object twice.
 220     jbyte* first_dirty_card = NULL;
 221     jbyte* last_card_of_first_obj =
 222         byte_for(first_block + sp->block_size(first_block) - 1);
 223     jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start());
 224     jbyte* last_card_of_cur_chunk = byte_for(chunk_mr.last());
 225     jbyte* last_card_to_check =
 226       (jbyte*) MIN2((intptr_t) last_card_of_cur_chunk,
 227                     (intptr_t) last_card_of_first_obj);
 228     // Note that this does not need to go beyond our last card
 229     // if our first object completely straddles this chunk.
 230     for (jbyte* cur = first_card_of_cur_chunk;
 231          cur <= last_card_to_check; cur++) {
 232       jbyte val = *cur;
 233       if (card_will_be_scanned(val)) {
 234         first_dirty_card = cur; break;
 235       } else {
 236         assert(!card_may_have_been_dirty(val), "Error");
 237       }
 238     }
 239     if (first_dirty_card != NULL) {
 240       NOISY(tty->print_cr(" LNC: Found a dirty card at " PTR_FORMAT " in current chunk",
 241                     first_dirty_card);)
 242       assert(0 <= cur_chunk_index && cur_chunk_index < lowest_non_clean_chunk_size,
 243              "Bounds error.");
 244       assert(lowest_non_clean[cur_chunk_index] == NULL,
 245              "Write exactly once : value should be stable hereafter for this round");
 246       lowest_non_clean[cur_chunk_index] = first_dirty_card;
 247     } NOISY(else {
 248       tty->print_cr(" LNC: Found no dirty card in current chunk; leaving LNC entry NULL");
 249       // In the future, we could have this thread look for a non-NULL value to copy from its
 250       // right neighbour (up to the end of the first object).
 251       if (last_card_of_cur_chunk < last_card_of_first_obj) {
 252         tty->print_cr(" LNC: BEWARE!!! first obj straddles past right end of chunk:\n"
 253                       "   might be efficient to get value from right neighbour?");
 254       }
 255     })
 256   } else {
 257     // In this case we can help our neighbour by just asking them
 258     // to stop at our first card (even though it may not be dirty).
 259     NOISY(tty->print_cr(" LNC: first block is not a non-array object; setting LNC to first card of current chunk");)
 260     assert(lowest_non_clean[cur_chunk_index] == NULL, "Write once : value should be stable hereafter");
 261     jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start());
 262     lowest_non_clean[cur_chunk_index] = first_card_of_cur_chunk;
 263   }
 264   NOISY(tty->print_cr(" process_chunk_boundary: lowest_non_clean[" INTPTR_FORMAT "] = " PTR_FORMAT
 265                 "   which corresponds to the heap address " PTR_FORMAT,
 266                 cur_chunk_index, lowest_non_clean[cur_chunk_index],
 267                 (lowest_non_clean[cur_chunk_index] != NULL)
 268                 ? addr_for(lowest_non_clean[cur_chunk_index])
 269                 : NULL);)
 270   NOISY(tty->print_cr("---------------------------------------------------------------------------");)
 271 
 272   // Next, set our own max_to_do, which will strictly/exclusively bound
 273   // the highest address that we will scan past the right end of our chunk.
 274   HeapWord* max_to_do = NULL;
 275   if (chunk_mr.end() < used.end()) {
 276     // This is not the last chunk in the used region.
 277     // What is our last block? We check the first block of




 196   cur_chunk_index           = cur_chunk_index - lowest_non_clean_base_chunk_index;
 197 
 198   NOISY(tty->print_cr("===========================================================================");)
 199   NOISY(tty->print_cr(" process_chunk_boundary: Called with [" PTR_FORMAT "," PTR_FORMAT ")",
 200                       chunk_mr.start(), chunk_mr.end());)
 201 
 202   // First, set "our" lowest_non_clean entry, which would be
 203   // used by the thread scanning an adjoining left chunk with
 204   // a non-array object straddling the mutual boundary.
 205   // Find the object that spans our boundary, if one exists.
 206   // first_block is the block possibly straddling our left boundary.
 207   HeapWord* first_block = sp->block_start(chunk_mr.start());
 208   assert((chunk_mr.start() != used.start()) || (first_block == chunk_mr.start()),
 209          "First chunk should always have a co-initial block");
 210   // Does the block straddle the chunk's left boundary, and is it
 211   // a non-array object?
 212   if (first_block < chunk_mr.start()        // first block straddles left bdry
 213       && sp->block_is_obj(first_block)      // first block is an object
 214       && !(oop(first_block)->is_objArray()  // first block is not an array (arrays are precisely dirtied)
 215            || oop(first_block)->is_typeArray())) {
 216     // Find our least non-clean card, so that a left neighbor
 217     // does not scan an object straddling the mutual boundary
 218     // too far to the right, and attempt to scan a portion of
 219     // that object twice.
 220     jbyte* first_dirty_card = NULL;
 221     jbyte* last_card_of_first_obj =
 222         byte_for(first_block + sp->block_size(first_block) - 1);
 223     jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start());
 224     jbyte* last_card_of_cur_chunk = byte_for(chunk_mr.last());
 225     jbyte* last_card_to_check =
 226       (jbyte*) MIN2((intptr_t) last_card_of_cur_chunk,
 227                     (intptr_t) last_card_of_first_obj);
 228     // Note that this does not need to go beyond our last card
 229     // if our first object completely straddles this chunk.
 230     for (jbyte* cur = first_card_of_cur_chunk;
 231          cur <= last_card_to_check; cur++) {
 232       jbyte val = *cur;
 233       if (card_will_be_scanned(val)) {
 234         first_dirty_card = cur; break;
 235       } else {
 236         assert(!card_may_have_been_dirty(val), "Error");
 237       }
 238     }
 239     if (first_dirty_card != NULL) {
 240       NOISY(tty->print_cr(" LNC: Found a dirty card at " PTR_FORMAT " in current chunk",
 241                     first_dirty_card);)
 242       assert(0 <= cur_chunk_index && cur_chunk_index < lowest_non_clean_chunk_size,
 243              "Bounds error.");
 244       assert(lowest_non_clean[cur_chunk_index] == NULL,
 245              "Write exactly once : value should be stable hereafter for this round");
 246       lowest_non_clean[cur_chunk_index] = first_dirty_card;
 247     } NOISY(else {
 248       tty->print_cr(" LNC: Found no dirty card in current chunk; leaving LNC entry NULL");
 249       // In the future, we could have this thread look for a non-NULL value to copy from its
 250       // right neighbor (up to the end of the first object).
 251       if (last_card_of_cur_chunk < last_card_of_first_obj) {
 252         tty->print_cr(" LNC: BEWARE!!! first obj straddles past right end of chunk:\n"
 253                       "   might be efficient to get value from right neighbour?");
 254       }
 255     })
 256   } else {
 257     // In this case we can help our neighbor by just asking them
 258     // to stop at our first card (even though it may not be dirty).
 259     NOISY(tty->print_cr(" LNC: first block is not a non-array object; setting LNC to first card of current chunk");)
 260     assert(lowest_non_clean[cur_chunk_index] == NULL, "Write once : value should be stable hereafter");
 261     jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start());
 262     lowest_non_clean[cur_chunk_index] = first_card_of_cur_chunk;
 263   }
 264   NOISY(tty->print_cr(" process_chunk_boundary: lowest_non_clean[" INTPTR_FORMAT "] = " PTR_FORMAT
 265                 "   which corresponds to the heap address " PTR_FORMAT,
 266                 cur_chunk_index, lowest_non_clean[cur_chunk_index],
 267                 (lowest_non_clean[cur_chunk_index] != NULL)
 268                 ? addr_for(lowest_non_clean[cur_chunk_index])
 269                 : NULL);)
 270   NOISY(tty->print_cr("---------------------------------------------------------------------------");)
 271 
 272   // Next, set our own max_to_do, which will strictly/exclusively bound
 273   // the highest address that we will scan past the right end of our chunk.
 274   HeapWord* max_to_do = NULL;
 275   if (chunk_mr.end() < used.end()) {
 276     // This is not the last chunk in the used region.
 277     // What is our last block? We check the first block of


src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File