comparison src/share/vm/services/g1MemoryPool.cpp @ 1094:9118860519b6

6904967: G1: some CollectionUsageThreshold tests fail Summary: ensure that max and committed are non-zero (currently: at least as large as the region size). Reviewed-by: iveresov, mchung
author tonyp
date Mon, 07 Dec 2009 14:22:34 -0500
parents afc30fccf324
children 1316cec51b4d
comparison
equal deleted inserted replaced
1093:afc30fccf324 1094:9118860519b6
38 assert(UseG1GC, "sanity"); 38 assert(UseG1GC, "sanity");
39 } 39 }
40 40
41 // See the comment at the top of g1MemoryPool.hpp 41 // See the comment at the top of g1MemoryPool.hpp
42 size_t G1MemoryPoolSuper::eden_space_committed(G1CollectedHeap* g1h) { 42 size_t G1MemoryPoolSuper::eden_space_committed(G1CollectedHeap* g1h) {
43 return eden_space_used(g1h); 43 return MAX2(eden_space_used(g1h), (size_t) HeapRegion::GrainBytes);
44 } 44 }
45 45
46 // See the comment at the top of g1MemoryPool.hpp 46 // See the comment at the top of g1MemoryPool.hpp
47 size_t G1MemoryPoolSuper::eden_space_used(G1CollectedHeap* g1h) { 47 size_t G1MemoryPoolSuper::eden_space_used(G1CollectedHeap* g1h) {
48 size_t young_list_length = g1h->young_list_length(); 48 size_t young_list_length = g1h->young_list_length();
52 return eden_used; 52 return eden_used;
53 } 53 }
54 54
55 // See the comment at the top of g1MemoryPool.hpp 55 // See the comment at the top of g1MemoryPool.hpp
56 size_t G1MemoryPoolSuper::eden_space_max(G1CollectedHeap* g1h) { 56 size_t G1MemoryPoolSuper::eden_space_max(G1CollectedHeap* g1h) {
57 // This should ensure that it returns a value no smaller than the
58 // region size. Currently, eden_space_committed() guarantees that.
57 return eden_space_committed(g1h); 59 return eden_space_committed(g1h);
58 } 60 }
59 61
60 // See the comment at the top of g1MemoryPool.hpp 62 // See the comment at the top of g1MemoryPool.hpp
61 size_t G1MemoryPoolSuper::survivor_space_committed(G1CollectedHeap* g1h) { 63 size_t G1MemoryPoolSuper::survivor_space_committed(G1CollectedHeap* g1h) {
62 return survivor_space_used(g1h); 64 return MAX2(survivor_space_used(g1h), (size_t) HeapRegion::GrainBytes);
63 } 65 }
64 66
65 // See the comment at the top of g1MemoryPool.hpp 67 // See the comment at the top of g1MemoryPool.hpp
66 size_t G1MemoryPoolSuper::survivor_space_used(G1CollectedHeap* g1h) { 68 size_t G1MemoryPoolSuper::survivor_space_used(G1CollectedHeap* g1h) {
67 size_t survivor_num = g1h->g1_policy()->recorded_survivor_regions(); 69 size_t survivor_num = g1h->g1_policy()->recorded_survivor_regions();
69 return survivor_used; 71 return survivor_used;
70 } 72 }
71 73
72 // See the comment at the top of g1MemoryPool.hpp 74 // See the comment at the top of g1MemoryPool.hpp
73 size_t G1MemoryPoolSuper::survivor_space_max(G1CollectedHeap* g1h) { 75 size_t G1MemoryPoolSuper::survivor_space_max(G1CollectedHeap* g1h) {
76 // This should ensure that it returns a value no smaller than the
77 // region size. Currently, survivor_space_committed() guarantees that.
74 return survivor_space_committed(g1h); 78 return survivor_space_committed(g1h);
75 } 79 }
76 80
77 // See the comment at the top of g1MemoryPool.hpp 81 // See the comment at the top of g1MemoryPool.hpp
78 size_t G1MemoryPoolSuper::old_space_committed(G1CollectedHeap* g1h) { 82 size_t G1MemoryPoolSuper::old_space_committed(G1CollectedHeap* g1h) {
79 size_t committed = overall_committed(g1h); 83 size_t committed = overall_committed(g1h);
80 size_t eden_committed = eden_space_committed(g1h); 84 size_t eden_committed = eden_space_committed(g1h);
81 size_t survivor_committed = survivor_space_committed(g1h); 85 size_t survivor_committed = survivor_space_committed(g1h);
82 committed = subtract_up_to_zero(committed, eden_committed); 86 committed = subtract_up_to_zero(committed, eden_committed);
83 committed = subtract_up_to_zero(committed, survivor_committed); 87 committed = subtract_up_to_zero(committed, survivor_committed);
88 committed = MAX2(committed, (size_t) HeapRegion::GrainBytes);
84 return committed; 89 return committed;
85 } 90 }
86 91
87 // See the comment at the top of g1MemoryPool.hpp 92 // See the comment at the top of g1MemoryPool.hpp
88 size_t G1MemoryPoolSuper::old_space_used(G1CollectedHeap* g1h) { 93 size_t G1MemoryPoolSuper::old_space_used(G1CollectedHeap* g1h) {
99 size_t max = overall_max(g1h); 104 size_t max = overall_max(g1h);
100 size_t eden_max = eden_space_max(g1h); 105 size_t eden_max = eden_space_max(g1h);
101 size_t survivor_max = survivor_space_max(g1h); 106 size_t survivor_max = survivor_space_max(g1h);
102 max = subtract_up_to_zero(max, eden_max); 107 max = subtract_up_to_zero(max, eden_max);
103 max = subtract_up_to_zero(max, survivor_max); 108 max = subtract_up_to_zero(max, survivor_max);
109 max = MAX2(max, (size_t) HeapRegion::GrainBytes);
104 return max; 110 return max;
105 } 111 }
106 112
107 G1EdenPool::G1EdenPool(G1CollectedHeap* g1h) : 113 G1EdenPool::G1EdenPool(G1CollectedHeap* g1h) :
108 G1MemoryPoolSuper(g1h, 114 G1MemoryPoolSuper(g1h,