Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/heapRegionSet.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 | 6701abbc4441 |
children | a8ea2f110d87 |
comparison
equal
deleted
inserted
replaced
20336:6701abbc4441 | 20337:1f1d373cd044 |
---|---|
401 } else { | 401 } else { |
402 guarantee(Heap_lock->owned_by_self(), | 402 guarantee(Heap_lock->owned_by_self(), |
403 "master humongous set MT safety protocol outside a safepoint"); | 403 "master humongous set MT safety protocol outside a safepoint"); |
404 } | 404 } |
405 } | 405 } |
406 | |
407 void FreeRegionList_test() { | |
408 FreeRegionList l("test"); | |
409 | |
410 const uint num_regions_in_test = 5; | |
411 // Create a fake heap. It does not need to be valid, as the HeapRegion constructor | |
412 // does not access it. | |
413 MemRegion heap(NULL, num_regions_in_test * HeapRegion::GrainWords); | |
414 // Allocate a fake BOT because the HeapRegion constructor initializes | |
415 // the BOT. | |
416 size_t bot_size = G1BlockOffsetSharedArray::compute_size(heap.word_size()); | |
417 HeapWord* bot_data = NEW_C_HEAP_ARRAY(HeapWord, bot_size, mtGC); | |
418 ReservedSpace bot_rs(G1BlockOffsetSharedArray::compute_size(heap.word_size())); | |
419 G1RegionToSpaceMapper* bot_storage = | |
420 G1RegionToSpaceMapper::create_mapper(bot_rs, | |
421 os::vm_page_size(), | |
422 HeapRegion::GrainBytes, | |
423 G1BlockOffsetSharedArray::N_bytes, | |
424 mtGC); | |
425 G1BlockOffsetSharedArray oa(heap, bot_storage); | |
426 bot_storage->commit_regions(0, num_regions_in_test); | |
427 HeapRegion hr0(0, &oa, heap); | |
428 HeapRegion hr1(1, &oa, heap); | |
429 HeapRegion hr2(2, &oa, heap); | |
430 HeapRegion hr3(3, &oa, heap); | |
431 HeapRegion hr4(4, &oa, heap); | |
432 l.add_ordered(&hr1); | |
433 l.add_ordered(&hr0); | |
434 l.add_ordered(&hr3); | |
435 l.add_ordered(&hr4); | |
436 l.add_ordered(&hr2); | |
437 assert(l.length() == num_regions_in_test, "wrong length"); | |
438 l.verify_list(); | |
439 | |
440 bot_storage->uncommit_regions(0, num_regions_in_test); | |
441 delete bot_storage; | |
442 FREE_C_HEAP_ARRAY(HeapWord, bot_data, mtGC); | |
443 } |