Skip to content

Commit ba5c8ce

Browse files
author
Datadog Syncup Service
committed
Merge branch 'upstream-master'
2 parents 7696dc4 + ad40a12 commit ba5c8ce

File tree

54 files changed

+833
-447
lines changed

Some content is hidden

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

54 files changed

+833
-447
lines changed

Diff for: make/modules/java.desktop/lib/AwtLibraries.gmk

+9-3
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,11 @@ ifeq ($(call isTargetOs, windows macosx), false)
181181
$(X_CFLAGS), \
182182
EXTRA_HEADER_DIRS := $(LIBAWT_HEADLESS_EXTRA_HEADER_DIRS), \
183183
DISABLED_WARNINGS_gcc := unused-variable, \
184+
DISABLED_WARNINGS_clang := unused-variable, \
184185
DISABLED_WARNINGS_gcc_X11Renderer.c := unused-function, \
185186
DISABLED_WARNINGS_gcc_X11SurfaceData.c := unused-function, \
187+
DISABLED_WARNINGS_clang_X11Renderer.c := unused-function, \
188+
DISABLED_WARNINGS_clang_X11SurfaceData.c := unused-function, \
186189
JDK_LIBS := libawt java.base:libjava, \
187190
LIBS_linux := $(LIBDL) $(LIBM), \
188191
STATIC_LIB_EXCLUDE_OBJS := $(LIBAWT_HEADLESS_STATIC_EXCLUDE_OBJS), \
@@ -238,6 +241,7 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
238241
CFLAGS := -DXAWT -DXAWT_HACK $(LIBAWT_XAWT_CFLAGS) \
239242
$(FONTCONFIG_CFLAGS) $(CUPS_CFLAGS) $(X_CFLAGS), \
240243
DISABLED_WARNINGS_gcc := int-to-pointer-cast unused-variable, \
244+
DISABLED_WARNINGS_clang := unused-variable, \
241245
DISABLED_WARNINGS_gcc_awt_Taskbar.c := parentheses, \
242246
DISABLED_WARNINGS_gcc_GLXSurfaceData.c := unused-function, \
243247
DISABLED_WARNINGS_gcc_gtk3_interface.c := parentheses type-limits \
@@ -256,20 +260,22 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
256260
DISABLED_WARNINGS_gcc_XToolkit.c := unused-result, \
257261
DISABLED_WARNINGS_gcc_XWindow.c := unused-function, \
258262
DISABLED_WARNINGS_clang_awt_Taskbar.c := parentheses, \
259-
DISABLED_WARNINGS_clang_gtk3_interface.c := parentheses, \
263+
DISABLED_WARNINGS_clang_gtk3_interface.c := unused-function parentheses, \
264+
DISABLED_WARNINGS_clang_GLXSurfaceData.c := unused-function, \
260265
DISABLED_WARNINGS_clang_OGLBufImgOps.c := format-nonliteral, \
261266
DISABLED_WARNINGS_clang_OGLPaints.c := format-nonliteral, \
262267
DISABLED_WARNINGS_clang_screencast_pipewire.c := format-nonliteral, \
263268
DISABLED_WARNINGS_clang_sun_awt_X11_GtkFileDialogPeer.c := parentheses, \
269+
DISABLED_WARNINGS_clang_XWindow.c := unused-function, \
264270
DISABLED_WARNINGS_clang_aix := deprecated-non-prototype, \
265271
DISABLED_WARNINGS_clang_aix_awt_Taskbar.c := parentheses, \
266272
DISABLED_WARNINGS_clang_aix_OGLPaints.c := format-nonliteral, \
267273
DISABLED_WARNINGS_clang_aix_OGLBufImgOps.c := format-nonliteral, \
268-
DISABLED_WARNINGS_clang_aix_gtk3_interface.c := parentheses \
274+
DISABLED_WARNINGS_clang_aix_gtk3_interface.c := unused-function parentheses \
269275
logical-op-parentheses, \
270276
DISABLED_WARNINGS_clang_aix_sun_awt_X11_GtkFileDialogPeer.c := \
271277
parentheses, \
272-
DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := sign-compare, \
278+
DISABLED_WARNINGS_clang_aix_awt_InputMethod.c := unused-function sign-compare, \
273279
JDK_LIBS := libawt java.base:libjava, \
274280
LIBS_unix := $(LIBDL) $(LIBM) $(X_LIBS) -lX11 -lXext -lXi -lXrender \
275281
-lXtst, \

