Mercurial > hg > truffle
annotate src/share/vm/services/memoryService.hpp @ 1721:413ad0331a0c
6977924: Changes for 6975078 produce build error with certain gcc versions
Summary: The changes introduced for 6975078 assign badHeapOopVal to the _allocation field in the ResourceObj class. In 32 bit linux builds with certain versions of gcc this assignment will be flagged as an error while compiling allocation.cpp. In 32 bit builds the constant value badHeapOopVal (which is cast to an intptr_t) is negative. The _allocation field is typed as an unsigned intptr_t and gcc catches this as an error.
Reviewed-by: jcoomes, ysr, phh
author | johnc |
---|---|
date | Wed, 18 Aug 2010 10:59:06 -0700 |
parents | f6f3eef8a521 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1089
diff
changeset
|
2 * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1089
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1089
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1089
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 // Forward declaration | |
26 class MemoryPool; | |
27 class MemoryManager; | |
28 class GCMemoryManager; | |
29 class CollectedHeap; | |
30 class Generation; | |
31 class DefNewGeneration; | |
32 class PSYoungGen; | |
33 class PSOldGen; | |
34 class PSPermGen; | |
35 class CodeHeap; | |
36 class ContiguousSpace; | |
37 class CompactibleFreeListSpace; | |
38 class PermanentGenerationSpec; | |
39 class GenCollectedHeap; | |
40 class ParallelScavengeHeap; | |
41 class CompactingPermGenGen; | |
42 class CMSPermGenGen; | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
43 class G1CollectedHeap; |
0 | 44 |
45 // VM Monitoring and Management Support | |
46 | |
47 class MemoryService : public AllStatic { | |
48 private: | |
49 enum { | |
50 init_pools_list_size = 10, | |
51 init_managers_list_size = 5 | |
52 }; | |
53 | |
54 // index for minor and major generations | |
55 enum { | |
56 minor = 0, | |
57 major = 1, | |
58 n_gens = 2 | |
59 }; | |
60 | |
61 static GrowableArray<MemoryPool*>* _pools_list; | |
62 static GrowableArray<MemoryManager*>* _managers_list; | |
63 | |
64 // memory managers for minor and major GC statistics | |
65 static GCMemoryManager* _major_gc_manager; | |
66 static GCMemoryManager* _minor_gc_manager; | |
67 | |
68 // Code heap memory pool | |
69 static MemoryPool* _code_heap_pool; | |
70 | |
71 static void add_generation_memory_pool(Generation* gen, | |
72 MemoryManager* major_mgr, | |
73 MemoryManager* minor_mgr); | |
74 static void add_generation_memory_pool(Generation* gen, | |
75 MemoryManager* major_mgr) { | |
76 add_generation_memory_pool(gen, major_mgr, NULL); | |
77 } | |
78 | |
79 static void add_compact_perm_gen_memory_pool(CompactingPermGenGen* perm_gen, | |
80 MemoryManager* mgr); | |
81 static void add_cms_perm_gen_memory_pool(CMSPermGenGen* perm_gen, | |
82 MemoryManager* mgr); | |
83 | |
84 static void add_psYoung_memory_pool(PSYoungGen* gen, | |
85 MemoryManager* major_mgr, | |
86 MemoryManager* minor_mgr); | |
87 static void add_psOld_memory_pool(PSOldGen* gen, | |
88 MemoryManager* mgr); | |
89 static void add_psPerm_memory_pool(PSPermGen* perm, | |
90 MemoryManager* mgr); | |
91 | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
92 static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
93 MemoryManager* major_mgr, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
94 MemoryManager* minor_mgr); |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
95 static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
96 MemoryManager* mgr); |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
97 static void add_g1PermGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
98 MemoryManager* mgr); |
0 | 99 |
100 static MemoryPool* add_space(ContiguousSpace* space, | |
101 const char* name, | |
102 bool is_heap, | |
103 size_t max_size, | |
104 bool support_usage_threshold); | |
105 static MemoryPool* add_survivor_spaces(DefNewGeneration* gen, | |
106 const char* name, | |
107 bool is_heap, | |
108 size_t max_size, | |
109 bool support_usage_threshold); | |
110 static MemoryPool* add_gen(Generation* gen, | |
111 const char* name, | |
112 bool is_heap, | |
113 bool support_usage_threshold); | |
114 static MemoryPool* add_cms_space(CompactibleFreeListSpace* space, | |
115 const char* name, | |
116 bool is_heap, | |
117 size_t max_size, | |
118 bool support_usage_threshold); | |
119 | |
120 static void add_gen_collected_heap_info(GenCollectedHeap* heap); | |
121 static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap); | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
122 static void add_g1_heap_info(G1CollectedHeap* g1h); |
0 | 123 |
124 public: | |
125 static void set_universe_heap(CollectedHeap* heap); | |
126 static void add_code_heap_memory_pool(CodeHeap* heap); | |
127 | |
128 static MemoryPool* get_memory_pool(instanceHandle pool); | |
129 static MemoryManager* get_memory_manager(instanceHandle mgr); | |
130 | |
131 static const int num_memory_pools() { | |
132 return _pools_list->length(); | |
133 } | |
134 static const int num_memory_managers() { | |
135 return _managers_list->length(); | |
136 } | |
137 | |
138 static MemoryPool* get_memory_pool(int index) { | |
139 return _pools_list->at(index); | |
140 } | |
141 | |
142 static MemoryManager* get_memory_manager(int index) { | |
143 return _managers_list->at(index); | |
144 } | |
145 | |
146 static void track_memory_usage(); | |
147 static void track_code_cache_memory_usage() { | |
148 track_memory_pool_usage(_code_heap_pool); | |
149 } | |
150 static void track_memory_pool_usage(MemoryPool* pool); | |
151 | |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
152 static void gc_begin(bool fullGC, bool recordGCBeginTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
153 bool recordAccumulatedGCTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
154 bool recordPreGCUsage, bool recordPeakUsage); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
155 static void gc_end(bool fullGC, bool recordPostGCUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
156 bool recordAccumulatedGCTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
157 bool recordGCEndTime, bool countCollection); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
158 |
0 | 159 |
160 static void oops_do(OopClosure* f); | |
161 | |
162 static bool get_verbose() { return PrintGC; } | |
163 static bool set_verbose(bool verbose); | |
164 | |
165 // Create an instance of java/lang/management/MemoryUsage | |
166 static Handle create_MemoryUsage_obj(MemoryUsage usage, TRAPS); | |
167 }; | |
168 | |
169 class TraceMemoryManagerStats : public StackObj { | |
170 private: | |
171 bool _fullGC; | |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
172 bool _recordGCBeginTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
173 bool _recordPreGCUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
174 bool _recordPeakUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
175 bool _recordPostGCUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
176 bool _recordAccumulatedGCTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
177 bool _recordGCEndTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
178 bool _countCollection; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
179 |
0 | 180 public: |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
181 TraceMemoryManagerStats() {} |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
182 TraceMemoryManagerStats(bool fullGC, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
183 bool recordGCBeginTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
184 bool recordPreGCUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
185 bool recordPeakUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
186 bool recordPostGCUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
187 bool recordAccumulatedGCTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
188 bool recordGCEndTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
189 bool countCollection = true); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
190 |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
191 void initialize(bool fullGC, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
192 bool recordGCBeginTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
193 bool recordPreGCUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
194 bool recordPeakUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
195 bool recordPostGCUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
196 bool recordAccumulatedGCTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
197 bool recordGCEndTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
198 bool countCollection); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
199 |
0 | 200 TraceMemoryManagerStats(Generation::Name kind); |
201 ~TraceMemoryManagerStats(); | |
202 }; |