Skip to content

Commit 5d88eca

Browse files
Merge tag 'jdk-24+5' into labsjdk/automation-7-4-2024-6028
Added tag jdk-24+5 for changeset 38a578d
2 parents 51babe6 + 38a578d commit 5d88eca

File tree

308 files changed

+6573
-2408
lines changed

Some content is hidden

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

308 files changed

+6573
-2408
lines changed

make/autoconf/jdk-options.m4

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,8 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
197197
# three different page sizes: 4K, 64K, and if run on Mac m1 hardware, 16K.
198198
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=false
199199
if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
200-
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=true
200+
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=auto
201201
fi
202-
AC_SUBST(COMPATIBLE_CDS_ALIGNMENT_DEFAULT)
203202
204203
# Compress jars
205204
COMPRESS_JARS=false
@@ -438,12 +437,23 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
438437
# It's harmless to be suppressed in clang as well.
439438
ASAN_CFLAGS="-fsanitize=address -Wno-stringop-truncation -fno-omit-frame-pointer -fno-common -DADDRESS_SANITIZER"
440439
ASAN_LDFLAGS="-fsanitize=address"
440+
# detect_stack_use_after_return causes ASAN to offload stack-local
441+
# variables to c-heap and therefore breaks assumptions in hotspot
442+
# that rely on data (e.g. Marks) living in thread stacks.
443+
if test "x$TOOLCHAIN_TYPE" = "xgcc"; then
444+
ASAN_CFLAGS="$ASAN_CFLAGS --param asan-use-after-return=0"
445+
fi
446+
if test "x$TOOLCHAIN_TYPE" = "xclang"; then
447+
ASAN_CFLAGS="$ASAN_CFLAGS -fsanitize-address-use-after-return=never"
448+
fi
441449
elif test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
442450
# -Oy- is equivalent to -fno-omit-frame-pointer in GCC/Clang.
443451
ASAN_CFLAGS="-fsanitize=address -Oy- -DADDRESS_SANITIZER"
444452
# MSVC produces a warning if you pass -fsanitize=address to the linker. It also complains
445453
$ if -DEBUG is not passed to the linker when building with ASan.
446454
ASAN_LDFLAGS="-debug"
455+
# -fsanitize-address-use-after-return is off by default in MS Visual Studio 22 (19.37.32824).
456+
# cl : Command line warning D9002 : ignoring unknown option '-fno-sanitize-address-use-after-return'
447457
fi
448458
JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS"
449459
JVM_LDFLAGS="$JVM_LDFLAGS $ASAN_LDFLAGS"
@@ -672,7 +682,7 @@ AC_DEFUN([JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT],
672682
UTIL_ARG_ENABLE(NAME: compatible-cds-alignment, DEFAULT: $COMPATIBLE_CDS_ALIGNMENT_DEFAULT,
673683
RESULT: ENABLE_COMPATIBLE_CDS_ALIGNMENT,
674684
DESC: [enable use alternative compatible cds core region alignment],
675-
DEFAULT_DESC: [disabled],
685+
DEFAULT_DESC: [disabled except on linux-aarch64],
676686
CHECKING_MSG: [if compatible cds region alignment enabled],
677687
CHECK_AVAILABLE: [
678688
AC_MSG_CHECKING([if CDS archive is available])

src/hotspot/cpu/ppc/assembler_ppc.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -350,6 +350,7 @@ class Assembler : public AbstractAssembler {
350350

351351
SETBC_OPCODE = (31u << OPCODE_SHIFT | 384u << 1),
352352
SETNBC_OPCODE = (31u << OPCODE_SHIFT | 448u << 1),
353+
SETBCR_OPCODE = (31u << OPCODE_SHIFT | 416u << 1),
353354

354355
// condition register logic instructions
355356
CRAND_OPCODE = (19u << OPCODE_SHIFT | 257u << 1),
@@ -1780,6 +1781,8 @@ class Assembler : public AbstractAssembler {
17801781
inline void setbc( Register d, ConditionRegister cr, Condition cc);
17811782
inline void setnbc(Register d, int biint);
17821783
inline void setnbc(Register d, ConditionRegister cr, Condition cc);
1784+
inline void setbcr(Register d, int biint);
1785+
inline void setbcr(Register d, ConditionRegister cr, Condition cc);
17831786

17841787
// Special purpose registers
17851788
// Exception Register

src/hotspot/cpu/ppc/assembler_ppc.inline.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2012, 2020 SAP SE. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -419,6 +419,11 @@ inline void Assembler::setnbc(Register d, int biint)
419419
inline void Assembler::setnbc(Register d, ConditionRegister cr, Condition cc) {
420420
setnbc(d, bi0(cr, cc));
421421
}
422+
inline void Assembler::setbcr(Register d, int biint)
423+
{ emit_int32(SETBCR_OPCODE | rt(d) | bi(biint)); }
424+
inline void Assembler::setbcr(Register d, ConditionRegister cr, Condition cc) {
425+
setbcr(d, bi0(cr, cc));
426+
}
422427

423428
// Special purpose registers
424429
// Exception Register

src/hotspot/cpu/ppc/macroAssembler_ppc.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,10 +2383,7 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass,
23832383
addi(r_array_base, r_array_base, Array<Klass*>::base_offset_in_bytes());
23842384

23852385
// convert !=0 to 1
2386-
neg(R0, result);
2387-
orr(result, result, R0);
2388-
srdi(result, result, 63);
2389-
2386+
normalize_bool(result, R0, true);
23902387
const Register linear_result = r_array_index; // reuse
23912388
li(linear_result, 1);
23922389
cmpdi(CCR0, r_array_length, 0);
@@ -2395,9 +2392,7 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass,
23952392
bind(failure);
23962393

23972394
// convert !=0 to 1
2398-
neg(R0, linear_result);
2399-
orr(linear_result, linear_result, R0);
2400-
srdi(linear_result, linear_result, 63);
2395+
normalize_bool(linear_result, R0, true);
24012396

24022397
cmpd(CCR0, result, linear_result);
24032398
beq(CCR0, passed);

src/hotspot/cpu/ppc/macroAssembler_ppc.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ class MacroAssembler: public Assembler {
178178
void inline set_cmp3(Register dst);
179179
// set dst to (treat_unordered_like_less ? -1 : +1)
180180
void inline set_cmpu3(Register dst, bool treat_unordered_like_less);
181+
// Branch-free implementation to convert !=0 to 1.
182+
void inline normalize_bool(Register dst, Register temp = R0, bool is_64bit = false);
181183

182184
inline void pd_patch_instruction(address branch, address target, const char* file, int line);
183185
NOT_PRODUCT(static void pd_print_patched_instruction(address branch);)

src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2012, 2021 SAP SE. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -264,6 +264,29 @@ inline void MacroAssembler::set_cmpu3(Register dst, bool treat_unordered_like_le
264264
set_cmp3(dst);
265265
}
266266

267+
// Branch-free implementation to convert !=0 to 1
268+
// Set register dst to 1 if dst is non-zero. Uses setbcr instruction on Power10.
269+
inline void MacroAssembler::normalize_bool(Register dst, Register temp, bool is_64bit) {
270+
271+
if (VM_Version::has_brw()) {
272+
if (is_64bit) {
273+
cmpdi(CCR0, dst, 0);
274+
} else {
275+
cmpwi(CCR0, dst, 0);
276+
}
277+
setbcr(dst, CCR0, Assembler::equal);
278+
} else {
279+
assert_different_registers(temp, dst);
280+
neg(temp, dst);
281+
orr(temp, dst, temp);
282+
if (is_64bit) {
283+
srdi(dst, temp, 63);
284+
} else {
285+
srwi(dst, temp, 31);
286+
}
287+
}
288+
}
289+
267290
// Convenience bc_far versions
268291
inline void MacroAssembler::blt_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, less), L, optimize); }
269292
inline void MacroAssembler::bgt_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, greater), L, optimize); }

