Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @ 20337:1f1d373cd044
8038423: G1: Decommit memory within heap
Summary: Allow G1 to decommit memory of arbitrary regions within the heap and their associated auxiliary data structures card table, BOT, hot card cache, and mark bitmaps.
Reviewed-by: mgerdin, brutisso, jwilhelm
author | tschatzl |
---|---|
date | Thu, 21 Aug 2014 11:47:10 +0200 |
parents | eec72fa4b108 |
children | 833b0f92429a a8ea2f110d87 |
comparison
equal
deleted
inserted
replaced
20336:6701abbc4441 | 20337:1f1d373cd044 |
---|---|
370 _max_regions = max_num_regions; | 370 _max_regions = max_num_regions; |
371 _cache = Padded2DArray<int, mtGC>::create_unfreeable(n_par_rs, | 371 _cache = Padded2DArray<int, mtGC>::create_unfreeable(n_par_rs, |
372 _max_regions, | 372 _max_regions, |
373 &_static_mem_size); | 373 &_static_mem_size); |
374 | 374 |
375 for (uint i = 0; i < n_par_rs; i++) { | 375 invalidate(0, _max_regions); |
376 for (uint j = 0; j < _max_regions; j++) { | 376 } |
377 set(i, j, InvalidCard); | 377 |
378 } | 378 void FromCardCache::invalidate(uint start_idx, size_t new_num_regions) { |
379 } | 379 guarantee((size_t)start_idx + new_num_regions <= max_uintx, |
380 } | 380 err_msg("Trying to invalidate beyond maximum region, from %u size "SIZE_FORMAT, |
381 | 381 start_idx, new_num_regions)); |
382 void FromCardCache::shrink(uint new_num_regions) { | |
383 for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) { | 382 for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) { |
384 assert(new_num_regions <= _max_regions, "Must be within max."); | 383 uint end_idx = (start_idx + (uint)new_num_regions); |
385 for (uint j = new_num_regions; j < _max_regions; j++) { | 384 assert(end_idx <= _max_regions, "Must be within max."); |
385 for (uint j = start_idx; j < end_idx; j++) { | |
386 set(i, j, InvalidCard); | 386 set(i, j, InvalidCard); |
387 } | 387 } |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
404 for (uint i = 0; i < num_par_remsets; i++) { | 404 for (uint i = 0; i < num_par_remsets; i++) { |
405 set(i, region_idx, InvalidCard); | 405 set(i, region_idx, InvalidCard); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 void OtherRegionsTable::init_from_card_cache(uint max_regions) { | 409 void OtherRegionsTable::initialize(uint max_regions) { |
410 FromCardCache::initialize(HeapRegionRemSet::num_par_rem_sets(), max_regions); | 410 FromCardCache::initialize(HeapRegionRemSet::num_par_rem_sets(), max_regions); |
411 } | 411 } |
412 | 412 |
413 void OtherRegionsTable::shrink_from_card_cache(uint new_num_regions) { | 413 void OtherRegionsTable::invalidate(uint start_idx, size_t num_regions) { |
414 FromCardCache::shrink(new_num_regions); | 414 FromCardCache::invalidate(start_idx, num_regions); |
415 } | 415 } |
416 | 416 |
417 void OtherRegionsTable::print_from_card_cache() { | 417 void OtherRegionsTable::print_from_card_cache() { |
418 FromCardCache::print(); | 418 FromCardCache::print(); |
419 } | 419 } |
837 } | 837 } |
838 | 838 |
839 HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, | 839 HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, |
840 HeapRegion* hr) | 840 HeapRegion* hr) |
841 : _bosa(bosa), | 841 : _bosa(bosa), |
842 _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #"UINT32_FORMAT, hr->hrs_index()), true), | 842 _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrs_index()), true), |
843 _code_roots(), _other_regions(hr, &_m) { | 843 _code_roots(), _other_regions(hr, &_m), _iter_state(Unclaimed), _iter_claimed(0) { |
844 reset_for_par_iteration(); | 844 reset_for_par_iteration(); |
845 } | 845 } |
846 | 846 |
847 void HeapRegionRemSet::setup_remset_size() { | 847 void HeapRegionRemSet::setup_remset_size() { |
848 // Setup sparse and fine-grain tables sizes. | 848 // Setup sparse and fine-grain tables sizes. |