23
23
*/
24
24
25
25
#include " precompiled.hpp"
26
+ #include " gc/g1/g1ConcurrentRefine.hpp"
27
+ #include " gc/g1/g1DirtyCardQueue.hpp"
26
28
#include " gc/g1/g1FromCardCache.hpp"
27
- #include " gc/g1/g1RemSet.hpp"
28
29
#include " memory/padded.inline.hpp"
30
+ #include " runtime/globals.hpp"
29
31
#include " utilities/debug.hpp"
30
32
31
33
uintptr_t ** G1FromCardCache::_cache = NULL ;
@@ -35,16 +37,16 @@ size_t G1FromCardCache::_static_mem_size = 0;
35
37
uint G1FromCardCache::_max_workers = 0 ;
36
38
#endif
37
39
38
- void G1FromCardCache::initialize (uint num_par_rem_sets, uint max_reserved_regions) {
40
+ void G1FromCardCache::initialize (uint max_reserved_regions) {
39
41
guarantee (max_reserved_regions > 0 , " Heap size must be valid" );
40
42
guarantee (_cache == NULL , " Should not call this multiple times" );
41
43
42
44
_max_reserved_regions = max_reserved_regions;
43
45
#ifdef ASSERT
44
- _max_workers = num_par_rem_sets;
46
+ _max_workers = num_par_rem_sets () ;
45
47
#endif
46
48
_cache = Padded2DArray<uintptr_t , mtGC>::create_unfreeable (_max_reserved_regions,
47
- num_par_rem_sets,
49
+ num_par_rem_sets () ,
48
50
&_static_mem_size);
49
51
50
52
if (AlwaysPreTouch) {
@@ -59,7 +61,7 @@ void G1FromCardCache::invalidate(uint start_idx, size_t new_num_regions) {
59
61
uint end_idx = (start_idx + (uint )new_num_regions);
60
62
assert (end_idx <= _max_reserved_regions, " Must be within max." );
61
63
62
- for (uint i = 0 ; i < G1RemSet:: num_par_rem_sets (); i++) {
64
+ for (uint i = 0 ; i < num_par_rem_sets (); i++) {
63
65
for (uint j = start_idx; j < end_idx; j++) {
64
66
set (i, j, InvalidCard);
65
67
}
@@ -68,7 +70,7 @@ void G1FromCardCache::invalidate(uint start_idx, size_t new_num_regions) {
68
70
69
71
#ifndef PRODUCT
70
72
void G1FromCardCache::print (outputStream* out) {
71
- for (uint i = 0 ; i < G1RemSet:: num_par_rem_sets (); i++) {
73
+ for (uint i = 0 ; i < num_par_rem_sets (); i++) {
72
74
for (uint j = 0 ; j < _max_reserved_regions; j++) {
73
75
out->print_cr (" _from_card_cache[%u][%u] = " SIZE_FORMAT " ." ,
74
76
i, j, at (i, j));
@@ -77,8 +79,12 @@ void G1FromCardCache::print(outputStream* out) {
77
79
}
78
80
#endif
79
81
82
+ uint G1FromCardCache::num_par_rem_sets () {
83
+ return G1DirtyCardQueueSet::num_par_ids () + G1ConcurrentRefine::max_num_threads () + MAX2 (ConcGCThreads, ParallelGCThreads);
84
+ }
85
+
80
86
void G1FromCardCache::clear (uint region_idx) {
81
- uint num_par_remsets = G1RemSet:: num_par_rem_sets ();
87
+ uint num_par_remsets = num_par_rem_sets ();
82
88
for (uint i = 0 ; i < num_par_remsets; i++) {
83
89
set (i, region_idx, InvalidCard);
84
90
}
0 commit comments