Diff for: src/hotspot/cpu/aarch64/aarch64.ad

+2-2
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,7 @@ bool Matcher::is_short_branch_offset(int rule, int br_size, int offset) {
23342334
// Vector width in bytes.
23352335
int Matcher::vector_width_in_bytes(BasicType bt) {
23362336
// The MaxVectorSize should have been set by detecting SVE max vector register size.
2337-
int size = MIN2((UseSVE > 0) ? 256 : 16, (int)MaxVectorSize);
2337+
int size = MIN2((UseSVE > 0) ? (int)FloatRegister::sve_vl_max : (int)FloatRegister::neon_vl, (int)MaxVectorSize);
23382338
// Minimum 2 values in vector
23392339
if (size < 2*type2aelembytes(bt)) size = 0;
23402340
// But never < 4
@@ -2373,7 +2373,7 @@ int Matcher::scalable_vector_reg_size(const BasicType bt) {
23732373

23742374
// Vector ideal reg.
23752375
uint Matcher::vector_ideal_reg(int len) {
2376-
if (UseSVE > 0 && 16 < len && len <= 256) {
2376+
if (UseSVE > 0 && FloatRegister::neon_vl < len && len <= FloatRegister::sve_vl_max) {
23772377
return Op_VecA;
23782378
}
23792379
switch(len) {

Diff for: src/hotspot/cpu/aarch64/aarch64_vector.ad

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ source %{
155155
}
156156

157157
int length_in_bytes = vlen * type2aelembytes(bt);
158-
if (UseSVE == 0 && length_in_bytes > 16) {
158+
if (UseSVE == 0 && length_in_bytes > FloatRegister::neon_vl) {
159159
return false;
160160
}
161161

Diff for: src/hotspot/cpu/aarch64/aarch64_vector_ad.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ source %{
145145
}
146146

147147
int length_in_bytes = vlen * type2aelembytes(bt);
148-
if (UseSVE == 0 && length_in_bytes > 16) {
148+
if (UseSVE == 0 && length_in_bytes > FloatRegister::neon_vl) {
149149
return false;
150150
}
151151

Diff for: src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -6413,8 +6413,10 @@ void MacroAssembler::cache_wbsync(bool is_pre) {
64136413
}
64146414

64156415
void MacroAssembler::verify_sve_vector_length(Register tmp) {
6416+
if (!UseSVE || VM_Version::get_max_supported_sve_vector_length() == FloatRegister::sve_vl_min) {
6417+
return;
6418+
}
64166419
// Make sure that native code does not change SVE vector length.
6417-
if (!UseSVE) return;
64186420
Label verify_ok;
64196421
movw(tmp, zr);
64206422
sve_inc(tmp, B);

Diff for: src/hotspot/cpu/aarch64/register_aarch64.hpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -166,7 +166,13 @@ class FloatRegister {
166166
max_slots_per_register = 4,
167167
save_slots_per_register = 2,
168168
slots_per_neon_register = 4,
169-
extra_save_slots_per_neon_register = slots_per_neon_register - save_slots_per_register
169+
extra_save_slots_per_neon_register = slots_per_neon_register - save_slots_per_register,
170+
neon_vl = 16,
171+
// VLmax: The maximum sve vector length is determined by the hardware
172+
// sve_vl_min <= VLmax <= sve_vl_max.
173+
sve_vl_min = 16,
174+
// Maximum supported vector length across all CPUs
175+
sve_vl_max = 256
170176
};
171177

172178
class FloatRegisterImpl: public AbstractRegisterImpl {

Diff for: src/hotspot/cpu/aarch64/vm_version_aarch64.cpp

+28-19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "precompiled.hpp"
2727
#include "pauth_aarch64.hpp"
28+
#include "register_aarch64.hpp"
2829
#include "runtime/arguments.hpp"
2930
#include "runtime/globals_extension.hpp"
3031
#include "runtime/java.hpp"
@@ -44,6 +45,7 @@ int VM_Version::_zva_length;
4445
int VM_Version::_dcache_line_size;
4546
int VM_Version::_icache_line_size;
4647
int VM_Version::_initial_sve_vector_length;
48+
int VM_Version::_max_supported_sve_vector_length;
4749
bool VM_Version::_rop_protection;
4850
uintptr_t VM_Version::_pac_mask;
4951

@@ -507,30 +509,37 @@ void VM_Version::initialize() {
507509
if (UseSVE > 0) {
508510
if (FLAG_IS_DEFAULT(MaxVectorSize)) {
509511
MaxVectorSize = _initial_sve_vector_length;
510-
} else if (MaxVectorSize < 16) {
511-
warning("SVE does not support vector length less than 16 bytes. Disabling SVE.");
512+
} else if (MaxVectorSize < FloatRegister::sve_vl_min) {
513+
warning("SVE does not support vector length less than %d bytes. Disabling SVE.",
514+
FloatRegister::sve_vl_min);
512515
UseSVE = 0;
513-
} else if ((MaxVectorSize % 16) == 0 && is_power_of_2(MaxVectorSize)) {
514-
int new_vl = set_and_get_current_sve_vector_length(MaxVectorSize);
515-
_initial_sve_vector_length = new_vl;
516-
// Update MaxVectorSize to the largest supported value.
517-
if (new_vl < 0) {
518-
vm_exit_during_initialization(
519-
err_msg("Current system does not support SVE vector length for MaxVectorSize: %d",
520-
(int)MaxVectorSize));
521-
} else if (new_vl != MaxVectorSize) {
522-
warning("Current system only supports max SVE vector length %d. Set MaxVectorSize to %d",
523-
new_vl, new_vl);
524-
}
525-
MaxVectorSize = new_vl;
526-
} else {
516+
} else if (!((MaxVectorSize % FloatRegister::sve_vl_min) == 0 && is_power_of_2(MaxVectorSize))) {
527517
vm_exit_during_initialization(err_msg("Unsupported MaxVectorSize: %d", (int)MaxVectorSize));
528518
}
519+
520+
if (UseSVE > 0) {
521+
// Acquire the largest supported vector length of this machine
522+
_max_supported_sve_vector_length = set_and_get_current_sve_vector_length(FloatRegister::sve_vl_max);
523+
524+
if (MaxVectorSize != _max_supported_sve_vector_length) {
525+
int new_vl = set_and_get_current_sve_vector_length(MaxVectorSize);
526+
if (new_vl < 0) {
527+
vm_exit_during_initialization(
528+
err_msg("Current system does not support SVE vector length for MaxVectorSize: %d",
529+
(int)MaxVectorSize));
530+
} else if (new_vl != MaxVectorSize) {
531+
warning("Current system only supports max SVE vector length %d. Set MaxVectorSize to %d",
532+
new_vl, new_vl);
533+
}
534+
MaxVectorSize = new_vl;
535+
}
536+
_initial_sve_vector_length = MaxVectorSize;
537+
}
529538
}
530539

531540
if (UseSVE == 0) { // NEON
532541
int min_vector_size = 8;
533-
int max_vector_size = 16;
542+
int max_vector_size = FloatRegister::neon_vl;
534543
if (!FLAG_IS_DEFAULT(MaxVectorSize)) {
535544
if (!is_power_of_2(MaxVectorSize)) {
536545
vm_exit_during_initialization(err_msg("Unsupported MaxVectorSize: %d", (int)MaxVectorSize));
@@ -542,11 +551,11 @@ void VM_Version::initialize() {
542551
FLAG_SET_DEFAULT(MaxVectorSize, max_vector_size);
543552
}
544553
} else {
545-
FLAG_SET_DEFAULT(MaxVectorSize, 16);
554+
FLAG_SET_DEFAULT(MaxVectorSize, FloatRegister::neon_vl);
546555
}
547556
}
548557

549-
int inline_size = (UseSVE > 0 && MaxVectorSize >= 16) ? MaxVectorSize : 0;
558+
int inline_size = (UseSVE > 0 && MaxVectorSize >= FloatRegister::sve_vl_min) ? MaxVectorSize : 0;
550559
if (FLAG_IS_DEFAULT(ArrayOperationPartialInlineSize)) {
551560
FLAG_SET_DEFAULT(ArrayOperationPartialInlineSize, inline_size);
552561
} else if (ArrayOperationPartialInlineSize != 0 && ArrayOperationPartialInlineSize != inline_size) {

Diff for: src/hotspot/cpu/aarch64/vm_version_aarch64.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class VM_Version : public Abstract_VM_Version {
4646
static int _dcache_line_size;
4747
static int _icache_line_size;
4848
static int _initial_sve_vector_length;
49+
static int _max_supported_sve_vector_length;
4950
static bool _rop_protection;
5051
static uintptr_t _pac_mask;
5152

@@ -164,7 +165,8 @@ enum Ampere_CPU_Model {
164165

165166
static int icache_line_size() { return _icache_line_size; }
166167
static int dcache_line_size() { return _dcache_line_size; }
167-
static int get_initial_sve_vector_length() { return _initial_sve_vector_length; };
168+
static int get_initial_sve_vector_length() { return _initial_sve_vector_length; };
169+
static int get_max_supported_sve_vector_length() { return _max_supported_sve_vector_length; };
168170

169171
// Aarch64 supports fast class initialization checks
170172
static bool supports_fast_class_init_checks() { return true; }

Diff for: src/hotspot/cpu/ppc/macroAssembler_ppc.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ void MacroAssembler::cmpxchg_generic(ConditionRegister flag, Register dest_curre
17371737

17381738
cmpxchg_loop_body(flag, dest_current_value, compare_value, exchange_value, addr_base, tmp1, tmp2,
17391739
retry, failed, cmpxchgx_hint, size);
1740-
if (!weak || use_result_reg) {
1740+
if (!weak || use_result_reg || failed_ext) {
17411741
if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
17421742
bne_predict_not_taken(CCR0, weak ? failed : retry); // StXcx_ sets CCR0.
17431743
} else {

Diff for: src/hotspot/cpu/riscv/macroAssembler_riscv.cpp

+12-5
Original file line numberDiff line numberDiff line change
@@ -3530,14 +3530,18 @@ void MacroAssembler::atomic_cas(
35303530

35313531
void MacroAssembler::far_jump(const Address &entry, Register tmp) {
35323532
assert(CodeCache::find_blob(entry.target()) != nullptr,
3533-
"destination of far call not found in code cache");
3533+
"destination of far jump not found in code cache");
35343534
assert(entry.rspec().type() == relocInfo::external_word_type
35353535
|| entry.rspec().type() == relocInfo::runtime_call_type
35363536
|| entry.rspec().type() == relocInfo::none, "wrong entry relocInfo type");
35373537
// Fixed length: see MacroAssembler::far_branch_size()
3538+
// We can use auipc + jr here because we know that the total size of
3539+
// the code cache cannot exceed 2Gb.
35383540
relocate(entry.rspec(), [&] {
3539-
int32_t offset;
3540-
la(tmp, entry.target(), offset);
3541+
int64_t distance = entry.target() - pc();
3542+
int32_t offset = ((int32_t)distance << 20) >> 20;
3543+
assert(is_valid_32bit_offset(distance), "Far jump using wrong instructions.");
3544+
auipc(tmp, (int32_t)distance + 0x800);
35413545
jr(tmp, offset);
35423546
});
35433547
}
@@ -3552,8 +3556,11 @@ void MacroAssembler::far_call(const Address &entry, Register tmp) {
35523556
// We can use auipc + jalr here because we know that the total size of
35533557
// the code cache cannot exceed 2Gb.
35543558
relocate(entry.rspec(), [&] {
3555-
assert(is_valid_32bit_offset(entry.target() - pc()), "Far call using wrong instructions.");
3556-
call(entry.target(), tmp);
3559+
int64_t distance = entry.target() - pc();
3560+
int32_t offset = ((int32_t)distance << 20) >> 20;
3561+
assert(is_valid_32bit_offset(distance), "Far call using wrong instructions.");
3562+
auipc(tmp, (int32_t)distance + 0x800);
3563+
jalr(tmp, offset);
35573564
});
35583565
}
35593566

Diff for: src/hotspot/share/cds/filemap.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ void FileMapHeader::print(outputStream* st) {
268268
st->print_cr("- core_region_alignment: " SIZE_FORMAT, _core_region_alignment);
269269
st->print_cr("- obj_alignment: %d", _obj_alignment);
270270
st->print_cr("- narrow_oop_base: " INTPTR_FORMAT, p2i(_narrow_oop_base));
271-
st->print_cr("- narrow_oop_base: " INTPTR_FORMAT, p2i(_narrow_oop_base));
272271
st->print_cr("- narrow_oop_shift %d", _narrow_oop_shift);
273272
st->print_cr("- compact_strings: %d", _compact_strings);
274273
st->print_cr("- max_heap_size: " UINTX_FORMAT, _max_heap_size);

Diff for: src/hotspot/share/code/codeCache.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void CodeCache::initialize_heaps() {
205205
const bool cache_size_set = FLAG_IS_CMDLINE(ReservedCodeCacheSize);
206206
const size_t ps = page_size(false, 8);
207207
const size_t min_size = MAX2(os::vm_allocation_granularity(), ps);
208-
const size_t min_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3); // Make sure we have enough space for VM internal code
208+
const size_t min_cache_size = CompilerConfig::min_code_cache_size(); // Make sure we have enough space for VM internal code
209209
size_t cache_size = align_up(ReservedCodeCacheSize, min_size);
210210

211211
// Prerequisites

Diff for: src/hotspot/share/compiler/compilationPolicy.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void CompilationPolicy::initialize() {
455455
c2_size = C2Compiler::initial_code_buffer_size();
456456
#endif
457457
size_t buffer_size = c1_only ? c1_size : (c1_size/3 + 2*c2_size/3);
458-
int max_count = (ReservedCodeCacheSize - (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3))) / (int)buffer_size;
458+
int max_count = (ReservedCodeCacheSize - (int)CompilerConfig::min_code_cache_size()) / (int)buffer_size;
459459
if (count > max_count) {
460460
// Lower the compiler count such that all buffers fit into the code cache
461461
count = MAX2(max_count, c1_only ? 1 : 2);

Diff for: src/hotspot/share/compiler/compilerDefinitions.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -475,8 +475,7 @@ void CompilerConfig::set_jvmci_specific_flags() {
475475

476476
bool CompilerConfig::check_args_consistency(bool status) {
477477
// Check lower bounds of the code cache
478-
// Template Interpreter code is approximately 3X larger in debug builds.
479-
uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
478+
size_t min_code_cache_size = CompilerConfig::min_code_cache_size();
480479
if (ReservedCodeCacheSize < InitialCodeCacheSize) {
481480
jio_fprintf(defaultStream::error_stream(),
482481
"Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",

Diff for: src/hotspot/share/compiler/compilerDefinitions.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ class CompilerConfig : public AllStatic {
148148
inline static bool is_c2_or_jvmci_compiler_only();
149149
inline static bool is_c2_or_jvmci_compiler_enabled();
150150

151+
inline static size_t min_code_cache_size();
152+
151153
private:
152154
static bool is_compilation_mode_selected();
153155
static void set_compilation_policy_flags();

Diff for: src/hotspot/share/compiler/compilerDefinitions.inline.hpp

+15
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
#ifndef SHARE_COMPILER_COMPILERDEFINITIONS_INLINE_HPP
2626
#define SHARE_COMPILER_COMPILERDEFINITIONS_INLINE_HPP
2727

28+
#ifdef COMPILER1
29+
#include "c1/c1_Compiler.hpp"
30+
#endif
31+
#ifdef COMPILER2
32+
#include "opto/c2compiler.hpp"
33+
#endif
2834
#include "compiler/compilerDefinitions.hpp"
2935

3036
#include "compiler/compiler_globals.hpp"
@@ -132,4 +138,13 @@ inline bool CompilerConfig::is_c2_or_jvmci_compiler_enabled() {
132138
return is_c2_enabled() || is_jvmci_compiler_enabled();
133139
}
134140

141+
inline size_t CompilerConfig::min_code_cache_size() {
142+
size_t min_code_cache_size = CodeCacheMinimumUseSpace;
143+
// Template Interpreter code is approximately 3X larger in debug builds.
144+
DEBUG_ONLY(min_code_cache_size *= 3);
145+
COMPILER1_PRESENT(min_code_cache_size += Compiler::code_buffer_size());
146+
COMPILER2_PRESENT(min_code_cache_size += C2Compiler::initial_code_buffer_size());
147+
return min_code_cache_size;
148+
}
149+
135150
#endif // SHARE_COMPILER_COMPILERDEFINITIONS_INLINE_HPP

0 commit comments

Comments
 (0)