8325860: Serial: Move Generation.java to serial folder
Reviewed-by: cjplummer, tschatzl
This commit is contained in:
parent
b718ae35a8
commit
2b1a840002
@ -32,6 +32,13 @@
|
||||
#define VM_STRUCTS_SERIALGC(nonstatic_field, \
|
||||
volatile_nonstatic_field, \
|
||||
static_field) \
|
||||
nonstatic_field(Generation, _reserved, MemRegion) \
|
||||
nonstatic_field(Generation, _virtual_space, VirtualSpace) \
|
||||
nonstatic_field(Generation, _stat_record, Generation::StatRecord) \
|
||||
\
|
||||
nonstatic_field(Generation::StatRecord, invocations, int) \
|
||||
nonstatic_field(Generation::StatRecord, accumulated_time, elapsedTimer) \
|
||||
\
|
||||
nonstatic_field(TenuredGeneration, _rs, CardTableRS*) \
|
||||
nonstatic_field(TenuredGeneration, _bts, SerialBlockOffsetSharedArray*) \
|
||||
nonstatic_field(TenuredGeneration, _shrink_factor, size_t) \
|
||||
@ -61,6 +68,8 @@
|
||||
#define VM_TYPES_SERIALGC(declare_type, \
|
||||
declare_toplevel_type, \
|
||||
declare_integer_type) \
|
||||
declare_toplevel_type(Generation) \
|
||||
declare_toplevel_type(Generation::StatRecord) \
|
||||
declare_type(SerialHeap, CollectedHeap) \
|
||||
declare_type(TenuredGeneration, Generation) \
|
||||
declare_type(TenuredSpace, ContiguousSpace) \
|
||||
@ -73,6 +82,8 @@
|
||||
declare_toplevel_type(SerialBlockOffsetTable)
|
||||
|
||||
#define VM_INT_CONSTANTS_SERIALGC(declare_constant, \
|
||||
declare_constant_with_value)
|
||||
declare_constant_with_value) \
|
||||
declare_constant(Generation::LogOfGenGrain) \
|
||||
declare_constant(Generation::GenGrain)
|
||||
|
||||
#endif // SHARE_GC_SERIAL_VMSTRUCTS_SERIAL_HPP
|
||||
|
@ -101,13 +101,6 @@
|
||||
nonstatic_field(ContiguousSpace, _top, HeapWord*) \
|
||||
nonstatic_field(ContiguousSpace, _saved_mark_word, HeapWord*) \
|
||||
\
|
||||
nonstatic_field(Generation, _reserved, MemRegion) \
|
||||
nonstatic_field(Generation, _virtual_space, VirtualSpace) \
|
||||
nonstatic_field(Generation, _stat_record, Generation::StatRecord) \
|
||||
\
|
||||
nonstatic_field(Generation::StatRecord, invocations, int) \
|
||||
nonstatic_field(Generation::StatRecord, accumulated_time, elapsedTimer) \
|
||||
\
|
||||
nonstatic_field(MemRegion, _start, HeapWord*) \
|
||||
nonstatic_field(MemRegion, _word_size, size_t) \
|
||||
\
|
||||
@ -142,7 +135,6 @@
|
||||
/******************************************/ \
|
||||
\
|
||||
declare_toplevel_type(CollectedHeap) \
|
||||
declare_toplevel_type(Generation) \
|
||||
declare_toplevel_type(Space) \
|
||||
declare_type(ContiguousSpace, Space) \
|
||||
declare_toplevel_type(BarrierSet) \
|
||||
@ -155,7 +147,6 @@
|
||||
\
|
||||
declare_toplevel_type(AgeTable) \
|
||||
declare_toplevel_type(CardTable::CardValue) \
|
||||
declare_toplevel_type(Generation::StatRecord) \
|
||||
declare_toplevel_type(HeapWord) \
|
||||
declare_toplevel_type(MemRegion) \
|
||||
declare_toplevel_type(ThreadLocalAllocBuffer) \
|
||||
@ -212,9 +203,6 @@
|
||||
declare_constant(CollectedHeap::Serial) \
|
||||
declare_constant(CollectedHeap::Parallel) \
|
||||
declare_constant(CollectedHeap::G1) \
|
||||
\
|
||||
declare_constant(Generation::LogOfGenGrain) \
|
||||
declare_constant(Generation::GenGrain) \
|
||||
|
||||
#define VM_LONG_CONSTANTS_GC(declare_constant) \
|
||||
ZGC_ONLY(VM_LONG_CONSTANTS_Z_SHARED(declare_constant))
|
||||
|
@ -1079,20 +1079,13 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
anno = "BAD OOP";
|
||||
if (collHeap instanceof SerialHeap) {
|
||||
SerialHeap heap = (SerialHeap) collHeap;
|
||||
for (int i = 0; i < heap.nGens(); i++) {
|
||||
if (heap.getGen(i).isIn(handle)) {
|
||||
if (i == 0) {
|
||||
anno = "NewGen ";
|
||||
} else if (i == 1) {
|
||||
anno = "OldGen ";
|
||||
} else {
|
||||
anno = "Gen " + i + " ";
|
||||
}
|
||||
bad = false;
|
||||
break;
|
||||
}
|
||||
if (heap.youngGen().isIn(handle)) {
|
||||
anno = "NewGen ";
|
||||
bad = false;
|
||||
} else if (heap.oldGen().isIn(handle)) {
|
||||
anno = "OldGen ";
|
||||
bad = false;
|
||||
}
|
||||
|
||||
} else if (collHeap instanceof G1CollectedHeap) {
|
||||
G1CollectedHeap heap = (G1CollectedHeap)collHeap;
|
||||
HeapRegion region = heap.hrm().getByAddress(handle);
|
||||
|
@ -84,12 +84,12 @@ public class DefNewGeneration extends Generation {
|
||||
return "default new generation";
|
||||
}
|
||||
|
||||
public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
|
||||
blk.doSpace(eden());
|
||||
blk.doSpace(from());
|
||||
if (!usedOnly) {
|
||||
blk.doSpace(to());
|
||||
}
|
||||
/* Returns "TRUE" iff "p" points into an allocated object in young
|
||||
generation. */
|
||||
public boolean isIn(Address p) {
|
||||
return eden().contains(p)
|
||||
|| from().contains(p)
|
||||
|| to().contains(p);
|
||||
}
|
||||
|
||||
public void liveRegionsIterate(LiveRegionsClosure closure) {
|
||||
|
@ -22,11 +22,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.gc.shared;
|
||||
package sun.jvm.hotspot.gc.serial;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.gc.shared.*;
|
||||
import sun.jvm.hotspot.memory.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
@ -105,14 +106,6 @@ public abstract class Generation extends VMObject {
|
||||
return reserved();
|
||||
}
|
||||
|
||||
/* Returns "TRUE" iff "p" points into an allocated object in the
|
||||
generation. */
|
||||
public boolean isIn(Address p) {
|
||||
GenerationIsInClosure blk = new GenerationIsInClosure(p);
|
||||
spaceIterate(blk);
|
||||
return (blk.space() != null);
|
||||
}
|
||||
|
||||
/** Returns "TRUE" iff "p" points into the reserved area of the
|
||||
generation. */
|
||||
public boolean isInReserved(Address p) {
|
||||
@ -125,13 +118,7 @@ public abstract class Generation extends VMObject {
|
||||
|
||||
public abstract String name();
|
||||
|
||||
/** Equivalent to spaceIterate(blk, false) */
|
||||
public void spaceIterate(SpaceClosure blk) {
|
||||
spaceIterate(blk, false);
|
||||
}
|
||||
|
||||
/** Iteration - do not use for time critical operations */
|
||||
public abstract void spaceIterate(SpaceClosure blk, boolean usedOnly);
|
||||
public abstract void liveRegionsIterate(LiveRegionsClosure closure);
|
||||
|
||||
public void print() { printOn(System.out); }
|
@ -28,6 +28,7 @@ import java.io.*;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.gc.shared.*;
|
||||
import sun.jvm.hotspot.memory.MemRegion;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
@ -64,68 +65,46 @@ public class SerialHeap extends CollectedHeap {
|
||||
genFactory = new GenerationFactory();
|
||||
}
|
||||
|
||||
public int nGens() {
|
||||
return 2; // Young + Old
|
||||
public DefNewGeneration youngGen() {
|
||||
return VMObjectFactory.newObject(DefNewGeneration.class, youngGenField.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.getValue(addr));
|
||||
case 1:
|
||||
return genFactory.newObject(oldGenField.getValue(addr));
|
||||
default:
|
||||
// no generation for i, and assertions disabled.
|
||||
return null;
|
||||
}
|
||||
public TenuredGeneration oldGen() {
|
||||
return VMObjectFactory.newObject(TenuredGeneration.class, oldGenField.getValue(addr));
|
||||
}
|
||||
|
||||
public boolean isIn(Address a) {
|
||||
for (int i = 0; i < nGens(); i++) {
|
||||
Generation gen = getGen(i);
|
||||
if (gen.isIn(a)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return youngGen().isIn(a) || oldGen().isIn(a);
|
||||
}
|
||||
|
||||
public long capacity() {
|
||||
long capacity = 0;
|
||||
for (int i = 0; i < nGens(); i++) {
|
||||
capacity += getGen(i).capacity();
|
||||
}
|
||||
capacity += youngGen().capacity();
|
||||
capacity += oldGen().capacity();
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public long used() {
|
||||
long used = 0;
|
||||
for (int i = 0; i < nGens(); i++) {
|
||||
used += getGen(i).used();
|
||||
}
|
||||
used += youngGen().used();
|
||||
used += oldGen().used();
|
||||
return used;
|
||||
}
|
||||
|
||||
public void liveRegionsIterate(LiveRegionsClosure closure) {
|
||||
// Run through all generations, obtaining bottom-top pairs.
|
||||
for (int i = 0; i < nGens(); i++) {
|
||||
Generation gen = getGen(i);
|
||||
gen.liveRegionsIterate(closure);
|
||||
}
|
||||
youngGen().liveRegionsIterate(closure);
|
||||
oldGen().liveRegionsIterate(closure);
|
||||
}
|
||||
|
||||
public void printOn(PrintStream tty) {
|
||||
for (int i = 0; i < nGens(); i++) {
|
||||
tty.print("Gen " + i + ": ");
|
||||
getGen(i).printOn(tty);
|
||||
tty.println("Invocations: " + getGen(i).invocations());
|
||||
tty.println();
|
||||
}
|
||||
tty.println("SerialHeap:");
|
||||
|
||||
tty.println("Young Generation - Invocations: " + youngGen().invocations());
|
||||
youngGen().printOn(tty);
|
||||
tty.println();
|
||||
|
||||
tty.println("Old Generation - Invocations: " + oldGen().invocations());
|
||||
oldGen().printOn(tty);
|
||||
tty.println();
|
||||
}
|
||||
}
|
||||
|
@ -74,10 +74,6 @@ public class TenuredGeneration extends Generation {
|
||||
public long free() { return theSpace().free(); }
|
||||
public long contiguousAvailable() { return theSpace().free() + virtualSpace().uncommittedSize(); }
|
||||
|
||||
public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
|
||||
blk.doSpace(theSpace());
|
||||
}
|
||||
|
||||
public void liveRegionsIterate(LiveRegionsClosure closure) {
|
||||
closure.doLiveRegions(theSpace());
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.gc.shared;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
/** Should only be used once */
|
||||
|
||||
class GenerationIsInClosure implements SpaceClosure {
|
||||
private Address p;
|
||||
private Space sp;
|
||||
|
||||
GenerationIsInClosure(Address p) {
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
public void doSpace(Space s) {
|
||||
if (s.contains(p)) {
|
||||
sp = s;
|
||||
}
|
||||
}
|
||||
|
||||
Space space() {
|
||||
return sp;
|
||||
}
|
||||
}
|
@ -95,27 +95,30 @@ public class HeapSummary extends Tool {
|
||||
|
||||
if (heap instanceof SerialHeap) {
|
||||
SerialHeap sh = (SerialHeap) heap;
|
||||
for (int n = 0; n < sh.nGens(); n++) {
|
||||
Generation gen = sh.getGen(n);
|
||||
if (gen instanceof DefNewGeneration) {
|
||||
System.out.println("New Generation (Eden + 1 Survivor Space):");
|
||||
printGen(gen);
|
||||
{
|
||||
// youngGen
|
||||
DefNewGeneration youngGen = sh.youngGen();
|
||||
|
||||
ContiguousSpace eden = ((DefNewGeneration)gen).eden();
|
||||
System.out.println("Eden Space:");
|
||||
printSpace(eden);
|
||||
System.out.println("New Generation (Eden + 1 Survivor Space):");
|
||||
printGen(youngGen);
|
||||
|
||||
ContiguousSpace from = ((DefNewGeneration)gen).from();
|
||||
System.out.println("From Space:");
|
||||
printSpace(from);
|
||||
ContiguousSpace eden = youngGen.eden();
|
||||
System.out.println("Eden Space:");
|
||||
printSpace(eden);
|
||||
|
||||
ContiguousSpace to = ((DefNewGeneration)gen).to();
|
||||
System.out.println("To Space:");
|
||||
printSpace(to);
|
||||
} else {
|
||||
System.out.println(gen.name() + ":");
|
||||
printGen(gen);
|
||||
}
|
||||
ContiguousSpace from = youngGen.from();
|
||||
System.out.println("From Space:");
|
||||
printSpace(from);
|
||||
|
||||
ContiguousSpace to = youngGen.to();
|
||||
System.out.println("To Space:");
|
||||
printSpace(to);
|
||||
}
|
||||
{
|
||||
// oldGen
|
||||
TenuredGeneration oldGen = sh.oldGen();
|
||||
System.out.println(oldGen.name() + ":");
|
||||
printGen(oldGen);
|
||||
}
|
||||
} else if (heap instanceof G1CollectedHeap) {
|
||||
printG1HeapSummary((G1CollectedHeap)heap);
|
||||
|
@ -106,12 +106,10 @@ public class PointerFinder {
|
||||
// If we are using the SerialHeap, find out which generation the address is in
|
||||
if (heap instanceof SerialHeap) {
|
||||
SerialHeap sh = (SerialHeap)heap;
|
||||
for (int i = 0; i < sh.nGens(); i++) {
|
||||
Generation g = sh.getGen(i);
|
||||
if (g.isIn(a)) {
|
||||
loc.gen = g;
|
||||
break;
|
||||
}
|
||||
if (sh.youngGen().isIn(a)) {
|
||||
loc.gen = sh.youngGen();
|
||||
} else if (sh.oldGen().isIn(a)) {
|
||||
loc.gen = sh.oldGen();
|
||||
}
|
||||
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
|
@ -113,11 +113,11 @@ public class PointerLocation {
|
||||
}
|
||||
|
||||
public boolean isInNewGen() {
|
||||
return ((gen != null) && (gen.equals(((SerialHeap)heap).getGen(0))));
|
||||
return ((gen != null) && (gen.equals(((SerialHeap)heap).youngGen())));
|
||||
}
|
||||
|
||||
public boolean isInOldGen() {
|
||||
return ((gen != null) && (gen.equals(((SerialHeap)heap).getGen(1))));
|
||||
return ((gen != null) && (gen.equals(((SerialHeap)heap).oldGen())));
|
||||
}
|
||||
|
||||
public boolean inOtherGen() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2024, 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
|
||||
@ -53,7 +53,8 @@ public class TestUniverse {
|
||||
|
||||
switch (gc) {
|
||||
case Serial:
|
||||
expStrings.add("Gen 1: old");
|
||||
expStrings.add("SerialHeap");
|
||||
expStrings.add("eden");
|
||||
break;
|
||||
|
||||
case Parallel:
|
||||
|
Loading…
x
Reference in New Issue
Block a user