50
50
* notion of progress is clear: we get reported the "used" size from the processed regions
51
51
* and use the global heap-used as the baseline.
52
52
*
53
- * The allocatable space when GC is running is "free" at the start of cycle , but the
53
+ * The allocatable space when GC is running is "free" at the start of phase , but the
54
54
* accounted budget is based on "used". So, we need to adjust the tax knowing that.
55
- * Also, since we effectively count the used space three times (mark, evac, update-refs),
56
- * we need to multiply the tax by 3. Example: for 10 MB free and 90 MB used, GC would
57
- * come back with 3*90 MB budget, and thus for each 1 MB of allocation, we have to pay
58
- * 3*90 / 10 MBs. In the end, we would pay back the entire budget.
59
55
*/
60
56
61
57
void ShenandoahPacer::setup_for_mark () {
@@ -68,7 +64,7 @@ void ShenandoahPacer::setup_for_mark() {
68
64
size_t taxable = free - non_taxable;
69
65
70
66
double tax = 1.0 * live / taxable; // base tax for available free space
71
- tax *= 3 ; // mark is phase 1 of 3 , claim 1/3 of free for it
67
+ tax *= 1 ; // mark can succeed with immediate garbage , claim all available space
72
68
tax *= ShenandoahPacingSurcharge; // additional surcharge to help unclutter heap
73
69
74
70
restart_with (non_taxable, tax);
@@ -91,7 +87,7 @@ void ShenandoahPacer::setup_for_evac() {
91
87
size_t taxable = free - non_taxable;
92
88
93
89
double tax = 1.0 * used / taxable; // base tax for available free space
94
- tax *= 2 ; // evac is phase 2 of 3 , claim 1/2 of remaining free
90
+ tax *= 2 ; // evac is followed by update-refs , claim 1/2 of remaining free
95
91
tax = MAX2<double >(1 , tax); // never allocate more than GC processes during the phase
96
92
tax *= ShenandoahPacingSurcharge; // additional surcharge to help unclutter heap
97
93
@@ -115,7 +111,7 @@ void ShenandoahPacer::setup_for_updaterefs() {
115
111
size_t taxable = free - non_taxable;
116
112
117
113
double tax = 1.0 * used / taxable; // base tax for available free space
118
- tax *= 1 ; // update-refs is phase 3 of 3 , claim the remaining free
114
+ tax *= 1 ; // update-refs is the last phase , claim the remaining free
119
115
tax = MAX2<double >(1 , tax); // never allocate more than GC processes during the phase
120
116
tax *= ShenandoahPacingSurcharge; // additional surcharge to help unclutter heap
121
117
0 commit comments