8324512: Serial: Remove Generation::Name

Reviewed-by: stefank, iwalulya, cjplummer
This commit is contained in:
Albert Mingkun Yang 2024-01-24 10:02:28 +00:00
parent b65e5eb14e
commit 1c1cb048cd
9 changed files with 8 additions and 72 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -159,8 +159,6 @@ class DefNewGeneration: public Generation {
size_t max_byte_size,
const char* policy="Serial young collection pauses");
virtual Generation::Name kind() { return Generation::DefNew; }
// allocate and initialize ("weak") refs processing support
void ref_processor_init();
ReferenceProcessor* ref_processor() { return _ref_processor; }

View File

@ -83,12 +83,6 @@ class Generation: public CHeapObj<mtGC> {
Generation(ReservedSpace rs, size_t initial_byte_size);
public:
// The set of possible generation kinds.
enum Name {
DefNew,
MarkSweepCompact,
};
enum SomePublicConstants {
// Generations are GenGrain-aligned and have size that are multiples of
// GenGrain.

View File

@ -364,13 +364,11 @@ public:
GrowableArray<MemoryPool*> memory_pools() override;
DefNewGeneration* young_gen() const {
assert(_young_gen->kind() == Generation::DefNew, "Wrong generation type");
return static_cast<DefNewGeneration*>(_young_gen);
return _young_gen;
}
TenuredGeneration* old_gen() const {
assert(_old_gen->kind() == Generation::MarkSweepCompact, "Wrong generation type");
return static_cast<TenuredGeneration*>(_old_gen);
return _old_gen;
}
// Apply "cur->do_oop" or "older->do_oop" to all the oops in objects

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -107,8 +107,6 @@ class TenuredGeneration: public Generation {
size_t max_byte_size,
CardTableRS* remset);
Generation::Name kind() { return Generation::MarkSweepCompact; }
// Printing
const char* name() const { return "tenured generation"; }
const char* short_name() const { return "Tenured"; }

View File

@ -213,11 +213,6 @@
declare_constant(CollectedHeap::Parallel) \
declare_constant(CollectedHeap::G1) \
\
/* constants from Generation::Name enum */ \
\
declare_constant(Generation::DefNew) \
declare_constant(Generation::MarkSweepCompact) \
\
declare_constant(Generation::LogOfGenGrain) \
declare_constant(Generation::GenGrain) \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -1884,7 +1884,6 @@
/* all enum types */ \
\
declare_integer_type(Bytecodes::Code) \
declare_integer_type(Generation::Name) \
declare_integer_type(InstanceKlass::ClassState) \
declare_integer_type(JavaThreadState) \
declare_integer_type(ThreadState) \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -62,10 +62,6 @@ public class DefNewGeneration extends Generation {
super(addr);
}
public Generation.Name kind() {
return Generation.Name.DEF_NEW;
}
// Accessing spaces
public ContiguousSpace eden() {
return VMObjectFactory.newObject(ContiguousSpace.class, edenSpaceField.getValue(addr));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -87,10 +87,6 @@ public class TenuredGeneration extends Generation {
theSpace().printOn(tty);
}
public Generation.Name kind() {
return Generation.Name.MARK_SWEEP_COMPACT;
}
public String name() {
return "tenured generation";
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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,11 +53,6 @@ public abstract class Generation extends VMObject {
private static Field statRecordField;
private static CIntegerField invocationField;
// constants from Name enum
private static int NAME_DEF_NEW;
private static int NAME_PAR_NEW;
private static int NAME_MARK_SWEEP_COMPACT;
static {
VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) {
@ -75,45 +70,12 @@ public abstract class Generation extends VMObject {
statRecordField = type.getField("_stat_record");
type = db.lookupType("Generation::StatRecord");
invocationField = type.getCIntegerField("invocations");
// constants from Generation::Name
NAME_DEF_NEW = db.lookupIntConstant("Generation::DefNew").intValue();
NAME_MARK_SWEEP_COMPACT = db.lookupIntConstant("Generation::MarkSweepCompact").intValue();
}
public Generation(Address addr) {
super(addr);
}
public static class Name {
public static final Name DEF_NEW = new Name("DefNew");
public static final Name MARK_SWEEP_COMPACT = new Name("MarkSweepCompact");
public static final Name OTHER = new Name("Other");
private Name(String value) {
this.value = value;
}
private String value;
public String toString() {
return value;
}
}
public Generation.Name kind() {
return Generation.Name.OTHER;
}
static Generation.Name nameForEnum(int value) {
if (value == NAME_DEF_NEW) {
return Name.DEF_NEW;
} else if (value == NAME_MARK_SWEEP_COMPACT) {
return Name.MARK_SWEEP_COMPACT;
} else {
throw new RuntimeException("should not reach here");
}
}
public int invocations() {
return getStatRecord().getInvocations();
}