27 #include "gc/shared/collectedHeap.hpp"
28 #include "gc/shared/gcLogPrecious.hpp"
29 #include "gc/shared/gc_globals.hpp"
30 #include "gc/shared/space.hpp"
31 #include "logging/log.hpp"
32 #include "memory/virtualspace.hpp"
33 #include "nmt/memTracker.hpp"
34 #include "runtime/init.hpp"
35 #include "runtime/java.hpp"
36 #include "runtime/os.hpp"
37 #include "utilities/align.hpp"
38 #if INCLUDE_PARALLELGC
39 #include "gc/parallel/objectStartArray.hpp"
40 #endif
41
42 uint CardTable::_card_shift = 0;
43 uint CardTable::_card_size = 0;
44 uint CardTable::_card_size_in_words = 0;
45
46 void CardTable::initialize_card_size() {
47 assert(UseG1GC || UseParallelGC || UseSerialGC,
48 "Initialize card size should only be called by card based collectors.");
49
50 _card_size = GCCardSizeInBytes;
51 _card_shift = log2i_exact(_card_size);
52 _card_size_in_words = _card_size / sizeof(HeapWord);
53
54 log_info_p(gc, init)("CardTable entry size: " UINT32_FORMAT, _card_size);
55 }
56
57 size_t CardTable::compute_byte_map_size(size_t num_bytes) {
58 assert(_page_size != 0, "uninitialized, check declaration order");
59 const size_t granularity = os::vm_allocation_granularity();
60 return align_up(num_bytes, MAX2(_page_size, granularity));
61 }
62
63 CardTable::CardTable(MemRegion whole_heap) :
64 _whole_heap(whole_heap),
65 _page_size(os::vm_page_size()),
66 _byte_map_size(0),
67 _byte_map(nullptr),
|
27 #include "gc/shared/collectedHeap.hpp"
28 #include "gc/shared/gcLogPrecious.hpp"
29 #include "gc/shared/gc_globals.hpp"
30 #include "gc/shared/space.hpp"
31 #include "logging/log.hpp"
32 #include "memory/virtualspace.hpp"
33 #include "nmt/memTracker.hpp"
34 #include "runtime/init.hpp"
35 #include "runtime/java.hpp"
36 #include "runtime/os.hpp"
37 #include "utilities/align.hpp"
38 #if INCLUDE_PARALLELGC
39 #include "gc/parallel/objectStartArray.hpp"
40 #endif
41
42 uint CardTable::_card_shift = 0;
43 uint CardTable::_card_size = 0;
44 uint CardTable::_card_size_in_words = 0;
45
46 void CardTable::initialize_card_size() {
47 assert(UseG1GC || UseParallelGC || UseSerialGC || UseShenandoahGC,
48 "Initialize card size should only be called by card based collectors.");
49
50 _card_size = GCCardSizeInBytes;
51 _card_shift = log2i_exact(_card_size);
52 _card_size_in_words = _card_size / sizeof(HeapWord);
53
54 log_info_p(gc, init)("CardTable entry size: " UINT32_FORMAT, _card_size);
55 }
56
57 size_t CardTable::compute_byte_map_size(size_t num_bytes) {
58 assert(_page_size != 0, "uninitialized, check declaration order");
59 const size_t granularity = os::vm_allocation_granularity();
60 return align_up(num_bytes, MAX2(_page_size, granularity));
61 }
62
63 CardTable::CardTable(MemRegion whole_heap) :
64 _whole_heap(whole_heap),
65 _page_size(os::vm_page_size()),
66 _byte_map_size(0),
67 _byte_map(nullptr),
|