< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Instance.java

Print this page

38   static {
39     VM.registerVMInitializedObserver(new Observer() {
40         public void update(Observable o, Object data) {
41           initialize(VM.getVM().getTypeDataBase());
42         }
43       });
44   }
45   private static long typeSize;
46 
47   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
48     Type type = db.lookupType("instanceOopDesc");
49     typeSize = type.getSize();
50   }
51 
52   Instance(OopHandle handle, ObjectHeap heap) {
53     super(handle, heap);
54   }
55 
56   // Returns header size in bytes.
57   public static long getHeaderSize() {
58     if (VM.getVM().isCompressedKlassPointersEnabled()) {


59       return typeSize - VM.getVM().getIntSize();
60     } else {
61       return typeSize;
62     }
63   }
64 
65   public boolean isInstance()          { return true; }
66 
67   public void iterateFields(OopVisitor visitor, boolean doVMFields) {
68     super.iterateFields(visitor, doVMFields);
69     ((InstanceKlass) getKlass()).iterateNonStaticFields(visitor, this);
70   }
71 
72   public void printValueOn(PrintStream tty) {
73     // Special-case strings.
74     // FIXME: would like to do this in more type-safe fashion (need
75     // SystemDictionary analogue)
76     if (getKlass().getName().asString().equals("java/lang/String")) {
77       tty.print("\"" + OopUtilities.stringOopToString(this) + "\"");
78     } else {

38   static {
39     VM.registerVMInitializedObserver(new Observer() {
40         public void update(Observable o, Object data) {
41           initialize(VM.getVM().getTypeDataBase());
42         }
43       });
44   }
45   private static long typeSize;
46 
47   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
48     Type type = db.lookupType("instanceOopDesc");
49     typeSize = type.getSize();
50   }
51 
52   Instance(OopHandle handle, ObjectHeap heap) {
53     super(handle, heap);
54   }
55 
56   // Returns header size in bytes.
57   public static long getHeaderSize() {
58     if (VM.getVM().isCompactObjectHeadersEnabled()) {
59       return Oop.getHeaderSize();
60     } else if (VM.getVM().isCompressedKlassPointersEnabled()) {
61       return typeSize - VM.getVM().getIntSize();
62     } else {
63       return typeSize;
64     }
65   }
66 
67   public boolean isInstance()          { return true; }
68 
69   public void iterateFields(OopVisitor visitor, boolean doVMFields) {
70     super.iterateFields(visitor, doVMFields);
71     ((InstanceKlass) getKlass()).iterateNonStaticFields(visitor, this);
72   }
73 
74   public void printValueOn(PrintStream tty) {
75     // Special-case strings.
76     // FIXME: would like to do this in more type-safe fashion (need
77     // SystemDictionary analogue)
78     if (getKlass().getName().asString().equals("java/lang/String")) {
79       tty.print("\"" + OopUtilities.stringOopToString(this) + "\"");
80     } else {
< prev index next >