8298264: Merge OffsetTableContigSpace into TenuredSpace

Reviewed-by: stefank, tschatzl
This commit is contained in:
Albert Mingkun Yang 2022-12-14 12:45:17 +00:00
parent d32d6c028d
commit ceca4fc9ec
6 changed files with 28 additions and 77 deletions

View File

@ -59,15 +59,14 @@
nonstatic_field(BlockOffsetArrayContigSpace, _next_offset_threshold, HeapWord*) \
nonstatic_field(BlockOffsetArrayContigSpace, _next_offset_index, size_t) \
\
nonstatic_field(OffsetTableContigSpace, _offsets, BlockOffsetArray)
nonstatic_field(TenuredSpace, _offsets, BlockOffsetArray)
#define VM_TYPES_SERIALGC(declare_type, \
declare_toplevel_type, \
declare_integer_type) \
declare_type(SerialHeap, GenCollectedHeap) \
declare_type(TenuredGeneration, Generation) \
declare_type(TenuredSpace, OffsetTableContigSpace) \
declare_type(OffsetTableContigSpace, ContiguousSpace) \
declare_type(TenuredSpace, ContiguousSpace) \
\
declare_type(DefNewGeneration, Generation) \
\
@ -76,8 +75,7 @@
declare_toplevel_type(BlockOffsetTable) \
declare_type(BlockOffsetArray, BlockOffsetTable) \
declare_type(BlockOffsetArrayContigSpace, BlockOffsetArray) \
declare_toplevel_type(BlockOffsetSharedArray*) \
declare_toplevel_type(OffsetTableContigSpace*)
declare_toplevel_type(BlockOffsetSharedArray*)
#define VM_INT_CONSTANTS_SERIALGC(declare_constant, \
declare_constant_with_value)

View File

