hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java
Print this page
rev 611 : Merge
@@ -1,7 +1,7 @@
/*
- * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -45,11 +45,12 @@
}
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type type = db.lookupType("oopDesc");
mark = new CIntField(type.getCIntegerField("_mark"), 0);
- klass = new OopField(type.getOopField("_klass"), 0);
+ klass = new OopField(type.getOopField("_metadata._klass"), 0);
+ compressedKlass = new NarrowOopField(type.getOopField("_metadata._compressed_klass"), 0);
headerSize = type.getSize();
}
private OopHandle handle;
private ObjectHeap heap;
@@ -65,14 +66,15 @@
package; is needed, however, by {@link
sun.jvm.hotspot.utilities.MarkBits}. */
public OopHandle getHandle() { return handle; }
private static long headerSize;
- public static long getHeaderSize() { return headerSize; }
+ public static long getHeaderSize() { return headerSize; } // Header size in bytes.
private static CIntField mark;
private static OopField klass;
+ private static NarrowOopField compressedKlass;
public boolean isShared() {
return CompactingPermGenGen.isShared(handle);
}
@@ -84,11 +86,17 @@
return CompactingPermGenGen.isSharedReadWrite(handle);
}
// Accessors for declared fields
public Mark getMark() { return new Mark(getHandle()); }
- public Klass getKlass() { return (Klass) klass.getValue(this); }
+ public Klass getKlass() {
+ if (VM.getVM().isCompressedOopsEnabled()) {
+ return (Klass) compressedKlass.getValue(this);
+ } else {
+ return (Klass) klass.getValue(this);
+ }
+ }
public boolean isA(Klass k) {
return getKlass().isSubtypeOf(k);
}
@@ -118,11 +126,11 @@
public boolean isConstantPoolCache() { return false; }
public boolean isCompiledICHolder() { return false; }
// Align the object size.
public static long alignObjectSize(long size) {
- return VM.getVM().alignUp(size, VM.getVM().getMinObjAlignmentInBytes());
+ return VM.getVM().alignUp(size, VM.getVM().getMinObjAlignment());
}
// All vm's align longs, so pad out certain offsets.
public static long alignObjectOffset(long offset) {
return VM.getVM().alignUp(offset, VM.getVM().getBytesPerLong());
@@ -161,13 +169,17 @@
}
void iterateFields(OopVisitor visitor, boolean doVMFields) {
if (doVMFields) {
visitor.doCInt(mark, true);
+ if (VM.getVM().isCompressedOopsEnabled()) {
+ visitor.doOop(compressedKlass, true);
+ } else {
visitor.doOop(klass, true);
}
}
+ }
public void print() { printOn(System.out); }
public void printValue() { printValueOn(System.out); }
public void printRaw() { printRawOn(System.out); }
@@ -217,8 +229,12 @@
// Package-private routine to speed up ObjectHeap.newOop
static OopHandle getKlassForOopHandle(OopHandle handle) {
if (handle == null) {
return null;
}
+ if (VM.getVM().isCompressedOopsEnabled()) {
+ return handle.getCompOopHandleAt(compressedKlass.getOffset());
+ } else {
return handle.getOopHandleAt(klass.getOffset());
}
+ }
};