hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
    38         public void update(Observable o, Object data) {
    38         public void update(Observable o, Object data) {
    39           initialize(VM.getVM().getTypeDataBase());
    39           initialize(VM.getVM().getTypeDataBase());
    40         }
    40         }
    41       });
    41       });
    42   }
    42   }
       
    43   private static long typeSize;
    43 
    44 
    44   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
    45   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
    45     Type type = db.lookupType("instanceOopDesc");
    46     Type type = db.lookupType("instanceOopDesc");
       
    47     typeSize = type.getSize();
    46   }
    48   }
    47 
    49 
    48   Instance(OopHandle handle, ObjectHeap heap) {
    50   Instance(OopHandle handle, ObjectHeap heap) {
    49     super(handle, heap);
    51     super(handle, heap);
       
    52   }
       
    53 
       
    54   // Returns header size in bytes.
       
    55   public static long getHeaderSize() {
       
    56     if (VM.getVM().isCompressedOopsEnabled()) {
       
    57       return typeSize - VM.getVM().getIntSize();
       
    58     } else {
       
    59       return typeSize;
       
    60     }
    50   }
    61   }
    51 
    62 
    52   public boolean isInstance()          { return true; }
    63   public boolean isInstance()          { return true; }
    53 
    64 
    54   public void iterateFields(OopVisitor visitor, boolean doVMFields) {
    65   public void iterateFields(OopVisitor visitor, boolean doVMFields) {