Skip to content

Commit

Permalink
Merge jdk-24+11 into rivos/main (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
luhenry authored Aug 16, 2024
2 parents 1da5fd1 + 68c2ad4 commit c99cea1
Show file tree
Hide file tree
Showing 321 changed files with 4,696 additions and 5,141 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ jobs:
-H 'Accept: application/vnd.github+json' \
-H 'Authorization: Bearer ${{ github.token }}' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts')"
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts?per_page=100')"
BUNDLE_ARTIFACT_IDS="$(echo "$ALL_ARTIFACT_IDS" | jq -r -c '.artifacts | map(select(.name|startswith("bundles-"))) | .[].id')"
for id in $BUNDLE_ARTIFACT_IDS; do
echo "Removing $id"
Expand Down
2 changes: 2 additions & 0 deletions make/autoconf/flags-ldflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r"
if test "x$OPENJDK_TARGET_OS" = xlinux; then
# Clang needs the lld linker to work correctly
BASIC_LDFLAGS="-fuse-ld=lld -Wl,--exclude-libs,ALL"
UTIL_REQUIRE_PROGS(LLD, lld)
fi
if test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_LDFLAGS="-Wl,-b64 -Wl,-brtl -Wl,-bnorwexec -Wl,-bnolibpath -Wl,-bnoexpall \
Expand Down
3 changes: 3 additions & 0 deletions make/autoconf/toolchain.m4
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
test_metal=`$METAL --version 2>&1`
if test $? -ne 0; then
AC_MSG_RESULT([no])
AC_MSG_NOTICE([A full XCode is required to build the JDK (not only command line tools)])
AC_MSG_NOTICE([If you have XCode installed, you might need to reset the Xcode active developer directory])
AC_MSG_NOTICE([using 'sudo xcode-select -r'])
AC_MSG_ERROR([XCode tool 'metal' neither found in path nor with xcrun])
else
AC_MSG_RESULT([yes, will be using '$METAL'])
Expand Down
5 changes: 5 additions & 0 deletions make/common/native/Link.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ define CreateStaticLibrary
$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \
$$($1_LD) $(LDFLAGS_CXX_PARTIAL_LINKING) $$($1_SYSROOT_LDFLAGS) \
-o $$($1_TARGET_RELOCATABLE) $$($1_LD_OBJ_ARG))
# 'ld -r' might invalidate the .llvm_addrsig section, and this will cause subsequent
# calls to lld (with '-Wl,--icf=safe') to fail when linking with this library, so
# remove that section.
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_objcopy_remove_llvm_addrsig_section, \
$$($1_OBJCOPY) --remove-section=.llvm_addrsig $$($1_TARGET_RELOCATABLE))
endif
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_run_ar, \
$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \
Expand Down
3 changes: 2 additions & 1 deletion make/hotspot/lib/CompileGtest.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \
$(GTEST_FRAMEWORK_SRC)/googletest/src \
$(GTEST_FRAMEWORK_SRC)/googlemock/src, \
INCLUDE_FILES := gtest-all.cc gmock-all.cc, \
DISABLED_WARNINGS_gcc := undef unused-result format-nonliteral maybe-uninitialized, \
DISABLED_WARNINGS_gcc := undef unused-result format-nonliteral \
maybe-uninitialized zero-as-null-pointer-constant, \
DISABLED_WARNINGS_clang := undef unused-result format-nonliteral, \
DEFAULT_CFLAGS := false, \
CFLAGS := $(JVM_CFLAGS) \
Expand Down
4 changes: 0 additions & 4 deletions make/modules/java.desktop/lib/AwtLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
DISABLED_WARNINGS_gcc := int-to-pointer-cast, \
DISABLED_WARNINGS_gcc_awt_Taskbar.c := parentheses, \
DISABLED_WARNINGS_gcc_GLXSurfaceData.c := unused-function, \
DISABLED_WARNINGS_gcc_gtk2_interface.c := parentheses type-limits, \
DISABLED_WARNINGS_gcc_gtk3_interface.c := parentheses type-limits \
unused-function, \
DISABLED_WARNINGS_gcc_OGLBufImgOps.c := format-nonliteral, \
Expand All @@ -252,7 +251,6 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
DISABLED_WARNINGS_gcc_XToolkit.c := unused-result, \
DISABLED_WARNINGS_gcc_XWindow.c := unused-function, \
DISABLED_WARNINGS_clang_awt_Taskbar.c := parentheses, \
DISABLED_WARNINGS_clang_gtk2_interface.c := parentheses, \
DISABLED_WARNINGS_clang_gtk3_interface.c := parentheses, \
DISABLED_WARNINGS_clang_OGLBufImgOps.c := format-nonliteral, \
DISABLED_WARNINGS_clang_OGLPaints.c := format-nonliteral, \
Expand All @@ -262,8 +260,6 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
DISABLED_WARNINGS_clang_aix_awt_Taskbar.c := parentheses, \
DISABLED_WARNINGS_clang_aix_OGLPaints.c := format-nonliteral, \
DISABLED_WARNINGS_clang_aix_OGLBufImgOps.c := format-nonliteral, \
DISABLED_WARNINGS_clang_aix_gtk2_interface.c := parentheses \
logical-op-parentheses, \
DISABLED_WARNINGS_clang_aix_gtk3_interface.c := parentheses \
logical-op-parentheses, \
DISABLED_WARNINGS_clang_aix_sun_awt_X11_GtkFileDialogPeer.c := \
Expand Down
13 changes: 13 additions & 0 deletions src/hotspot/cpu/aarch64/aarch64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -16184,6 +16184,19 @@ instruct TailjmpInd(iRegPNoSpNoRfp jump_target, iRegP_R0 ex_oop)
ins_pipe(pipe_class_call);
%}

