Mercurial > hg > truffle
comparison src/share/vm/memory/cardTableModRefBS.cpp @ 362:f8199438385b
Merge
author | apetrusenko |
---|---|
date | Wed, 17 Sep 2008 16:49:18 +0400 |
parents | 1ee8caae33af |
children | 2494ab195856 |
comparison
equal
deleted
inserted
replaced
316:5fa96a5a7e76 | 362:f8199438385b |
---|---|
341 | 341 |
342 void CardTableModRefBS::write_ref_field_work(void* field, oop newVal) { | 342 void CardTableModRefBS::write_ref_field_work(void* field, oop newVal) { |
343 inline_write_ref_field(field, newVal); | 343 inline_write_ref_field(field, newVal); |
344 } | 344 } |
345 | 345 |
346 | |
347 bool CardTableModRefBS::claim_card(size_t card_index) { | |
348 jbyte val = _byte_map[card_index]; | |
349 if (val != claimed_card_val()) { | |
350 jbyte res = Atomic::cmpxchg((jbyte) claimed_card_val(), &_byte_map[card_index], val); | |
351 if (res == val) | |
352 return true; | |
353 else return false; | |
354 } | |
355 return false; | |
356 } | |
346 | 357 |
347 void CardTableModRefBS::non_clean_card_iterate(Space* sp, | 358 void CardTableModRefBS::non_clean_card_iterate(Space* sp, |
348 MemRegion mr, | 359 MemRegion mr, |
349 DirtyCardToOopClosure* dcto_cl, | 360 DirtyCardToOopClosure* dcto_cl, |
350 MemRegionClosure* cl, | 361 MemRegionClosure* cl, |
441 *cur = dirty_card; | 452 *cur = dirty_card; |
442 cur++; | 453 cur++; |
443 } | 454 } |
444 } | 455 } |
445 | 456 |
446 void CardTableModRefBS::invalidate(MemRegion mr) { | 457 void CardTableModRefBS::invalidate(MemRegion mr, bool whole_heap) { |
447 for (int i = 0; i < _cur_covered_regions; i++) { | 458 for (int i = 0; i < _cur_covered_regions; i++) { |
448 MemRegion mri = mr.intersection(_covered[i]); | 459 MemRegion mri = mr.intersection(_covered[i]); |
449 if (!mri.is_empty()) dirty_MemRegion(mri); | 460 if (!mri.is_empty()) dirty_MemRegion(mri); |
450 } | 461 } |
451 } | 462 } |
469 MemRegion mri = mr.intersection(_covered[i]); | 480 MemRegion mri = mr.intersection(_covered[i]); |
470 if (!mri.is_empty()) clear_MemRegion(mri); | 481 if (!mri.is_empty()) clear_MemRegion(mri); |
471 } | 482 } |
472 } | 483 } |
473 | 484 |
485 void CardTableModRefBS::dirty(MemRegion mr) { | |
486 jbyte* first = byte_for(mr.start()); | |
487 jbyte* last = byte_after(mr.last()); | |
488 memset(first, dirty_card, last-first); | |
489 } | |
490 | |
474 // NOTES: | 491 // NOTES: |
475 // (1) Unlike mod_oop_in_space_iterate() above, dirty_card_iterate() | 492 // (1) Unlike mod_oop_in_space_iterate() above, dirty_card_iterate() |
476 // iterates over dirty cards ranges in increasing address order. | 493 // iterates over dirty cards ranges in increasing address order. |
477 // (2) Unlike, e.g., dirty_card_range_after_preclean() below, | |
478 // this method does not make the dirty cards prelceaned. | |
479 void CardTableModRefBS::dirty_card_iterate(MemRegion mr, | 494 void CardTableModRefBS::dirty_card_iterate(MemRegion mr, |
480 MemRegionClosure* cl) { | 495 MemRegionClosure* cl) { |
481 for (int i = 0; i < _cur_covered_regions; i++) { | 496 for (int i = 0; i < _cur_covered_regions; i++) { |
482 MemRegion mri = mr.intersection(_covered[i]); | 497 MemRegion mri = mr.intersection(_covered[i]); |
483 if (!mri.is_empty()) { | 498 if (!mri.is_empty()) { |
499 } | 514 } |
500 } | 515 } |
501 } | 516 } |
502 } | 517 } |
503 | 518 |
504 MemRegion CardTableModRefBS::dirty_card_range_after_preclean(MemRegion mr) { | 519 MemRegion CardTableModRefBS::dirty_card_range_after_reset(MemRegion mr, |
520 bool reset, | |
521 int reset_val) { | |
505 for (int i = 0; i < _cur_covered_regions; i++) { | 522 for (int i = 0; i < _cur_covered_regions; i++) { |
506 MemRegion mri = mr.intersection(_covered[i]); | 523 MemRegion mri = mr.intersection(_covered[i]); |
507 if (!mri.is_empty()) { | 524 if (!mri.is_empty()) { |
508 jbyte* cur_entry, *next_entry, *limit; | 525 jbyte* cur_entry, *next_entry, *limit; |
509 for (cur_entry = byte_for(mri.start()), limit = byte_for(mri.last()); | 526 for (cur_entry = byte_for(mri.start()), limit = byte_for(mri.last()); |
516 for (dirty_cards = 1; | 533 for (dirty_cards = 1; |
517 next_entry <= limit && *next_entry == dirty_card; | 534 next_entry <= limit && *next_entry == dirty_card; |
518 dirty_cards++, next_entry++); | 535 dirty_cards++, next_entry++); |
519 MemRegion cur_cards(addr_for(cur_entry), | 536 MemRegion cur_cards(addr_for(cur_entry), |
520 dirty_cards*card_size_in_words); | 537 dirty_cards*card_size_in_words); |
521 for (size_t i = 0; i < dirty_cards; i++) { | 538 if (reset) { |
522 cur_entry[i] = precleaned_card; | 539 for (size_t i = 0; i < dirty_cards; i++) { |
540 cur_entry[i] = reset_val; | |
541 } | |
523 } | 542 } |
524 return cur_cards; | 543 return cur_cards; |
525 } | 544 } |
526 } | 545 } |
527 } | 546 } |