396 G1Mux2Closure::G1Mux2Closure(OopClosure *c1, OopClosure *c2) : 397 _c1(c1), _c2(c2) { } 398 399 G1UpdateRSOrPushRefOopClosure:: 400 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, 401 G1RemSet* rs, 402 G1ParPushHeapRSClosure* push_ref_cl, 403 bool record_refs_into_cset, 404 uint worker_i) : 405 _g1(g1h), _g1_rem_set(rs), _from(NULL), 406 _record_refs_into_cset(record_refs_into_cset), 407 _push_ref_cl(push_ref_cl), _worker_i(worker_i) { } 408 409 // Returns true if the given card contains references that point 410 // into the collection set, if we're checking for such references; 411 // false otherwise. 412 413 bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i, 414 bool check_for_refs_into_cset) { 415 assert(_g1->is_in_exact(_ct_bs->addr_for(card_ptr)), 416 err_msg("Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", 417 p2i(card_ptr), 418 _ct_bs->index_for(_ct_bs->addr_for(card_ptr)), 419 p2i(_ct_bs->addr_for(card_ptr)), 420 _g1->addr_to_region(_ct_bs->addr_for(card_ptr)))); 421 422 // If the card is no longer dirty, nothing to do. 423 if (*card_ptr != CardTableModRefBS::dirty_card_val()) { 424 // No need to return that this card contains refs that point 425 // into the collection set. 426 return false; 427 } 428 429 // Construct the region representing the card. 430 HeapWord* start = _ct_bs->addr_for(card_ptr); 431 // And find the region containing it. 432 HeapRegion* r = _g1->heap_region_containing(start); 433 434 // Why do we have to check here whether a card is on a young region, 435 // given that we dirty young regions and, as a result, the 436 // post-barrier is supposed to filter them out and never to enqueue 437 // them? When we allocate a new region as the "allocation region" we 438 // actually dirty its cards after we release the lock, since card 439 // dirtying while holding the lock was a performance bottleneck. So, 440 // as a result, it is possible for other threads to actually | 396 G1Mux2Closure::G1Mux2Closure(OopClosure *c1, OopClosure *c2) : 397 _c1(c1), _c2(c2) { } 398 399 G1UpdateRSOrPushRefOopClosure:: 400 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, 401 G1RemSet* rs, 402 G1ParPushHeapRSClosure* push_ref_cl, 403 bool record_refs_into_cset, 404 uint worker_i) : 405 _g1(g1h), _g1_rem_set(rs), _from(NULL), 406 _record_refs_into_cset(record_refs_into_cset), 407 _push_ref_cl(push_ref_cl), _worker_i(worker_i) { } 408 409 // Returns true if the given card contains references that point 410 // into the collection set, if we're checking for such references; 411 // false otherwise. 412 413 bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i, 414 bool check_for_refs_into_cset) { 415 assert(_g1->is_in_exact(_ct_bs->addr_for(card_ptr)), 416 "Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", 417 p2i(card_ptr), 418 _ct_bs->index_for(_ct_bs->addr_for(card_ptr)), 419 p2i(_ct_bs->addr_for(card_ptr)), 420 _g1->addr_to_region(_ct_bs->addr_for(card_ptr))); 421 422 // If the card is no longer dirty, nothing to do. 423 if (*card_ptr != CardTableModRefBS::dirty_card_val()) { 424 // No need to return that this card contains refs that point 425 // into the collection set. 426 return false; 427 } 428 429 // Construct the region representing the card. 430 HeapWord* start = _ct_bs->addr_for(card_ptr); 431 // And find the region containing it. 432 HeapRegion* r = _g1->heap_region_containing(start); 433 434 // Why do we have to check here whether a card is on a young region, 435 // given that we dirty young regions and, as a result, the 436 // post-barrier is supposed to filter them out and never to enqueue 437 // them? When we allocate a new region as the "allocation region" we 438 // actually dirty its cards after we release the lock, since card 439 // dirtying while holding the lock was a performance bottleneck. So, 440 // as a result, it is possible for other threads to actually |