agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java Fri Oct 17 16:28:29 2014
--- new/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java Fri Oct 17 16:28:29 2014
*** 32,44 ****
--- 32,46 ----
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.utilities.*;
public class GenCollectedHeap extends SharedHeap {
! private static CIntegerField nGensField;
! private static long gensOffset;
private static AddressField genSpecsField;
! private static AddressField youngGenField;
! private static AddressField oldGenField;
+
+ private static AddressField youngGenSpecField;
+ private static AddressField oldGenSpecField;
private static GenerationFactory genFactory;
static {
VM.registerVMInitializedObserver(new Observer() {
*** 49,87 ****
--- 51,93 ----
}
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("GenCollectedHeap");
! nGensField = type.getCIntegerField("_n_gens");
! gensOffset = type.getField("_gens").getOffset();
genSpecsField = type.getAddressField("_gen_specs");
! youngGenField = type.getAddressField("_young_gen");
! oldGenField = type.getAddressField("_old_gen");
genFactory = new GenerationFactory();
+
+ Type colPolType = db.lookupType("GenCollectorPolicy");
+ youngGenSpecField = colPolType.getAddressField("_young_gen_spec");
+ oldGenSpecField = colPolType.getAddressField("_old_gen_spec");
}
public GenCollectedHeap(Address addr) {
super(addr);
}
public int nGens() {
! return (int) nGensField.getValue(addr);
! return 2;
}
public Generation getGen(int i) {
if (Assert.ASSERTS_ENABLED) {
Assert.that((i >= 0) && (i < nGens()), "Index " + i +
" out of range (should be between 0 and " + nGens() + ")");
}
! if ((i < 0) || (i >= nGens())) {
! switch (i) {
+ case 0:
+ return genFactory.newObject(youngGenField.getAddress());
+ case 1:
+ return genFactory.newObject(oldGenField.getAddress());
+ default:
+ // no generation for i, and assertions disabled.
return null;
}
Address genAddr = addr.getAddressAt(gensOffset +
(i * VM.getVM().getAddressSize()));
return genFactory.newObject(addr.getAddressAt(gensOffset +
(i * VM.getVM().getAddressSize())));
}
public boolean isIn(Address a) {
for (int i = 0; i < nGens(); i++) {
Generation gen = getGen(i);
*** 118,134 ****
--- 124,142 ----
if ((level < 0) || (level >= nGens())) {
return null;
}
Address ptrList = genSpecsField.getValue(addr);
if (ptrList == null) {
return null;
}
+ if (level == 0) {
+ return (GenerationSpec)
+ VMObjectFactory.newObject(GenerationSpec.class,
+ youngGenSpecField.getAddress());
+ } else {
return (GenerationSpec)
VMObjectFactory.newObject(GenerationSpec.class,
! ptrList.getAddressAt(level * VM.getVM().getAddressSize()));
! oldGenSpecField.getAddress());
+ }
}
public CollectedHeapName kind() {
return CollectedHeapName.GEN_COLLECTED_HEAP;
}
agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File