Commit 538dacb8138d18eea2877ecd021c5494a9d20ffa
extracted heap iteration from getHeapStatistics() to allow reuse for other ObjectVisitors
git-svn-id: http://jnode.svn.sourceforge.net/svnroot/jnode/trunk@5660 407389f7-7c16-0410-9eee-ad85acb55d7f
| |   |
| 22 | 22 | |
| 23 | 23 | import java.io.PrintWriter; |
| 24 | 24 | |
| import org.jnode.annotation.Inline; |
| import org.jnode.annotation.MagicPermission; |
| 25 | 27 | import org.jnode.vm.MemoryBlockManager; |
| import org.jnode.vm.ObjectVisitor; |
| 26 | 29 | import org.jnode.vm.VmArchitecture; |
| 27 | 30 | import org.jnode.vm.VmMagic; |
| import org.jnode.annotation.Inline; |
| import org.jnode.annotation.MagicPermission; |
| 30 | 31 | import org.jnode.vm.classmgr.ObjectFlags; |
| 31 | 32 | import org.jnode.vm.classmgr.ObjectLayout; |
| 32 | 33 | import org.jnode.vm.classmgr.VmClassLoader; |
| … | … | |
| 452 | 452 | final HeapStatisticsVisitor heapStatisticsVisitor = new HeapStatisticsVisitor( |
| 453 | 453 | heapStatistics); |
| 454 | 454 | |
| accept(heapStatisticsVisitor, false); |
|
| return heapStatistics; |
| } |
| |
| private void accept(ObjectVisitor visitor, boolean locking) { |
| 455 | 461 | VmDefaultHeap heap = firstNormalHeap; |
| 456 | 462 | final Word zero = Word.zero(); |
| 457 | 463 | |
| 458 | 464 | while (heap != null) { |
| heap.walk(heapStatisticsVisitor, false, zero, zero); |
| heap.walk(visitor, locking, zero, zero); |
| 460 | 466 | heap = heap.getNext(); |
| 461 | 467 | } |
|
| return heapStatistics; |
| 464 | 468 | } |
|
| |
| 466 | 470 | /** |
| 467 | 471 | * @see org.jnode.vm.memmgr.VmHeapManager#createProcessorHeapData(org.jnode.vm.scheduler.VmProcessor) |
| 468 | 472 | */ |