src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,11 +2472,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
24722472
case T_ARRAY: break;
24732473

24742474
case T_BOOLEAN: { // 0 -> false(0); !0 -> true(1)
2475-
Label skip_modify;
2476-
__ cmpwi(CCR0, R3_RET, 0);
2477-
__ beq(CCR0, skip_modify);
2478-
__ li(R3_RET, 1);
2479-
__ bind(skip_modify);
2475+
__ normalize_bool(R3_RET);
24802476
break;
24812477
}
24822478
case T_BYTE: { // sign extension

src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,7 @@ address TemplateInterpreterGenerator::generate_result_handler_for(BasicType type
372372
switch (type) {
373373
case T_BOOLEAN:
374374
// convert !=0 to 1
375-
__ neg(R0, R3_RET);
376-
__ orr(R0, R3_RET, R0);
377-
__ srwi(R3_RET, R0, 31);
375+
__ normalize_bool(R3_RET);
378376
break;
379377
case T_BYTE:
380378
// sign extend 8 bits

src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,22 @@ void LIR_Assembler::monitor_address(int monitor_no, LIR_Opr dst) {
16071607
__ la(dst->as_register(), frame_map()->address_for_monitor_lock(monitor_no));
16081608
}
16091609

1610-
void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) { Unimplemented(); }
1610+
void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) {
1611+
assert(op->crc()->is_single_cpu(), "crc must be register");
1612+
assert(op->val()->is_single_cpu(), "byte value must be register");
1613+
assert(op->result_opr()->is_single_cpu(), "result must be register");
1614+
Register crc = op->crc()->as_register();
1615+
Register val = op->val()->as_register();
1616+
Register res = op->result_opr()->as_register();
1617+
1618+
assert_different_registers(val, crc, res);
1619+
__ la(res, ExternalAddress(StubRoutines::crc_table_addr()));
1620+
1621+
__ notr(crc, crc); // ~crc
1622+
__ zero_extend(crc, crc, 32);
1623+
__ update_byte_crc32(crc, val, res);
1624+
__ notr(res, crc); // ~crc
1625+
}
16111626

16121627
void LIR_Assembler::check_conflict(ciKlass* exact_klass, intptr_t current_klass,
16131628
Register tmp, Label &next, Label &none,

src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,79 @@ void LIRGenerator::do_ArrayCopy(Intrinsic* x) {
781781
}
782782

783783
void LIRGenerator::do_update_CRC32(Intrinsic* x) {
784-
ShouldNotReachHere();
784+
assert(UseCRC32Intrinsics, "why are we here?");
785+
// Make all state_for calls early since they can emit code
786+
LIR_Opr result = rlock_result(x);
787+
switch (x->id()) {
788+
case vmIntrinsics::_updateCRC32: {
789+
LIRItem crc(x->argument_at(0), this);
790+
LIRItem val(x->argument_at(1), this);
791+
// val is destroyed by update_crc32
792+
val.set_destroys_register();
793+
crc.load_item();
794+
val.load_item();
795+
__ update_crc32(crc.result(), val.result(), result);
796+
break;
797+
}
798+
case vmIntrinsics::_updateBytesCRC32:
799+
case vmIntrinsics::_updateByteBufferCRC32: {
800+
bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32);
801+
802+
LIRItem crc(x->argument_at(0), this);
803+
LIRItem buf(x->argument_at(1), this);
804+
LIRItem off(x->argument_at(2), this);
805+
LIRItem len(x->argument_at(3), this);
806+
buf.load_item();
807+
off.load_nonconstant();
808+
809+
LIR_Opr index = off.result();
810+
int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
811+
if (off.result()->is_constant()) {
812+
index = LIR_OprFact::illegalOpr;
813+
offset += off.result()->as_jint();
814+
}
815+
LIR_Opr base_op = buf.result();
816+
817+
if (index->is_valid()) {
818+
LIR_Opr tmp = new_register(T_LONG);
819+
__ convert(Bytecodes::_i2l, index, tmp);
820+
index = tmp;
821+
}
822+
823+
if (offset) {
824+
LIR_Opr tmp = new_pointer_register();
825+
__ add(base_op, LIR_OprFact::intConst(offset), tmp);
826+
base_op = tmp;
827+
offset = 0;
828+
}
829+
830+
LIR_Address* a = new LIR_Address(base_op,
831+
index,
832+
offset,
833+
T_BYTE);
834+
BasicTypeList signature(3);
835+
signature.append(T_INT);
836+
signature.append(T_ADDRESS);
837+
signature.append(T_INT);
838+
CallingConvention* cc = frame_map()->c_calling_convention(&signature);
839+
const LIR_Opr result_reg = result_register_for(x->type());
840+
841+
LIR_Opr addr = new_pointer_register();
842+
__ leal(LIR_OprFact::address(a), addr);
843+
844+
crc.load_item_force(cc->at(0));
845+
__ move(addr, cc->at(1));
846+
len.load_item_force(cc->at(2));
847+
848+
__ call_runtime_leaf(StubRoutines::updateBytesCRC32(), getThreadTemp(), result_reg, cc->args());
849+
__ move(result_reg, result);
850+
851+
break;
852+
}
853+
default: {
854+
ShouldNotReachHere();
855+
}
856+
}
785857
}
786858

787859
void LIRGenerator::do_update_CRC32C(Intrinsic* x) {

0 commit comments

Comments
 (0)