diff --git a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp index ca7f2b37398..92a342ec757 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp @@ -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 @@ -27,7 +27,7 @@ #include "gc/g1/g1CollectionSetCandidates.hpp" #include "gc/g1/g1CollectionSetChooser.hpp" #include "gc/g1/g1HeapRegionRemSet.inline.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "runtime/atomic.hpp" #include "utilities/quickSort.hpp" diff --git a/src/hotspot/share/gc/serial/cardTableRS.cpp b/src/hotspot/share/gc/serial/cardTableRS.cpp index 2ed384f124f..1c1781e280e 100644 --- a/src/hotspot/share/gc/serial/cardTableRS.cpp +++ b/src/hotspot/share/gc/serial/cardTableRS.cpp @@ -27,7 +27,7 @@ #include "gc/serial/cardTableRS.hpp" #include "gc/serial/generation.hpp" #include "gc/serial/serialHeap.inline.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "memory/iterator.inline.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/gc/serial/cardTableRS.hpp b/src/hotspot/share/gc/serial/cardTableRS.hpp index ee4ac31bf5f..b4231dbc4c7 100644 --- a/src/hotspot/share/gc/serial/cardTableRS.hpp +++ b/src/hotspot/share/gc/serial/cardTableRS.hpp @@ -31,7 +31,6 @@ class OldGenScanClosure; class TenuredGeneration; -class TenuredSpace; // This RemSet uses a card table both as shared data structure // for a mod ref barrier set and for the rem set information. diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index b0641c7d69f..43c8be36148 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -42,7 +42,7 @@ #include "gc/shared/preservedMarks.inline.hpp" #include "gc/shared/referencePolicy.hpp" #include "gc/shared/referenceProcessorPhaseTimes.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "gc/shared/spaceDecorator.inline.hpp" #include "gc/shared/strongRootsScope.hpp" #include "gc/shared/weakProcessor.hpp" diff --git a/src/hotspot/share/gc/serial/generation.cpp b/src/hotspot/share/gc/serial/generation.cpp index c1c195aaf38..da5a54367f0 100644 --- a/src/hotspot/share/gc/serial/generation.cpp +++ b/src/hotspot/share/gc/serial/generation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -30,7 +30,7 @@ #include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "gc/shared/spaceDecorator.inline.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/gc/serial/generation.hpp b/src/hotspot/share/gc/serial/generation.hpp index 70978f35879..c1a88a64b2a 100644 --- a/src/hotspot/share/gc/serial/generation.hpp +++ b/src/hotspot/share/gc/serial/generation.hpp @@ -27,7 +27,7 @@ #include "gc/shared/collectorCounters.hpp" #include "gc/shared/referenceProcessor.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "logging/log.hpp" #include "memory/allocation.hpp" #include "memory/memRegion.hpp" diff --git a/src/hotspot/share/gc/serial/serialFullGC.cpp b/src/hotspot/share/gc/serial/serialFullGC.cpp index 88284fd63c0..514a6e6ab74 100644 --- a/src/hotspot/share/gc/serial/serialFullGC.cpp +++ b/src/hotspot/share/gc/serial/serialFullGC.cpp @@ -52,7 +52,7 @@ #include "gc/shared/preservedMarks.inline.hpp" #include "gc/shared/referencePolicy.hpp" #include "gc/shared/referenceProcessorPhaseTimes.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "gc/shared/strongRootsScope.hpp" #include "gc/shared/weakProcessor.hpp" #include "memory/iterator.inline.hpp" diff --git a/src/hotspot/share/gc/serial/serialHeap.inline.hpp b/src/hotspot/share/gc/serial/serialHeap.inline.hpp index 3279f24881e..d43f95cddcf 100644 --- a/src/hotspot/share/gc/serial/serialHeap.inline.hpp +++ b/src/hotspot/share/gc/serial/serialHeap.inline.hpp @@ -28,6 +28,7 @@ #include "gc/serial/serialHeap.hpp" #include "gc/serial/tenuredGeneration.inline.hpp" +#include "oops/oop.inline.hpp" class ScavengeHelper { DefNewGeneration* _young_gen; diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index 3e9dde0942d..35dc84773aa 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -33,6 +33,7 @@ #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/space.hpp" +#include "gc/shared/spaceDecorator.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "oops/oop.inline.hpp" @@ -316,7 +317,8 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs, _used_at_prologue = 0; HeapWord* bottom = (HeapWord*) _virtual_space.low(); HeapWord* end = (HeapWord*) _virtual_space.high(); - _the_space = new TenuredSpace(_bts, MemRegion(bottom, end)); + _the_space = new ContiguousSpace(); + _the_space->initialize(MemRegion(bottom, end), SpaceDecorator::Clear, SpaceDecorator::Mangle); // If we don't shrink the heap in steps, '_shrink_factor' is always 100%. _shrink_factor = ShrinkHeapInSteps ? 0 : 100; _capacity_at_prologue = 0; @@ -495,7 +497,6 @@ void TenuredGeneration::object_iterate(ObjectClosure* blk) { void TenuredGeneration::complete_loaded_archive_space(MemRegion archive_space) { // Create the BOT for the archive space. - TenuredSpace* space = _the_space; HeapWord* start = archive_space.start(); while (start < archive_space.end()) { size_t word_size = cast_to_oop(start)->size();; diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.hpp index bb34ad8d2c2..cc83f129b68 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.hpp @@ -65,7 +65,7 @@ class TenuredGeneration: public Generation { void assert_correct_size_change_locking(); - TenuredSpace* _the_space; // Actual space holding objects + ContiguousSpace* _the_space; // Actual space holding objects HeapWord* _saved_mark_word; GenerationCounters* _gen_counters; @@ -88,7 +88,7 @@ class TenuredGeneration: public Generation { public: void compute_new_size(); - TenuredSpace* space() const { return _the_space; } + ContiguousSpace* space() const { return _the_space; } HeapWord* saved_mark_word() const { return _saved_mark_word; } // Grow generation with specified size (returns false if unable to grow) diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp index 253a72d3c28..955f7b395dd 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp @@ -27,7 +27,7 @@ #include "gc/serial/tenuredGeneration.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" inline size_t TenuredGeneration::capacity() const { return space()->capacity(); @@ -50,15 +50,23 @@ inline void TenuredGeneration::update_for_block(HeapWord* start, HeapWord* end) } HeapWord* TenuredGeneration::allocate(size_t word_size, - bool is_tlab) { + bool is_tlab) { assert(!is_tlab, "TenuredGeneration does not support TLAB allocation"); - return _the_space->allocate(word_size); + HeapWord* res = _the_space->allocate(word_size); + if (res != nullptr) { + _bts->update_for_block(res, res + word_size); + } + return res; } HeapWord* TenuredGeneration::par_allocate(size_t word_size, - bool is_tlab) { + bool is_tlab) { assert(!is_tlab, "TenuredGeneration does not support TLAB allocation"); - return _the_space->par_allocate(word_size); + HeapWord* res = _the_space->par_allocate(word_size); + if (res != nullptr) { + _bts->update_for_block(res, res + word_size); + } + return res; } #endif // SHARE_GC_SERIAL_TENUREDGENERATION_INLINE_HPP diff --git a/src/hotspot/share/gc/serial/vmStructs_serial.hpp b/src/hotspot/share/gc/serial/vmStructs_serial.hpp index d1e29a42632..e5ce220195c 100644 --- a/src/hotspot/share/gc/serial/vmStructs_serial.hpp +++ b/src/hotspot/share/gc/serial/vmStructs_serial.hpp @@ -47,7 +47,7 @@ nonstatic_field(TenuredGeneration, _capacity_at_prologue, size_t) \ nonstatic_field(TenuredGeneration, _used_at_prologue, size_t) \ nonstatic_field(TenuredGeneration, _min_heap_delta_bytes, size_t) \ - nonstatic_field(TenuredGeneration, _the_space, TenuredSpace*) \ + nonstatic_field(TenuredGeneration, _the_space, ContiguousSpace*) \ \ nonstatic_field(DefNewGeneration, _old_gen, TenuredGeneration*) \ nonstatic_field(DefNewGeneration, _tenuring_threshold, uint) \ @@ -60,8 +60,6 @@ nonstatic_field(SerialBlockOffsetTable, _vs, VirtualSpace) \ nonstatic_field(SerialBlockOffsetTable, _offset_base, u_char*) \ \ - nonstatic_field(TenuredSpace, _offsets, SerialBlockOffsetTable*) \ - \ nonstatic_field(SerialHeap, _young_gen, DefNewGeneration*) \ nonstatic_field(SerialHeap, _old_gen, TenuredGeneration*) \ @@ -72,7 +70,6 @@ declare_toplevel_type(Generation::StatRecord) \ declare_type(SerialHeap, CollectedHeap) \ declare_type(TenuredGeneration, Generation) \ - declare_type(TenuredSpace, ContiguousSpace) \ \ declare_type(DefNewGeneration, Generation) \ declare_type(CardTableRS, CardTable) \ diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index 1095defaf9f..95f7058f4e4 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -27,7 +27,7 @@ #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/gc_globals.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "logging/log.hpp" #include "memory/virtualspace.hpp" #include "nmt/memTracker.hpp" diff --git a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp index 1d4c4775b33..1277cd99293 100644 --- a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp +++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp @@ -28,7 +28,7 @@ #include "gc/shared/cardTableBarrierSet.inline.hpp" #include "gc/shared/cardTableBarrierSetAssembler.hpp" #include "gc/shared/collectedHeap.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "logging/log.hpp" #include "memory/virtualspace.hpp" #include "nmt/memTracker.hpp" diff --git a/src/hotspot/share/gc/shared/space.cpp b/src/hotspot/share/gc/shared/space.cpp index e1ef2e984e2..43e4a03ca11 100644 --- a/src/hotspot/share/gc/shared/space.cpp +++ b/src/hotspot/share/gc/shared/space.cpp @@ -27,7 +27,6 @@ #include "classfile/vmSymbols.hpp" #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/space.hpp" -#include "gc/shared/space.inline.hpp" #include "gc/shared/spaceDecorator.inline.hpp" #include "memory/iterator.inline.hpp" #include "memory/universe.hpp" @@ -168,12 +167,3 @@ HeapWord* ContiguousSpace::allocate(size_t size) { HeapWord* ContiguousSpace::par_allocate(size_t size) { return par_allocate_impl(size); } - -#if INCLUDE_SERIALGC -TenuredSpace::TenuredSpace(SerialBlockOffsetTable* offsets, - MemRegion mr) : - _offsets(offsets) -{ - initialize(mr, SpaceDecorator::Clear, SpaceDecorator::Mangle); -} -#endif // INCLUDE_SERIALGC diff --git a/src/hotspot/share/gc/shared/space.hpp b/src/hotspot/share/gc/shared/space.hpp index 3b30a557f3c..23715ccd9dc 100644 --- a/src/hotspot/share/gc/shared/space.hpp +++ b/src/hotspot/share/gc/shared/space.hpp @@ -161,25 +161,4 @@ public: void verify() const; }; -#if INCLUDE_SERIALGC - -// Class TenuredSpace is used by TenuredGeneration; it supports an efficient -// "block_start" operation via a SerialBlockOffsetTable. - -class TenuredSpace: public ContiguousSpace { - friend class VMStructs; - protected: - SerialBlockOffsetTable* _offsets; - - public: - // Constructor - TenuredSpace(SerialBlockOffsetTable* offsets, - MemRegion mr); - - // Add offset table update. - inline HeapWord* allocate(size_t word_size) override; - inline HeapWord* par_allocate(size_t word_size) override; -}; -#endif //INCLUDE_SERIALGC - #endif // SHARE_GC_SHARED_SPACE_HPP diff --git a/src/hotspot/share/gc/shared/space.inline.hpp b/src/hotspot/share/gc/shared/space.inline.hpp deleted file mode 100644 index fa88be9aa51..00000000000 --- a/src/hotspot/share/gc/shared/space.inline.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 - * 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. - * - */ - -#ifndef SHARE_GC_SHARED_SPACE_INLINE_HPP -#define SHARE_GC_SHARED_SPACE_INLINE_HPP - -#include "gc/shared/space.hpp" - -#include "gc/shared/collectedHeap.hpp" -#include "gc/shared/spaceDecorator.hpp" -#include "oops/oop.inline.hpp" -#include "oops/oopsHierarchy.hpp" -#include "runtime/prefetch.inline.hpp" -#include "runtime/safepoint.hpp" - -#if INCLUDE_SERIALGC -inline HeapWord* TenuredSpace::allocate(size_t size) { - HeapWord* res = ContiguousSpace::allocate(size); - if (res != nullptr) { - _offsets->update_for_block(res, res + size); - } - return res; -} - -inline HeapWord* TenuredSpace::par_allocate(size_t size) { - HeapWord* res = ContiguousSpace::par_allocate(size); - if (res != nullptr) { - _offsets->update_for_block(res, res + size); - } - return res; -} - -#endif // INCLUDE_SERIALGC - -#endif // SHARE_GC_SHARED_SPACE_INLINE_HPP diff --git a/src/hotspot/share/gc/shared/spaceDecorator.cpp b/src/hotspot/share/gc/shared/spaceDecorator.cpp index 0749108400b..69ffbf51561 100644 --- a/src/hotspot/share/gc/shared/spaceDecorator.cpp +++ b/src/hotspot/share/gc/shared/spaceDecorator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "gc/parallel/mutableSpace.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "gc/shared/spaceDecorator.inline.hpp" #include "logging/log.hpp" #include "utilities/copy.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp index a46c7edc348..8a94b20670a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,7 +24,7 @@ */ #include "precompiled.hpp" -#include "gc/shared/space.inline.hpp" +#include "gc/shared/space.hpp" #include "gc/shared/tlab_globals.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/TenuredSpace.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/TenuredSpace.java deleted file mode 100644 index 02d855822da..00000000000 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/TenuredSpace.java +++ /dev/null @@ -1,35 +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.*; - -/** No additional functionality for now */ - -public class TenuredSpace extends ContiguousSpace { - public TenuredSpace(Address addr) { - super(addr); - } -} diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbField.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbField.java index 884f521a02f..2ed557f8e94 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbField.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbField.java @@ -56,7 +56,7 @@ public class ClhsdbField { "field InstanceKlass _constants ConstantPool*", "field Klass _name Symbol*", "field JavaThread _osthread OSThread*", - "field TenuredGeneration _the_space TenuredSpace*", + "field TenuredGeneration _the_space ContiguousSpace*", "field VirtualSpace _low_boundary char*", "field MethodCounters _backedge_counter InvocationCounter", "field nmethod _entry_bci int",