diff --git a/src/hotspot/share/gc/serial/defNewGeneration.hpp b/src/hotspot/share/gc/serial/defNewGeneration.hpp index 7d6cc1606db..d6ed965847e 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.hpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.hpp @@ -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; } diff --git a/src/hotspot/share/gc/serial/generation.hpp b/src/hotspot/share/gc/serial/generation.hpp index 09d40052ff1..fbe1bff6c9b 100644 --- a/src/hotspot/share/gc/serial/generation.hpp +++ b/src/hotspot/share/gc/serial/generation.hpp @@ -83,12 +83,6 @@ class Generation: public CHeapObj { 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. diff --git a/src/hotspot/share/gc/serial/serialHeap.hpp b/src/hotspot/share/gc/serial/serialHeap.hpp index 71880e7c771..d809ca1454b 100644 --- a/src/hotspot/share/gc/serial/serialHeap.hpp +++ b/src/hotspot/share/gc/serial/serialHeap.hpp @@ -364,13 +364,11 @@ public: GrowableArray memory_pools() override; DefNewGeneration* young_gen() const { - assert(_young_gen->kind() == Generation::DefNew, "Wrong generation type"); - return static_cast(_young_gen); + return _young_gen; } TenuredGeneration* old_gen() const { - assert(_old_gen->kind() == Generation::MarkSweepCompact, "Wrong generation type"); - return static_cast(_old_gen); + return _old_gen; } // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.hpp index c760608721a..55f07a717a3 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.hpp @@ -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"; } diff --git a/src/hotspot/share/gc/shared/vmStructs_gc.hpp b/src/hotspot/share/gc/shared/vmStructs_gc.hpp index 21437b3b5a3..69bb8c848e8 100644 --- a/src/hotspot/share/gc/shared/vmStructs_gc.hpp +++ b/src/hotspot/share/gc/shared/vmStructs_gc.hpp @@ -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) \ diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 54d591ff141..19db6f61e56 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -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) \ diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java index a41381af9b1..91a11345572 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java @@ -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)); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java index 49535c3c87c..6b73f0ec28d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java @@ -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"; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java index 01c85f0a0fc..77488063952 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java @@ -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(); }