equal
deleted
inserted
replaced
39 import sun.jvm.hotspot.types.*; |
39 import sun.jvm.hotspot.types.*; |
40 import sun.jvm.hotspot.utilities.*; |
40 import sun.jvm.hotspot.utilities.*; |
41 |
41 |
42 public class ObjectHeap { |
42 public class ObjectHeap { |
43 |
43 |
|
44 private static final boolean DEBUG; |
|
45 |
|
46 static { |
|
47 DEBUG = System.getProperty("sun.jvm.hotspot.oops.ObjectHeap.DEBUG") != null; |
|
48 } |
|
49 |
44 private OopHandle symbolKlassHandle; |
50 private OopHandle symbolKlassHandle; |
45 private OopHandle methodKlassHandle; |
51 private OopHandle methodKlassHandle; |
46 private OopHandle constMethodKlassHandle; |
52 private OopHandle constMethodKlassHandle; |
47 private OopHandle methodDataKlassHandle; |
53 private OopHandle methodDataKlassHandle; |
48 private OopHandle constantPoolKlassHandle; |
54 private OopHandle constantPoolKlassHandle; |
150 } |
156 } |
151 } |
157 } |
152 |
158 |
153 public ObjectHeap(TypeDataBase db) throws WrongTypeException { |
159 public ObjectHeap(TypeDataBase db) throws WrongTypeException { |
154 // Get commonly used sizes of basic types |
160 // Get commonly used sizes of basic types |
155 oopSize = db.getOopSize(); |
161 oopSize = VM.getVM().getOopSize(); |
156 byteSize = db.getJByteType().getSize(); |
162 byteSize = db.getJByteType().getSize(); |
157 charSize = db.getJCharType().getSize(); |
163 charSize = db.getJCharType().getSize(); |
158 booleanSize = db.getJBooleanType().getSize(); |
164 booleanSize = db.getJBooleanType().getSize(); |
159 intSize = db.getJIntType().getSize(); |
165 intSize = db.getJIntType().getSize(); |
160 shortSize = db.getJShortType().getSize(); |
166 shortSize = db.getJShortType().getSize(); |
438 Address top = (Address) liveRegions.get(i+1); |
444 Address top = (Address) liveRegions.get(i+1); |
439 |
445 |
440 try { |
446 try { |
441 // Traverses the space from bottom to top |
447 // Traverses the space from bottom to top |
442 OopHandle handle = bottom.addOffsetToAsOopHandle(0); |
448 OopHandle handle = bottom.addOffsetToAsOopHandle(0); |
|
449 |
443 while (handle.lessThan(top)) { |
450 while (handle.lessThan(top)) { |
444 Oop obj = null; |
451 Oop obj = null; |
445 |
452 |
446 try { |
453 try { |
447 obj = newOop(handle); |
454 obj = newOop(handle); |
448 } catch (UnknownOopException exp) { |
455 } catch (UnknownOopException exp) { |
|
456 if (DEBUG) { |
|
457 throw new RuntimeException(" UnknownOopException " + exp); |
|
458 } |
449 } |
459 } |
450 if (obj == null) { |
460 if (obj == null) { |
451 //Find the object size using Printezis bits and skip over |
461 //Find the object size using Printezis bits and skip over |
452 System.err.println("Finding object size using Printezis bits and skipping over..."); |
462 System.err.println("Finding object size using Printezis bits and skipping over..."); |
453 long size = 0; |
463 long size = 0; |