mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 03:54:33 +02:00
6687581: Make CMS work with compressed oops
Make FreeChunk read markword instead of LSB in _klass pointer to indicate that it's a FreeChunk for compressed oops. Reviewed-by: ysr, jmasa
This commit is contained in:
parent
4cce21039e
commit
a2d6036a4d
13 changed files with 315 additions and 160 deletions
|
@ -121,7 +121,7 @@ public class CompactibleFreeListSpace extends CompactibleSpace {
|
|||
cur = cur.addOffsetTo(adjustObjectSizeInBytes(size));
|
||||
}
|
||||
|
||||
if (FreeChunk.secondWordIndicatesFreeChunk(dbg.getAddressValue(klassOop))) {
|
||||
if (FreeChunk.indicatesFreeChunk(cur)) {
|
||||
if (! cur.equals(regionStart)) {
|
||||
res.add(new MemRegion(regionStart, cur));
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.*;
|
|||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
|
||||
public class FreeChunk extends VMObject {
|
||||
static {
|
||||
|
@ -42,13 +43,13 @@ public class FreeChunk extends VMObject {
|
|||
Type type = db.lookupType("FreeChunk");
|
||||
nextField = type.getAddressField("_next");
|
||||
prevField = type.getAddressField("_prev");
|
||||
sizeField = type.getCIntegerField("_size");
|
||||
sizeField = type.getAddressField("_size");
|
||||
}
|
||||
|
||||
// Fields
|
||||
private static AddressField nextField;
|
||||
private static AddressField prevField;
|
||||
private static CIntegerField sizeField;
|
||||
private static AddressField sizeField;
|
||||
|
||||
// Accessors
|
||||
public FreeChunk next() {
|
||||
|
@ -61,20 +62,34 @@ public class FreeChunk extends VMObject {
|
|||
}
|
||||
|
||||
public long size() {
|
||||
return sizeField.getValue(addr);
|
||||
if (VM.getVM().isCompressedOopsEnabled()) {
|
||||
Mark mark = new Mark(sizeField.getValue(addr));
|
||||
return mark.getSize();
|
||||
} else {
|
||||
Address size = sizeField.getValue(addr);
|
||||
Debugger dbg = VM.getVM().getDebugger();
|
||||
return dbg.getAddressValue(size);
|
||||
}
|
||||
}
|
||||
|
||||
public FreeChunk(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public static boolean secondWordIndicatesFreeChunk(long word) {
|
||||
return (word & 0x1L) == 0x1L;
|
||||
public static boolean indicatesFreeChunk(Address cur) {
|
||||
FreeChunk f = new FreeChunk(cur);
|
||||
return f.isFree();
|
||||
}
|
||||
|
||||
public boolean isFree() {
|
||||
Debugger dbg = VM.getVM().getDebugger();
|
||||
Address prev = prevField.getValue(addr);
|
||||
return secondWordIndicatesFreeChunk(dbg.getAddressValue(prev));
|
||||
if (VM.getVM().isCompressedOopsEnabled()) {
|
||||
Mark mark = new Mark(sizeField.getValue(addr));
|
||||
return mark.isCmsFreeChunk();
|
||||
} else {
|
||||
Address prev = prevField.getValue(addr);
|
||||
Debugger dbg = VM.getVM().getDebugger();
|
||||
long word = dbg.getAddressValue(prev);
|
||||
return (word & 0x1L) == 0x1L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,11 @@ public class Mark extends VMObject {
|
|||
noHashInPlace = db.lookupLongConstant("markOopDesc::no_hash_in_place").longValue();
|
||||
noLockInPlace = db.lookupLongConstant("markOopDesc::no_lock_in_place").longValue();
|
||||
maxAge = db.lookupLongConstant("markOopDesc::max_age").longValue();
|
||||
|
||||
/* Constants in markOop used by CMS. */
|
||||
cmsShift = db.lookupLongConstant("markOopDesc::cms_shift").longValue();
|
||||
cmsMask = db.lookupLongConstant("markOopDesc::cms_mask").longValue();
|
||||
sizeShift = db.lookupLongConstant("markOopDesc::size_shift").longValue();
|
||||
}
|
||||
|
||||
// Field accessors
|
||||
|
@ -120,6 +125,11 @@ public class Mark extends VMObject {
|
|||
|
||||
private static long maxAge;
|
||||
|
||||
/* Constants in markOop used by CMS. */
|
||||
private static long cmsShift;
|
||||
private static long cmsMask;
|
||||
private static long sizeShift;
|
||||
|
||||
public Mark(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
@ -290,4 +300,11 @@ public class Mark extends VMObject {
|
|||
//
|
||||
// // Recover address of oop from encoded form used in mark
|
||||
// inline void* decode_pointer() { return clear_lock_bits(); }
|
||||
|
||||
// Copy markOop methods for CMS here.
|
||||
public boolean isCmsFreeChunk() {
|
||||
return isUnlocked() &&
|
||||
(Bits.maskBitsLong(value() >> cmsShift, cmsMask) & 0x1L) == 0x1L;
|
||||
}
|
||||
public long getSize() { return (long)(value() >> sizeShift); }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue