< prev index next >
agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java
Print this page
rev 7696 : 8061802: REDO - Remove the generations array
Summary: The _gens array is removed and replaced by explicit _young_gen and _old_gen variables.
Reviewed-by:
*** 33,43 ****
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 GenerationFactory genFactory;
static {
--- 33,44 ----
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.utilities.*;
public class GenCollectedHeap extends SharedHeap {
private static CIntegerField nGensField;
! private static AddressField youngGenField;
! private static AddressField oldGenField;
private static AddressField genSpecsField;
private static GenerationFactory genFactory;
static {
*** 50,60 ****
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");
genFactory = new GenerationFactory();
}
--- 51,62 ----
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("GenCollectedHeap");
nGensField = type.getCIntegerField("_n_gens");
! youngGenField = type.getAddressField("_young_gen");
! oldGenField = type.getAddressField("_old_gen");
genSpecsField = type.getAddressField("_gen_specs");
genFactory = new GenerationFactory();
}
*** 70,87 ****
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())) {
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);
--- 72,90 ----
if (Assert.ASSERTS_ENABLED) {
Assert.that((i >= 0) && (i < nGens()), "Index " + i +
" out of range (should be between 0 and " + 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;
}
}
public boolean isIn(Address a) {
for (int i = 0; i < nGens(); i++) {
Generation gen = getGen(i);
< prev index next >