43 static {
44 VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
45 }
46
47 private static synchronized void initialize(TypeDataBase db) {
48 Type type = db.lookupType("ZHeap");
49
50 pageAllocatorFieldOffset = type.getAddressField("_page_allocator").getOffset();
51 pageTableFieldOffset = type.getAddressField("_pagetable").getOffset();
52 }
53
54 public ZHeap(Address addr) {
55 super(addr);
56 }
57
58 private ZPageAllocator pageAllocator() {
59 Address pageAllocatorAddr = addr.addOffsetTo(pageAllocatorFieldOffset);
60 return (ZPageAllocator)VMObjectFactory.newObject(ZPageAllocator.class, pageAllocatorAddr);
61 }
62
63 ZPageTable pageTable() {
64 return (ZPageTable)VMObjectFactory.newObject(ZPageTable.class, addr.addOffsetTo(pageTableFieldOffset));
65 }
66
67 public long maxCapacity() {
68 return pageAllocator().maxCapacity();
69 }
70
71 public long capacity() {
72 return pageAllocator().capacity();
73 }
74
75 public long used() {
76 return pageAllocator().used();
77 }
78
79 boolean is_relocating(Address o) {
80 return pageTable().is_relocating(o);
81 }
82
83 Address forward_object(Address addr) {
|
43 static {
44 VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
45 }
46
47 private static synchronized void initialize(TypeDataBase db) {
48 Type type = db.lookupType("ZHeap");
49
50 pageAllocatorFieldOffset = type.getAddressField("_page_allocator").getOffset();
51 pageTableFieldOffset = type.getAddressField("_pagetable").getOffset();
52 }
53
54 public ZHeap(Address addr) {
55 super(addr);
56 }
57
58 private ZPageAllocator pageAllocator() {
59 Address pageAllocatorAddr = addr.addOffsetTo(pageAllocatorFieldOffset);
60 return (ZPageAllocator)VMObjectFactory.newObject(ZPageAllocator.class, pageAllocatorAddr);
61 }
62
63 public ZPageTable pageTable() {
64 return (ZPageTable)VMObjectFactory.newObject(ZPageTable.class, addr.addOffsetTo(pageTableFieldOffset));
65 }
66
67 public long maxCapacity() {
68 return pageAllocator().maxCapacity();
69 }
70
71 public long capacity() {
72 return pageAllocator().capacity();
73 }
74
75 public long used() {
76 return pageAllocator().used();
77 }
78
79 boolean is_relocating(Address o) {
80 return pageTable().is_relocating(o);
81 }
82
83 Address forward_object(Address addr) {
|