45 Type type = db.lookupType("MutableSpace"); 46 topField = type.getAddressField("_top"); 47 } 48 49 public MutableSpace(Address addr) { 50 super(addr); 51 } 52 53 // Fields 54 private static AddressField topField; 55 56 // Accessors 57 public Address top() { return topField.getValue(addr); } 58 59 /** In bytes */ 60 public long used() { 61 return top().minus(bottom()); 62 } 63 64 /** returns all MemRegions where live objects are */ 65 public List/*<MemRegion>*/ getLiveRegions() { 66 List res = new ArrayList(); 67 res.add(new MemRegion(bottom(), top())); 68 return res; 69 } 70 71 public void printOn(PrintStream tty) { 72 tty.print(" [" + bottom() + "," + 73 top() + "," + end() + "] "); 74 } 75 } | 45 Type type = db.lookupType("MutableSpace"); 46 topField = type.getAddressField("_top"); 47 } 48 49 public MutableSpace(Address addr) { 50 super(addr); 51 } 52 53 // Fields 54 private static AddressField topField; 55 56 // Accessors 57 public Address top() { return topField.getValue(addr); } 58 59 /** In bytes */ 60 public long used() { 61 return top().minus(bottom()); 62 } 63 64 /** returns all MemRegions where live objects are */ 65 public List<MemRegion> getLiveRegions() { 66 List<MemRegion> res = new ArrayList<>(); 67 res.add(new MemRegion(bottom(), top())); 68 return res; 69 } 70 71 public void printOn(PrintStream tty) { 72 tty.print(" [" + bottom() + "," + 73 top() + "," + end() + "] "); 74 } 75 } |