comparison src/share/vm/gc_implementation/shared/ageTable.cpp @ 6818:22b8d3d181d9

8000351: Tenuring threshold should be unsigned Summary: Change the flags and variables related to tenuring threshold to be unsigned Reviewed-by: jmasa, johnc
author jwilhelm
date Wed, 03 Oct 2012 20:31:41 +0200
parents f95d63e2154a
children 203f64878aab
comparison
equal deleted inserted replaced
6817:f81a7c0c618d 6818:22b8d3d181d9
76 for (int i = 0; i < table_size; i++) { 76 for (int i = 0; i < table_size; i++) {
77 Atomic::add_ptr(subTable->sizes[i], &sizes[i]); 77 Atomic::add_ptr(subTable->sizes[i], &sizes[i]);
78 } 78 }
79 } 79 }
80 80
81 int ageTable::compute_tenuring_threshold(size_t survivor_capacity) { 81 uint ageTable::compute_tenuring_threshold(size_t survivor_capacity) {
82 size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100); 82 size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
83 size_t total = 0; 83 size_t total = 0;
84 int age = 1; 84 uint age = 1;
85 assert(sizes[0] == 0, "no objects with age zero should be recorded"); 85 assert(sizes[0] == 0, "no objects with age zero should be recorded");
86 while (age < table_size) { 86 while (age < table_size) {
87 total += sizes[age]; 87 total += sizes[age];
88 // check if including objects of age 'age' made us pass the desired 88 // check if including objects of age 'age' made us pass the desired
89 // size, if so 'age' is the new threshold 89 // size, if so 'age' is the new threshold
90 if (total > desired_survivor_size) break; 90 if (total > desired_survivor_size) break;
91 age++; 91 age++;
92 } 92 }
93 int result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold; 93 uint result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
94 94
95 if (PrintTenuringDistribution || UsePerfData) { 95 if (PrintTenuringDistribution || UsePerfData) {
96 96
97 if (PrintTenuringDistribution) { 97 if (PrintTenuringDistribution) {
98 gclog_or_tty->cr(); 98 gclog_or_tty->cr();
99 gclog_or_tty->print_cr("Desired survivor size %ld bytes, new threshold %d (max %d)", 99 gclog_or_tty->print_cr("Desired survivor size %ld bytes, new threshold %u (max %u)",
100 desired_survivor_size*oopSize, result, MaxTenuringThreshold); 100 desired_survivor_size*oopSize, result, MaxTenuringThreshold);
101 } 101 }
102 102
103 total = 0; 103 total = 0;
104 age = 1; 104 age = 1;
105 while (age < table_size) { 105 while (age < table_size) {
106 total += sizes[age]; 106 total += sizes[age];
107 if (sizes[age] > 0) { 107 if (sizes[age] > 0) {
108 if (PrintTenuringDistribution) { 108 if (PrintTenuringDistribution) {
109 gclog_or_tty->print_cr("- age %3d: %10ld bytes, %10ld total", 109 gclog_or_tty->print_cr("- age %3u: %10ld bytes, %10ld total",
110 age, sizes[age]*oopSize, total*oopSize); 110 age, sizes[age]*oopSize, total*oopSize);
111 } 111 }
112 } 112 }
113 if (UsePerfData) { 113 if (UsePerfData) {
114 _perf_sizes[age]->set_value(sizes[age]*oopSize); 114 _perf_sizes[age]->set_value(sizes[age]*oopSize);