comparison src/share/vm/services/memTracker.hpp @ 6741:33143ee07800

7181995: NMT ON: NMT assertion failure assert(cur_vm->is_uncommit_record() || cur_vm->is_deallocation_record Summary: Fixed virtual memory records merge and promotion logic, should be based on sequence number vs. base address order Reviewed-by: coleenp, acorn
author zgu
date Tue, 11 Sep 2012 20:53:17 -0400
parents 4acebbe310e1
children 716e6ef4482a
comparison
equal deleted inserted replaced
6730:5d2156bcb78b 6741:33143ee07800
37 37
38 #ifdef SOLARIS 38 #ifdef SOLARIS
39 #include "thread_solaris.inline.hpp" 39 #include "thread_solaris.inline.hpp"
40 #endif 40 #endif
41 41
42 #ifdef _DEBUG_ 42 #ifdef _DEBUG
43 #define DEBUG_CALLER_PC os::get_caller_pc(3) 43 #define DEBUG_CALLER_PC os::get_caller_pc(3)
44 #else 44 #else
45 #define DEBUG_CALLER_PC 0 45 #define DEBUG_CALLER_PC 0
46 #endif 46 #endif
47 47
221 create_memory_record(addr, MemPointerRecord::virtual_memory_reserve_tag(), 221 create_memory_record(addr, MemPointerRecord::virtual_memory_reserve_tag(),
222 size, pc, thread); 222 size, pc, thread);
223 } 223 }
224 } 224 }
225 225
226 static inline void record_thread_stack(address addr, size_t size, Thread* thr,
227 address pc = 0) {
228 if (is_on()) {
229 assert(size > 0 && thr != NULL, "Sanity check");
230 create_memory_record(addr, MemPointerRecord::virtual_memory_reserve_tag() | mtThreadStack,
231 size, pc, thr);
232 create_memory_record(addr, MemPointerRecord::virtual_memory_commit_tag() | mtThreadStack,
233 size, pc, thr);
234 }
235 }
236
237 static inline void release_thread_stack(address addr, size_t size, Thread* thr) {
238 if (is_on()) {
239 assert(size > 0 && thr != NULL, "Sanity check");
240 create_memory_record(addr, MemPointerRecord::virtual_memory_uncommit_tag() | mtThreadStack,
241 size, DEBUG_CALLER_PC, thr);
242 create_memory_record(addr, MemPointerRecord::virtual_memory_release_tag() | mtThreadStack,
243 size, DEBUG_CALLER_PC, thr);
244 }
245 }
246
226 // record a virtual memory 'commit' call 247 // record a virtual memory 'commit' call
227 static inline void record_virtual_memory_commit(address addr, size_t size, 248 static inline void record_virtual_memory_commit(address addr, size_t size,
228 address pc = 0, Thread* thread = NULL) { 249 address pc = 0, Thread* thread = NULL) {
229 if (is_on()) { 250 if (is_on()) {
230 create_memory_record(addr, MemPointerRecord::virtual_memory_commit_tag(), 251 create_memory_record(addr, MemPointerRecord::virtual_memory_commit_tag(),
231 size, pc, thread); 252 size, DEBUG_CALLER_PC, thread);
232 } 253 }
233 } 254 }
234 255
235 // record a virtual memory 'uncommit' call 256 // record a virtual memory 'uncommit' call
236 static inline void record_virtual_memory_uncommit(address addr, size_t size, 257 static inline void record_virtual_memory_uncommit(address addr, size_t size,
237 Thread* thread = NULL) { 258 Thread* thread = NULL) {
238 if (is_on()) { 259 if (is_on()) {
239 create_memory_record(addr, MemPointerRecord::virtual_memory_uncommit_tag(), 260 create_memory_record(addr, MemPointerRecord::virtual_memory_uncommit_tag(),
240 size, 0, thread); 261 size, DEBUG_CALLER_PC, thread);
241 } 262 }
242 } 263 }
243 264
244 // record a virtual memory 'release' call 265 // record a virtual memory 'release' call
245 static inline void record_virtual_memory_release(address addr, size_t size, 266 static inline void record_virtual_memory_release(address addr, size_t size,
246 Thread* thread = NULL) { 267 Thread* thread = NULL) {
247 if (is_on()) { 268 if (is_on()) {
248 create_memory_record(addr, MemPointerRecord::virtual_memory_release_tag(), 269 create_memory_record(addr, MemPointerRecord::virtual_memory_release_tag(),
249 size, 0, thread); 270 size, DEBUG_CALLER_PC, thread);
250 } 271 }
251 } 272 }
252 273
253 // record memory type on virtual memory base address 274 // record memory type on virtual memory base address
254 static inline void record_virtual_memory_type(address base, MEMFLAGS flags, 275 static inline void record_virtual_memory_type(address base, MEMFLAGS flags,
255 Thread* thread = NULL) { 276 Thread* thread = NULL) {
256 if (is_on()) { 277 if (is_on()) {
257 assert(base > 0, "wrong base address"); 278 assert(base > 0, "wrong base address");
258 assert((flags & (~mt_masks)) == 0, "memory type only"); 279 assert((flags & (~mt_masks)) == 0, "memory type only");
259 create_memory_record(base, (flags | MemPointerRecord::virtual_memory_type_tag()), 280 create_memory_record(base, (flags | MemPointerRecord::virtual_memory_type_tag()),
260 0, 0, thread); 281 0, DEBUG_CALLER_PC, thread);
261 } 282 }
262 } 283 }
263 284
264 285
265 // create memory baseline of current memory snapshot 286 // create memory baseline of current memory snapshot