61 }
62
63 void ageTable::clear() {
64 for (size_t* p = sizes; p < sizes + table_size; ++p) {
65 *p = 0;
66 }
67 }
68
69 void ageTable::merge(ageTable* subTable) {
70 for (int i = 0; i < table_size; i++) {
71 sizes[i]+= subTable->sizes[i];
72 }
73 }
74
75 uint ageTable::compute_tenuring_threshold(size_t survivor_capacity, GCPolicyCounters* gc_counters) {
76 size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
77 uint result;
78
79 if (AlwaysTenure || NeverTenure) {
80 assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
81 err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is " UINTX_FORMAT, MaxTenuringThreshold));
82 result = MaxTenuringThreshold;
83 } else {
84 size_t total = 0;
85 uint age = 1;
86 assert(sizes[0] == 0, "no objects with age zero should be recorded");
87 while (age < table_size) {
88 total += sizes[age];
89 // check if including objects of age 'age' made us pass the desired
90 // size, if so 'age' is the new threshold
91 if (total > desired_survivor_size) break;
92 age++;
93 }
94 result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
95 }
96
97 if (PrintTenuringDistribution || UsePerfData) {
98
99 if (PrintTenuringDistribution) {
100 gclog_or_tty->cr();
101 gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold "
|
61 }
62
63 void ageTable::clear() {
64 for (size_t* p = sizes; p < sizes + table_size; ++p) {
65 *p = 0;
66 }
67 }
68
69 void ageTable::merge(ageTable* subTable) {
70 for (int i = 0; i < table_size; i++) {
71 sizes[i]+= subTable->sizes[i];
72 }
73 }
74
75 uint ageTable::compute_tenuring_threshold(size_t survivor_capacity, GCPolicyCounters* gc_counters) {
76 size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
77 uint result;
78
79 if (AlwaysTenure || NeverTenure) {
80 assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
81 "MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is " UINTX_FORMAT, MaxTenuringThreshold);
82 result = MaxTenuringThreshold;
83 } else {
84 size_t total = 0;
85 uint age = 1;
86 assert(sizes[0] == 0, "no objects with age zero should be recorded");
87 while (age < table_size) {
88 total += sizes[age];
89 // check if including objects of age 'age' made us pass the desired
90 // size, if so 'age' is the new threshold
91 if (total > desired_survivor_size) break;
92 age++;
93 }
94 result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
95 }
96
97 if (PrintTenuringDistribution || UsePerfData) {
98
99 if (PrintTenuringDistribution) {
100 gclog_or_tty->cr();
101 gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold "
|