// Forward exception.
instruct ForwardExceptionjmp()
%{
match(ForwardException);
ins_cost(CALL_COST);

format %{ "b forward_exception_stub" %}
ins_encode %{
__ far_jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
%}
ins_pipe(pipe_class_call);
%}

// Create exception oop: created by stack-crawling runtime code.
// Created exception is now available to this handler, and is setup
// just prior to jumping to this handler. No code emitted.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/immediate_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ static int expandLogicalImmediate(uint32_t immN, uint32_t immr,
uint64_t and_bits_sub = replicate(and_bit, 1, nbits);
uint64_t or_bits_sub = replicate(or_bit, 1, nbits);
uint64_t and_bits_top = (and_bits_sub << nbits) | ones(nbits);
uint64_t or_bits_top = (0 << nbits) | or_bits_sub;
uint64_t or_bits_top = (UCONST64(0) << nbits) | or_bits_sub;

tmask = ((tmask
& (replicate(and_bits_top, 2 * nbits, 32 / nbits)))
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -201,7 +201,7 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {

{
__ enter();
__ lea(rscratch1, ExternalAddress(slow_case_addr));
__ lea(rscratch1, RuntimeAddress(slow_case_addr));
__ blr(rscratch1);
__ leave();
__ ret(lr);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1730,8 +1730,8 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl
// The bitmap is full to bursting.
// Implicit invariant: BITMAP_FULL implies (length > 0)
assert(Klass::SECONDARY_SUPERS_BITMAP_FULL == ~uintx(0), "");
cmn(r_bitmap, (u1)1);
br(EQ, L_huge);
cmpw(r_array_length, (u1)(Klass::SECONDARY_SUPERS_TABLE_SIZE - 2));
br(GT, L_huge);

// NB! Our caller has checked bits 0 and 1 in the bitmap. The
// current slot (at secondary_supers[r_array_index]) has not yet
Expand Down
12 changes: 2 additions & 10 deletions src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1883,16 +1883,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,

// Check for safepoint operation in progress and/or pending suspend requests.
{
// We need an acquire here to ensure that any subsequent load of the
// global SafepointSynchronize::_state flag is ordered after this load
// of the thread-local polling word. We don't want this poll to
// return false (i.e. not safepointing) and a later poll of the global
// SafepointSynchronize::_state spuriously to return true.
//
// This is to avoid a race when we're in a native->Java transition
// racing the code which wakes up from a safepoint.

__ safepoint_poll(safepoint_in_progress, true /* at_return */, true /* acquire */, false /* in_nmethod */);
// No need for acquire as Java threads always disarm themselves.
__ safepoint_poll(safepoint_in_progress, true /* at_return */, false /* acquire */, false /* in_nmethod */);
__ ldrw(rscratch1, Address(rthread, JavaThread::suspend_flags_offset()));
__ cbnzw(rscratch1, safepoint_in_progress);
__ bind(safepoint_in_progress_done);
Expand Down
11 changes: 2 additions & 9 deletions src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1413,15 +1413,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
{
Label L, Continue;

// We need an acquire here to ensure that any subsequent load of the
// global SafepointSynchronize::_state flag is ordered after this load
// of the thread-local polling word. We don't want this poll to
// return false (i.e. not safepointing) and a later poll of the global
// SafepointSynchronize::_state spuriously to return true.
//
// This is to avoid a race when we're in a native->Java transition
// racing the code which wakes up from a safepoint.
__ safepoint_poll(L, true /* at_return */, true /* acquire */, false /* in_nmethod */);
// No need for acquire as Java threads always disarm themselves.
__ safepoint_poll(L, true /* at_return */, false /* acquire */, false /* in_nmethod */);
__ ldrw(rscratch2, Address(rthread, JavaThread::suspend_flags_offset()));
__ cbz(rscratch2, Continue);
__ bind(L);
Expand Down
14 changes: 14 additions & 0 deletions src/hotspot/cpu/arm/arm.ad
Original file line number Diff line number Diff line change
Expand Up @@ -8953,6 +8953,20 @@ instruct tailjmpInd(IPRegP jump_target, RExceptionRegP ex_oop) %{
ins_pipe(tail_call);
%}

// Forward exception.
instruct ForwardExceptionjmp()
%{
match(ForwardException);
ins_cost(CALL_COST);

format %{ "b forward_exception_stub" %}
ins_encode %{
// OK to trash Rtemp, because Rtemp is used by stub
__ jump(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type, Rtemp);
%}
ins_pipe(tail_call);
%}

// Create exception oop: created by stack-crawling runtime code.
// Created exception is now available to this handler, and is setup
// just prior to jumping to this handler. No code emitted.
Expand Down
15 changes: 15 additions & 0 deletions src/hotspot/cpu/ppc/ppc.ad
Original file line number Diff line number Diff line change
Expand Up @@ -14534,6 +14534,21 @@ instruct tailjmpInd(iRegPdstNoScratch jump_target, rarg1RegP ex_oop) %{
ins_pipe(pipe_class_call);
%}

// Forward exception.
instruct ForwardExceptionjmp()
%{
match(ForwardException);
ins_cost(CALL_COST);

format %{ "Jmp forward_exception_stub" %}
ins_encode %{
__ set_inst_mark();
__ b64_patchable(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type);
__ clear_inst_mark();
%}
ins_pipe(pipe_class_call);
%}

// Create exception oop: created by stack-crawling runtime code.
// Created exception is now available to this handler, and is setup
// just prior to jumping to this handler. No code emitted.
Expand Down
13 changes: 13 additions & 0 deletions src/hotspot/cpu/riscv/assembler_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,19 @@ enum Nf {

#undef INSN

#define INSN(NAME, op, width, umop, mop, mew, nf) \
void NAME(VectorRegister Vd_or_Vs3, Register Rs1, VectorMask vm = unmasked) { \
patch_VLdSt(op, Vd_or_Vs3, width, Rs1, umop, vm, mop, mew, nf); \
}

// Vector Unit-Stride Segment Load Instructions
INSN(vlseg3e8_v, 0b0000111, 0b000, 0b00000, 0b00, 0b0, g3);

// Vector Unit-Stride Segment Store Instructions
INSN(vsseg4e8_v, 0b0100111, 0b000, 0b00000, 0b00, 0b0, g4);

#undef INSN

#define INSN(NAME, op, width, mop, mew) \
void NAME(VectorRegister Vd, Register Rs1, VectorRegister Vs2, VectorMask vm = unmasked, Nf nf = g1) { \
patch_VLdSt(op, Vd, width, Rs1, Vs2->raw_encoding(), vm, mop, mew, nf); \
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void LIR_Assembler::const2mem(LIR_Opr src, LIR_Opr dest, BasicType type, CodeEmi
insn = &MacroAssembler::sw; break;
case T_OBJECT: // fall through
case T_ARRAY:
assert(c->as_jobject() == 0, "should be");
assert(c->as_jobject() == nullptr, "should be");
if (UseCompressedOops && !wide) {
insn = &MacroAssembler::sw;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,4 +1066,4 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {

#undef __

const char *Runtime1::pd_name_for_address(address entry) { Unimplemented(); return 0; }
const char *Runtime1::pd_name_for_address(address entry) { Unimplemented(); }
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/frame_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void frame::patch_pc(Thread* thread, address pc) {

// Either the return address is the original one or we are going to
// patch in the same address that's already there.
assert(_pc == pc_old || pc == pc_old || pc_old == 0, "must be");
assert(_pc == pc_old || pc == pc_old || pc_old == nullptr, "must be");
DEBUG_ONLY(address old_pc = _pc;)
*pc_addr = pc;
_pc = pc; // must be set before call to get_deopt_original_pc
Expand Down
9 changes: 2 additions & 7 deletions src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -173,12 +173,7 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {

{
__ enter();
ExternalAddress target(slow_case_addr);
__ relocate(target.rspec(), [&] {
int32_t offset;
__ la(t0, target.target(), offset);
__ jalr(t0, offset);
});
__ rt_call(slow_case_addr);
__ leave();
__ ret();
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3973,8 +3973,8 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl

// Check if bitmap is SECONDARY_SUPERS_BITMAP_FULL
assert(Klass::SECONDARY_SUPERS_BITMAP_FULL == ~uintx(0), "Adjust this code");
addi(t0, r_bitmap, (u1)1);
beqz(t0, L_bitmap_full);
subw(t0, r_array_length, Klass::SECONDARY_SUPERS_TABLE_SIZE - 2);
bgtz(t0, L_bitmap_full);

// NB! Our caller has checked bits 0 and 1 in the bitmap. The
// current slot (at secondary_supers[r_array_index]) has not yet
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/nativeInst_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ address NativeJump::jump_destination() const {
// load

// return -1 if jump to self or to 0
if ((dest == (address) this) || dest == 0) {
if ((dest == (address) this) || dest == nullptr) {
dest = (address) -1;
}

Expand Down Expand Up @@ -714,7 +714,7 @@ address NativeGeneralJump::jump_destination() const {
// a general jump

// return -1 if jump to self or to 0
if ((dest == (address) this) || dest == 0) {
if ((dest == (address) this) || dest == nullptr) {
dest = (address) -1;
}

Expand Down
16 changes: 16 additions & 0 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
Expand Up @@ -10617,6 +10617,22 @@ instruct TailjmpInd(iRegPNoSpNoFp jump_target, iRegP_R10 ex_oop)
ins_pipe(pipe_class_call);
%}

// Forward exception.
instruct ForwardExceptionjmp()
%{
match(ForwardException);

ins_cost(BRANCH_COST);

format %{ "j forward_exception_stub\t#@ForwardException" %}

ins_encode %{
__ far_jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
%}

ins_pipe(pipe_class_call);
%}

// Create exception oop: created by stack-crawling runtime code.
// Created exception is now available to this handler, and is setup
// just prior to jumping to this handler. No code emitted.
Expand Down
Loading

0 comments on commit c99cea1

Please sign in to comment.