< prev index next >
agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2000, 2012, Oracle and/or its affiliates. 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.
--- 1,7 ----
/*
! * Copyright (c) 2000, 2015, Oracle and/or its affiliates. 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.
*** 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();
}
*** 66,87 ****
return (int) nGensField.getValue(addr);
}
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())) {
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);
--- 68,90 ----
return (int) nGensField.getValue(addr);
}
public Generation getGen(int i) {
if (Assert.ASSERTS_ENABLED) {
! Assert.that((i == 0) || (i == 1), "Index " + i +
! " out of range (should be 0 or 1)");
}
! 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 >