Skip to content

Commit 9edf515

Browse files
Merge tag 'jdk-24+29' into ola/24.2_jdk-24+29
Added tag jdk-24+29 for changeset 2c33629
2 parents 15b24af + 2c33629 commit 9edf515

File tree

488 files changed

+7183
-1561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

488 files changed

+7183
-1561
lines changed

make/Images.gmk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ include $(SPEC)
2929
include MakeBase.gmk
3030

3131
include CopyFiles.gmk
32+
include DebugInfoUtils.gmk
3233
include Execute.gmk
3334
include Modules.gmk
3435
include Utils.gmk

make/StaticLibs.gmk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ include $(SPEC)
2929
include MakeBase.gmk
3030

3131
include CopyFiles.gmk
32+
include DebugInfoUtils.gmk
3233
include Modules.gmk
3334
include modules/LauncherCommon.gmk
3435

make/common/DebugInfoUtils.gmk

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
#
5+
# This code is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License version 2 only, as
7+
# published by the Free Software Foundation. Oracle designates this
8+
# particular file as subject to the "Classpath" exception as provided
9+
# by Oracle in the LICENSE file that accompanied this code.
10+
#
11+
# This code is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
# version 2 for more details (a copy is included in the LICENSE file that
15+
# accompanied this code).
16+
#
17+
# You should have received a copy of the GNU General Public License version
18+
# 2 along with this work; if not, write to the Free Software Foundation,
19+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
#
21+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
# or visit www.oracle.com if you need additional information or have any
23+
# questions.
24+
#
25+
26+
ifeq ($(_MAKEBASE_GMK), )
27+
$(error You must include MakeBase.gmk prior to including DebugInfoUtils.gmk)
28+
endif
29+
30+
################################################################################
31+
#
32+
# Common debuginfo utility functions
33+
#
34+
################################################################################
35+
36+
################################################################################
37+
# Find native debuginfo files in a directory
38+
#
39+
# Param 1 - dir to find debuginfo files in
40+
FindDebuginfoFiles = \
41+
$(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
42+
$(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
43+
$(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))
44+
45+
# Pick the correct debug info files to copy, either zipped or not.
46+
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
47+
DEBUGINFO_SUFFIXES += .diz
48+
else
49+
DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
50+
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
51+
# dirs.
52+
ifeq ($(call isTargetOs, macosx), true)
53+
$(call FillFindCache, \
54+
$(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds)
55+
FindDebuginfoFiles = \
56+
$(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1)))
57+
endif
58+
endif

make/common/FileUtils.gmk

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -307,26 +307,3 @@ ifeq ($(DISABLE_CACHE_FIND), true)
307307
else
308308
FindFiles = $(CacheFindFiles)
309309
endif
310-
311-
# Find native debuginfo files in a directory
312-
#
313-
# Param 1 - dir to find debuginfo files in
314-
FindDebuginfoFiles = \
315-
$(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
316-
$(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
317-
$(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))
318-
319-
# Pick the correct debug info files to copy, either zipped or not.
320-
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
321-
DEBUGINFO_SUFFIXES += .diz
322-
else
323-
DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
324-
# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
325-
# dirs.
326-
ifeq ($(call isTargetOs, macosx), true)
327-
$(call FillFindCache, \
328-
$(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds)
329-
FindDebuginfoFiles = \
330-
$(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1)))
331-
endif
332-
endif

src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
*/
2525

2626
#include "precompiled.hpp"
27-
#include "asm/assembler.hpp"
27+
#include "asm/macroAssembler.hpp"
2828
#include "logging/log.hpp"
2929
#include "oops/compressedKlass.hpp"
3030
#include "memory/metaspace.hpp"
31+
#include "runtime/java.hpp"
3132
#include "runtime/os.hpp"
3233
#include "utilities/globalDefinitions.hpp"
34+
#include "utilities/formatBuffer.hpp"
3335

