< prev index next > src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Oop.java
Print this page
}
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type type = db.lookupType("oopDesc");
mark = new CIntField(type.getCIntegerField("_mark"), 0);
! klass = new MetadataField(type.getAddressField("_metadata._klass"), 0);
! compressedKlass = new NarrowKlassField(type.getAddressField("_metadata._compressed_klass"), 0);
! headerSize = type.getSize();
}
private OopHandle handle;
private ObjectHeap heap;
}
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type type = db.lookupType("oopDesc");
mark = new CIntField(type.getCIntegerField("_mark"), 0);
! if (VM.getVM().isCompactObjectHeadersEnabled()) {
! Type markType = db.lookupType("markWord");
! headerSize = markType.getSize();
+ } else {
+ headerSize = type.getSize();
+ klass = new MetadataField(type.getAddressField("_metadata._klass"), 0);
+ compressedKlass = new NarrowKlassField(type.getAddressField("_metadata._compressed_klass"), 0);
+ }
}
private OopHandle handle;
private ObjectHeap heap;
private static MetadataField klass;
private static NarrowKlassField compressedKlass;
// Accessors for declared fields
public Mark getMark() { return new Mark(getHandle()); }
public Klass getKlass() {
! if (VM.getVM().isCompressedKlassPointersEnabled()) {
return (Klass)compressedKlass.getValue(getHandle());
} else {
return (Klass)klass.getValue(getHandle());
}
}
private static MetadataField klass;
private static NarrowKlassField compressedKlass;
// Accessors for declared fields
public Mark getMark() { return new Mark(getHandle()); }
+
+ private static Klass getKlass(Mark mark) {
+ assert(VM.getVM().isCompactObjectHeadersEnabled());
+ if (mark.hasMonitor()) {
+ ObjectMonitor mon = mark.monitor();
+ mark = mon.header();
+ }
+ return mark.getKlass();
+ }
+
public Klass getKlass() {
! if (VM.getVM().isCompactObjectHeadersEnabled()) {
+ assert(VM.getVM().isCompressedKlassPointersEnabled());
+ return getKlass(getMark());
+ } else if (VM.getVM().isCompressedKlassPointersEnabled()) {
return (Klass)compressedKlass.getValue(getHandle());
} else {
return (Klass)klass.getValue(getHandle());
}
}
}
void iterateFields(OopVisitor visitor, boolean doVMFields) {
if (doVMFields) {
visitor.doCInt(mark, true);
! if (VM.getVM().isCompressedKlassPointersEnabled()) {
! visitor.doMetadata(compressedKlass, true);
! } else {
! visitor.doMetadata(klass, true);
}
}
}
public void print() { printOn(System.out); }
}
void iterateFields(OopVisitor visitor, boolean doVMFields) {
if (doVMFields) {
visitor.doCInt(mark, true);
! if (!VM.getVM().isCompactObjectHeadersEnabled()) {
! if (VM.getVM().isCompressedKlassPointersEnabled()) {
! visitor.doMetadata(compressedKlass, true);
! } else {
+ visitor.doMetadata(klass, true);
+ }
}
}
}
public void print() { printOn(System.out); }
public static Klass getKlassForOopHandle(OopHandle handle) {
if (handle == null) {
return null;
}
! if (VM.getVM().isCompressedKlassPointersEnabled()) {
return (Klass)Metadata.instantiateWrapperFor(handle.getCompKlassAddressAt(compressedKlass.getOffset()));
} else {
return (Klass)Metadata.instantiateWrapperFor(handle.getAddressAt(klass.getOffset()));
}
}
public static Klass getKlassForOopHandle(OopHandle handle) {
if (handle == null) {
return null;
}
! if (VM.getVM().isCompactObjectHeadersEnabled()) {
+ Mark mark = new Mark(handle);
+ return getKlass(mark);
+ } else if (VM.getVM().isCompressedKlassPointersEnabled()) {
return (Klass)Metadata.instantiateWrapperFor(handle.getCompKlassAddressAt(compressedKlass.getOffset()));
} else {
return (Klass)Metadata.instantiateWrapperFor(handle.getAddressAt(klass.getOffset()));
}
}
< prev index next >