@ -284,17 +284,17 @@ bool ContiguousSpace::is_free_block(const HeapWord* p) const {
}
#if INCLUDE_SERIALGC
void OffsetTableContigSpace::clear(bool mangle_space) {
void TenuredSpace::clear(bool mangle_space) {
ContiguousSpace::clear(mangle_space);
_offsets.initialize_threshold();
}
void OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) {
void TenuredSpace::set_bottom(HeapWord* new_bottom) {
Space::set_bottom(new_bottom);
_offsets.set_bottom(new_bottom);
}
void OffsetTableContigSpace::set_end(HeapWord* new_end) {
void TenuredSpace::set_end(HeapWord* new_end) {
// Space should not advertise an increase in size
// until after the underlying offset table has been enlarged.
_offsets.resize(pointer_delta(new_end, bottom()));
@ -590,7 +590,7 @@ void ContiguousSpace::print_on(outputStream* st) const {
}
#if INCLUDE_SERIALGC
void OffsetTableContigSpace::print_on(outputStream* st) const {
void TenuredSpace::print_on(outputStream* st) const {
print_short_on(st);
st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", "
PTR_FORMAT ", " PTR_FORMAT ")",
@ -733,18 +733,18 @@ HeapWord* ContiguousSpace::par_allocate(size_t size) {
}
#if INCLUDE_SERIALGC
void OffsetTableContigSpace::initialize_threshold() {
void TenuredSpace::initialize_threshold() {
_offsets.initialize_threshold();
}
void OffsetTableContigSpace::alloc_block(HeapWord* start, HeapWord* end) {
void TenuredSpace::alloc_block(HeapWord* start, HeapWord* end) {
_offsets.alloc_block(start, end);
}
OffsetTableContigSpace::OffsetTableContigSpace(BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr) :
TenuredSpace::TenuredSpace(BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr) :
_offsets(sharedOffsetArray, mr),
_par_alloc_lock(Mutex::safepoint, "OffsetTableContigSpaceParAlloc_lock", true)
_par_alloc_lock(Mutex::safepoint, "TenuredSpaceParAlloc_lock", true)
{
_offsets.set_contig_space(this);
initialize(mr, SpaceDecorator::Clear, SpaceDecorator::Mangle);
@ -753,7 +753,7 @@ OffsetTableContigSpace::OffsetTableContigSpace(BlockOffsetSharedArray* sharedOff
#define OBJ_SAMPLE_INTERVAL 0
#define BLOCK_SAMPLE_INTERVAL 100
void OffsetTableContigSpace::verify() const {
void TenuredSpace::verify() const {
HeapWord* p = bottom();
HeapWord* prev_p = NULL;
int objs = 0;

View File

@ -550,22 +550,25 @@ public:
{}
};
// A ContigSpace that Supports an efficient "block_start" operation via
// a BlockOffsetArray (whose BlockOffsetSharedArray may be shared with
// other spaces.) This is the abstract base class for old generation
// (tenured) spaces.
#if INCLUDE_SERIALGC
class OffsetTableContigSpace: public ContiguousSpace {
// Class TenuredSpace is used by TenuredGeneration; it supports an efficient
// "block_start" operation via a BlockOffsetArray (whose BlockOffsetSharedArray
// may be shared with other spaces.)
class TenuredSpace: public ContiguousSpace {
friend class VMStructs;
protected:
BlockOffsetArrayContigSpace _offsets;
Mutex _par_alloc_lock;
// Mark sweep support
size_t allowed_dead_ratio() const override;
public:
// Constructor
OffsetTableContigSpace(BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr);
TenuredSpace(BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr);
void set_bottom(HeapWord* value) override;
void set_end(HeapWord* value) override;
@ -587,21 +590,6 @@ class OffsetTableContigSpace: public ContiguousSpace {
// Debugging
void verify() const override;
};
// Class TenuredSpace is used by TenuredGeneration
class TenuredSpace: public OffsetTableContigSpace {
friend class VMStructs;
protected:
// Mark sweep support
size_t allowed_dead_ratio() const override;
public:
// Constructor
TenuredSpace(BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr) :
OffsetTableContigSpace(sharedOffsetArray, mr) {}
};
#endif //INCLUDE_SERIALGC
#endif // SHARE_GC_SHARED_SPACE_HPP

View File

@ -44,7 +44,7 @@ inline HeapWord* Space::block_start(const void* p) {
}
#if INCLUDE_SERIALGC
inline HeapWord* OffsetTableContigSpace::allocate(size_t size) {
inline HeapWord* TenuredSpace::allocate(size_t size) {
HeapWord* res = ContiguousSpace::allocate(size);
if (res != NULL) {
_offsets.alloc_block(res, size);
@ -55,7 +55,7 @@ inline HeapWord* OffsetTableContigSpace::allocate(size_t size) {
// Because of the requirement of keeping "_offsets" up to date with the
// allocations, we sequentialize these with a lock. Therefore, best if
// this is used for larger LAB allocations only.
inline HeapWord* OffsetTableContigSpace::par_allocate(size_t size) {
inline HeapWord* TenuredSpace::par_allocate(size_t size) {
MutexLocker x(&_par_alloc_lock);
// This ought to be just "allocate", because of the lock above, but that
// ContiguousSpace::allocate asserts that either the allocating thread
@ -73,7 +73,7 @@ inline HeapWord* OffsetTableContigSpace::par_allocate(size_t size) {
}
inline HeapWord*
OffsetTableContigSpace::block_start_const(const void* p) const {
TenuredSpace::block_start_const(const void* p) const {
return _offsets.block_start(p);
}
@ -156,7 +156,7 @@ inline void CompactibleSpace::clear_empty_region(SpaceType* space) {
// Reset space after compaction is complete
space->reset_after_compaction();
// We do this clear, below, since it has overloaded meanings for some
// space subtypes. For example, OffsetTableContigSpace's that were
// space subtypes. For example, TenuredSpace's that were
// compacted into will have had their offset table thresholds updated
// continuously, but those that weren't need to have their thresholds
// re-initialized. Also mangles unused area for debugging.

View File

@ -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 OffsetTableContigSpace extends ContiguousSpace {
public OffsetTableContigSpace(Address addr) {
super(addr);
}
}

View File

@ -28,7 +28,7 @@ import sun.jvm.hotspot.debugger.*;
/** No additional functionality for now */
public class TenuredSpace extends OffsetTableContigSpace {
public class TenuredSpace extends ContiguousSpace {
public TenuredSpace(Address addr) {
super(addr);
}