72 /** Returns a subregion of the space containing all the objects in 73 the space. */ 74 public MemRegion usedRegion() { 75 return new MemRegion(bottom(), end()); 76 } 77 78 /** Support for iteration over heap -- not sure how this will 79 interact with GC in reflective system, but necessary for the 80 debugging mechanism */ 81 public OopHandle bottomAsOopHandle() { 82 return bottomField.getOopHandle(addr); 83 } 84 85 /** Support for iteration over heap -- not sure how this will 86 interact with GC in reflective system, but necessary for the 87 debugging mechanism */ 88 public OopHandle nextOopHandle(OopHandle handle, long size) { 89 return handle.addOffsetToAsOopHandle(size); 90 } 91 92 /** returns all MemRegions where live objects are */ 93 public abstract List/*<MemRegion>*/ getLiveRegions(); 94 95 /** Returned value is in bytes */ 96 public long capacity() { return end().minus(bottom()); } 97 /** Returned value is in bytes */ 98 public abstract long used(); 99 /** Returned value is in bytes */ 100 public abstract long free(); 101 102 /** Testers */ 103 public boolean contains(Address p) { 104 return (bottom().lessThanOrEqual(p) && end().greaterThan(p)); 105 } 106 107 public void print() { printOn(System.out); } 108 public void printOn(PrintStream tty) { 109 tty.print(" space capacity = "); 110 tty.print(capacity()); 111 tty.print(", "); 112 tty.print((double) used() * 100.0/ capacity()); 113 tty.print(" used"); 114 } | 72 /** Returns a subregion of the space containing all the objects in 73 the space. */ 74 public MemRegion usedRegion() { 75 return new MemRegion(bottom(), end()); 76 } 77 78 /** Support for iteration over heap -- not sure how this will 79 interact with GC in reflective system, but necessary for the 80 debugging mechanism */ 81 public OopHandle bottomAsOopHandle() { 82 return bottomField.getOopHandle(addr); 83 } 84 85 /** Support for iteration over heap -- not sure how this will 86 interact with GC in reflective system, but necessary for the 87 debugging mechanism */ 88 public OopHandle nextOopHandle(OopHandle handle, long size) { 89 return handle.addOffsetToAsOopHandle(size); 90 } 91 92 /** Returned value is in bytes */ 93 public long capacity() { return end().minus(bottom()); } 94 /** Returned value is in bytes */ 95 public abstract long used(); 96 /** Returned value is in bytes */ 97 public abstract long free(); 98 99 /** Testers */ 100 public boolean contains(Address p) { 101 return (bottom().lessThanOrEqual(p) && end().greaterThan(p)); 102 } 103 104 public void print() { printOn(System.out); } 105 public void printOn(PrintStream tty) { 106 tty.print(" space capacity = "); 107 tty.print(capacity()); 108 tty.print(", "); 109 tty.print((double) used() * 100.0/ capacity()); 110 tty.print(" used"); 111 } |