3436
// Helper function; reserve at an address that is compatible with EOR
3537
static char* reserve_at_eor_compatible_address(size_t size, bool aslr) {
@@ -79,6 +81,7 @@ static char* reserve_at_eor_compatible_address(size_t size, bool aslr) {
7981
}
8082
return result;
8183
}
84+
8285
char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size_t size, bool aslr, bool optimize_for_zero_base) {
8386

8487
char* result = nullptr;
@@ -117,3 +120,12 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size
117120

118121
return result;
119122
}
123+
124+
bool CompressedKlassPointers::check_klass_decode_mode(address base, int shift, const size_t range) {
125+
return MacroAssembler::check_klass_decode_mode(base, shift, range);
126+
}
127+
128+
bool CompressedKlassPointers::set_klass_decode_mode() {
129+
const size_t range = klass_range_end() - base();
130+
return MacroAssembler::set_klass_decode_mode(_base, _shift, range);
131+
}

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5291,32 +5291,47 @@ void MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) {
52915291
MacroAssembler::KlassDecodeMode MacroAssembler::_klass_decode_mode(KlassDecodeNone);
52925292

52935293
MacroAssembler::KlassDecodeMode MacroAssembler::klass_decode_mode() {
5294-
assert(UseCompressedClassPointers, "not using compressed class pointers");
52955294
assert(Metaspace::initialized(), "metaspace not initialized yet");
5295+
assert(_klass_decode_mode != KlassDecodeNone, "should be initialized");
5296+
return _klass_decode_mode;
5297+
}
52965298

5297-
if (_klass_decode_mode != KlassDecodeNone) {
5298-
return _klass_decode_mode;
5299-
}
5299+
MacroAssembler::KlassDecodeMode MacroAssembler::klass_decode_mode(address base, int shift, const size_t range) {
5300+
assert(UseCompressedClassPointers, "not using compressed class pointers");
5301+
5302+
// KlassDecodeMode shouldn't be set already.
5303+
assert(_klass_decode_mode == KlassDecodeNone, "set once");
53005304

5301-
if (CompressedKlassPointers::base() == nullptr) {
5302-
return (_klass_decode_mode = KlassDecodeZero);
5305+
if (base == nullptr) {
5306+
return KlassDecodeZero;
53035307
}
53045308

53055309
if (operand_valid_for_logical_immediate(
5306-
/*is32*/false, (uint64_t)CompressedKlassPointers::base())) {
5307-
const size_t range = CompressedKlassPointers::klass_range_end() - CompressedKlassPointers::base();
5310+
/*is32*/false, (uint64_t)base)) {
53085311
const uint64_t range_mask = right_n_bits(log2i_ceil(range));
5309-
if (((uint64_t)CompressedKlassPointers::base() & range_mask) == 0) {
5310-
return (_klass_decode_mode = KlassDecodeXor);
5312+
if (((uint64_t)base & range_mask) == 0) {
5313+
return KlassDecodeXor;
53115314
}
53125315
}
53135316

53145317
const uint64_t shifted_base =
5315-
(uint64_t)CompressedKlassPointers::base() >> CompressedKlassPointers::shift();
5316-
guarantee((shifted_base & 0xffff0000ffffffff) == 0,
5317-
"compressed class base bad alignment");
5318+
(uint64_t)base >> shift;
5319+
if ((shifted_base & 0xffff0000ffffffff) == 0) {
5320+
return KlassDecodeMovk;
5321+
}
5322+
5323+
// No valid encoding.
5324+
return KlassDecodeNone;
5325+
}
5326+
5327+
// Check if one of the above decoding modes will work for given base, shift and range.
5328+
bool MacroAssembler::check_klass_decode_mode(address base, int shift, const size_t range) {
5329+
return klass_decode_mode(base, shift, range) != KlassDecodeNone;
5330+
}
53185331

5319-
return (_klass_decode_mode = KlassDecodeMovk);
5332+
bool MacroAssembler::set_klass_decode_mode(address base, int shift, const size_t range) {
5333+
_klass_decode_mode = klass_decode_mode(base, shift, range);
5334+
return _klass_decode_mode != KlassDecodeNone;
53205335
}
53215336

53225337
void MacroAssembler::encode_klass_not_null(Register dst, Register src) {

src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,22 @@ class MacroAssembler: public Assembler {
9494
KlassDecodeMovk
9595
};
9696

97-
KlassDecodeMode klass_decode_mode();
97+
// Calculate decoding mode based on given parameters, used for checking then ultimately setting.
98+
static KlassDecodeMode klass_decode_mode(address base, int shift, const size_t range);
9899

99100
private:
100101
static KlassDecodeMode _klass_decode_mode;
101102

103+
// Returns above setting with asserts
104+
static KlassDecodeMode klass_decode_mode();
105+
106+
public:
107+
// Checks the decode mode and returns false if not compatible with preferred decoding mode.
108+
static bool check_klass_decode_mode(address base, int shift, const size_t range);
109+
110+
// Sets the decode mode and returns false if cannot be set.
111+
static bool set_klass_decode_mode(address base, int shift, const size_t range);
112+
102113
public:
103114
MacroAssembler(CodeBuffer* code) : Assembler(code) {}
104115

src/hotspot/share/cds/metaspaceShared.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,16 @@ size_t MetaspaceShared::core_region_alignment() {
145145
}
146146

147147
static bool shared_base_valid(char* shared_base) {
148-
// We check user input for SharedBaseAddress at dump time. We must weed out values
149-
// we already know to be invalid later.
148+
// We check user input for SharedBaseAddress at dump time.
150149

151150
// At CDS runtime, "shared_base" will be the (attempted) mapping start. It will also
152151
// be the encoding base, since the the headers of archived base objects (and with Lilliput,
153152
// the prototype mark words) carry pre-computed narrow Klass IDs that refer to the mapping
154153
// start as base.
155154
//
156-
// Therefore, "shared_base" must be later usable as encoding base.
155+
// On AARCH64, The "shared_base" may not be later usable as encoding base, depending on the
156+
// total size of the reserved area and the precomputed_narrow_klass_shift. This is checked
157+
// before reserving memory. Here we weed out values already known to be invalid later.
157158
return AARCH64_ONLY(is_aligned(shared_base, 4 * G)) NOT_AARCH64(true);
158159
}
159160

@@ -1486,6 +1487,15 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma
14861487
const size_t total_range_size =
14871488
archive_space_size + gap_size + class_space_size;
14881489

1490+
// Test that class space base address plus shift can be decoded by aarch64, when restored.
1491+
const int precomputed_narrow_klass_shift = ArchiveBuilder::precomputed_narrow_klass_shift();
1492+
if (!CompressedKlassPointers::check_klass_decode_mode(base_address, precomputed_narrow_klass_shift,
1493+
total_range_size)) {
1494+
log_info(cds)("CDS initialization: Cannot use SharedBaseAddress " PTR_FORMAT " with precomputed shift %d.",
1495+
p2i(base_address), precomputed_narrow_klass_shift);
1496+
use_archive_base_addr = false;
1497+
}
1498+
14891499
assert(total_range_size > ccs_begin_offset, "must be");
14901500
if (use_windows_memory_mapping() && use_archive_base_addr) {
14911501
if (base_address != nullptr) {
@@ -1525,7 +1535,7 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma
15251535
}
15261536

15271537
// Paranoid checks:
1528-
assert(base_address == nullptr || (address)total_space_rs.base() == base_address,
1538+
assert(!use_archive_base_addr || (address)total_space_rs.base() == base_address,
15291539
"Sanity (" PTR_FORMAT " vs " PTR_FORMAT ")", p2i(base_address), p2i(total_space_rs.base()));
15301540
assert(is_aligned(total_space_rs.base(), base_address_alignment), "Sanity");
15311541
assert(total_space_rs.size() == total_range_size, "Sanity");

src/hotspot/share/cds/runTimeClassInfo.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@ void RunTimeClassInfo::init(DumpTimeClassInfo& info) {
7676
}
7777

7878
InstanceKlass* RunTimeClassInfo::klass() const {
79-
if (ArchiveBuilder::is_active() && ArchiveBuilder::current()->is_in_buffer_space((address)this)) {
80-
return ArchiveBuilder::current()->offset_to_buffered<InstanceKlass*>(_klass_offset);
81-
} else {
79+
if (MetaspaceShared::is_in_shared_metaspace(this)) {
80+
// <this> is inside a mmaped CDS archive.
8281
return ArchiveUtils::offset_to_archived_address<InstanceKlass*>(_klass_offset);
82+
} else {
83+
// <this> is a temporary copy of a RunTimeClassInfo that's being initialized
84+
// by the ArchiveBuilder.
85+
return ArchiveBuilder::current()->offset_to_buffered<InstanceKlass*>(_klass_offset);
8386
}
8487
}
8588

src/hotspot/share/gc/shared/genArguments.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ size_t MinNewSize = 0;
3737
size_t MinOldSize = 0;
3838
size_t MaxOldSize = 0;
3939

40-
size_t OldSize = 0;
40+
// If InitialHeapSize or MinHeapSize is not set on cmdline, this variable,
41+
// together with NewSize, is used to derive them.
42+
// Using the same value when it was a configurable flag to avoid breakage.
43+
// See more in JDK-8346005
44+
size_t OldSize = ScaleForWordSize(4*M);
4145

4246
size_t GenAlignment = 0;
4347

0 commit comments

Comments
 (0)