Mercurial > hg > truffle
comparison src/share/vm/services/memSnapshot.cpp @ 6646:c38f13903fdf
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ just before the NPG (no perm gen) changeset
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 29 Oct 2012 21:10:04 +0100 |
parents | e5bf1c79ed5b |
children | 33143ee07800 |
comparison
equal
deleted
inserted
replaced
6590:dc5eec61daba | 6646:c38f13903fdf |
---|---|
336 vm_itr.insert(cur_vm); | 336 vm_itr.insert(cur_vm); |
337 } else { | 337 } else { |
338 vm_itr.insert_after(cur_vm); | 338 vm_itr.insert_after(cur_vm); |
339 } | 339 } |
340 } else { | 340 } else { |
341 #ifdef ASSERT | |
342 // In theory, we should assert without conditions. However, in case of native | 341 // In theory, we should assert without conditions. However, in case of native |
343 // thread stack, NMT explicitly releases the thread stack in Thread's destructor, | 342 // thread stack, NMT explicitly releases the thread stack in Thread's destructor, |
344 // due to platform dependent behaviors. On some platforms, we see uncommit/release | 343 // due to platform dependent behaviors. On some platforms, we see uncommit/release |
345 // native thread stack, but some, we don't. | 344 // native thread stack, but some, we don't. |
346 if (!cur_vm->is_uncommit_record() && !cur_vm->is_deallocation_record()) { | 345 assert(cur_vm->is_uncommit_record() || cur_vm->is_deallocation_record(), |
347 ShouldNotReachHere(); | 346 err_msg("Should not reach here, pointer addr = [" INTPTR_FORMAT "], flags = [%x]", |
348 } | 347 cur_vm->addr(), cur_vm->flags())); |
349 #endif | |
350 } | 348 } |
351 } | 349 } |
352 } else { | 350 } else { |
353 MemPointerRecord* cur_p = (MemPointerRecord*)cur; | 351 MemPointerRecord* cur_p = (MemPointerRecord*)cur; |
354 MemPointerRecord* p = (MemPointerRecord*)malloc_itr.locate(cur->addr()); | 352 MemPointerRecord* p = (MemPointerRecord*)malloc_itr.locate(cur->addr()); |
404 _staging_area->shrink(); | 402 _staging_area->shrink(); |
405 _staging_area->clear(); | 403 _staging_area->clear(); |
406 } | 404 } |
407 | 405 |
408 | 406 |
409 #ifdef ASSERT | 407 #ifndef PRODUCT |
410 void MemSnapshot::print_snapshot_stats(outputStream* st) { | 408 void MemSnapshot::print_snapshot_stats(outputStream* st) { |
411 st->print_cr("Snapshot:"); | 409 st->print_cr("Snapshot:"); |
412 st->print_cr("\tMalloced: %d/%d [%5.2f%%] %dKB", _alloc_ptrs->length(), _alloc_ptrs->capacity(), | 410 st->print_cr("\tMalloced: %d/%d [%5.2f%%] %dKB", _alloc_ptrs->length(), _alloc_ptrs->capacity(), |
413 (100.0 * (float)_alloc_ptrs->length()) / (float)_alloc_ptrs->capacity(), _alloc_ptrs->instance_size()/K); | 411 (100.0 * (float)_alloc_ptrs->length()) / (float)_alloc_ptrs->capacity(), _alloc_ptrs->instance_size()/K); |
414 | 412 |
432 prev = p; | 430 prev = p; |
433 p = (MemPointerRecord*)mItr.next(); | 431 p = (MemPointerRecord*)mItr.next(); |
434 } | 432 } |
435 } | 433 } |
436 | 434 |
435 bool MemSnapshot::has_allocation_record(address addr) { | |
436 MemPointerArrayIteratorImpl itr(_staging_area); | |
437 MemPointerRecord* cur = (MemPointerRecord*)itr.current(); | |
438 while (cur != NULL) { | |
439 if (cur->addr() == addr && cur->is_allocation_record()) { | |
440 return true; | |
441 } | |
442 cur = (MemPointerRecord*)itr.next(); | |
443 } | |
444 return false; | |
445 } | |
446 #endif // PRODUCT | |
447 | |
448 #ifdef ASSERT | |
437 void MemSnapshot::check_staging_data() { | 449 void MemSnapshot::check_staging_data() { |
438 MemPointerArrayIteratorImpl itr(_staging_area); | 450 MemPointerArrayIteratorImpl itr(_staging_area); |
439 MemPointerRecord* cur = (MemPointerRecord*)itr.current(); | 451 MemPointerRecord* cur = (MemPointerRecord*)itr.current(); |
440 MemPointerRecord* next = (MemPointerRecord*)itr.next(); | 452 MemPointerRecord* next = (MemPointerRecord*)itr.next(); |
441 while (next != NULL) { | 453 while (next != NULL) { |
445 "sorting order"); | 457 "sorting order"); |
446 cur = next; | 458 cur = next; |
447 next = (MemPointerRecord*)itr.next(); | 459 next = (MemPointerRecord*)itr.next(); |
448 } | 460 } |
449 } | 461 } |
450 | 462 #endif // ASSERT |
451 bool MemSnapshot::has_allocation_record(address addr) { | 463 |
452 MemPointerArrayIteratorImpl itr(_staging_area); | |
453 MemPointerRecord* cur = (MemPointerRecord*)itr.current(); | |
454 while (cur != NULL) { | |
455 if (cur->addr() == addr && cur->is_allocation_record()) { | |
456 return true; | |
457 } | |
458 cur = (MemPointerRecord*)itr.next(); | |
459 } | |
460 return false; | |
461 } | |
462 | |
463 #endif |