Skip to content

Commit

Permalink
Merge pull request #1868 from SAP/pr-jdk-21.0.6+4
Browse files Browse the repository at this point in the history
Merge to tag jdk-21.0.6+4
  • Loading branch information
RealCLanger authored Nov 20, 2024
2 parents efdc8be + 1e46244 commit 46ad177
Show file tree
Hide file tree
Showing 120 changed files with 3,201 additions and 1,973 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ jobs:
with:
platform: macos-aarch64
runs-on: 'macos-14'
xcode-toolset-version: '14.3.1'
xcode-toolset-version: '15.4'
configure-arguments: ${{ github.event.inputs.configure-arguments }}
make-arguments: ${{ github.event.inputs.make-arguments }}
if: needs.select.outputs.macos-aarch64 == 'true'
Expand Down Expand Up @@ -317,6 +317,7 @@ jobs:
platform: macos-x64
bootjdk-platform: macos-x64
runs-on: macos-13
xcode-toolset-version: '14.3.1'

test-macos-aarch64:
name: macos-aarch64
Expand All @@ -327,6 +328,7 @@ jobs:
platform: macos-aarch64
bootjdk-platform: macos-aarch64
runs-on: macos-14
xcode-toolset-version: '15.4'

test-windows-x64:
name: windows-x64
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ on:
runs-on:
required: true
type: string
xcode-toolset-version:
required: false
type: string

env:
# These are needed to make the MSYS2 bash work properly
Expand Down Expand Up @@ -147,7 +150,7 @@ jobs:
run: |
# On macOS we need to install some dependencies for testing
brew install make
sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-toolset-version }}.app/Contents/Developer
# This will make GNU make available as 'make' and not only as 'gmake'
echo '/usr/local/opt/make/libexec/gnubin' >> $GITHUB_PATH
if: runner.os == 'macOS'
Expand Down
34 changes: 31 additions & 3 deletions make/RunTests.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, 2024, 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
Expand Down Expand Up @@ -743,8 +743,6 @@ define SetupRunJtregTestBody
# we may end up with a lot of JVM's
$1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $(AWK) 'BEGIN { print 25 / $$($1_JTREG_JOBS); }')

JTREG_TIMEOUT_FACTOR ?= 4

JTREG_VERBOSE ?= fail,error,summary
JTREG_RETAIN ?= fail,error
JTREG_TEST_THREAD_FACTORY ?=
Expand Down Expand Up @@ -832,6 +830,24 @@ define SetupRunJtregTestBody
$1_JTREG_BASIC_OPTIONS += $$(addprefix $$(JTREG_PROBLEM_LIST_PREFIX), $$($1_JTREG_PROBLEM_LIST))
endif

JTREG_ALL_OPTIONS := $$(JTREG_JAVA_OPTIONS) $$(JTREG_VM_OPTIONS)

JTREG_AUTO_PROBLEM_LISTS :=
JTREG_AUTO_TIMEOUT_FACTOR := 4

ifneq ($$(findstring -Xcomp, $$(JTREG_ALL_OPTIONS)), )
JTREG_AUTO_PROBLEM_LISTS += ProblemList-Xcomp.txt
JTREG_AUTO_TIMEOUT_FACTOR := 10
endif

ifneq ($$(findstring -XX:+UseZGC, $$(JTREG_ALL_OPTIONS)), )
ifneq ($$(findstring -XX:-ZGenerational, $$(JTREG_ALL_OPTIONS)), )
JTREG_AUTO_PROBLEM_LISTS += ProblemList-zgc.txt
else
JTREG_AUTO_PROBLEM_LISTS += ProblemList-generational-zgc.txt
endif
endif

ifneq ($$(JTREG_EXTRA_PROBLEM_LISTS), )
# Accept both absolute paths as well as relative to the current test root.
$1_JTREG_BASIC_OPTIONS += $$(addprefix $$(JTREG_PROBLEM_LIST_PREFIX), $$(wildcard \
Expand Down Expand Up @@ -863,6 +879,18 @@ define SetupRunJtregTestBody

$$(eval $$(call SetupRunJtregTestCustom, $1))

# SetupRunJtregTestCustom might also adjust JTREG_AUTO_ variables
# so set the final results after setting values from custom setup
ifneq ($$(JTREG_AUTO_PROBLEM_LISTS), )
# Accept both absolute paths as well as relative to the current test root.
$1_JTREG_BASIC_OPTIONS += $$(addprefix $$(JTREG_PROBLEM_LIST_PREFIX), $$(wildcard \
$$(JTREG_AUTO_PROBLEM_LISTS) \
$$(addprefix $$($1_TEST_ROOT)/, $$(JTREG_AUTO_PROBLEM_LISTS)) \
))
endif

JTREG_TIMEOUT_FACTOR ?= $$(JTREG_AUTO_TIMEOUT_FACTOR)

clean-outputdirs-$1:
$$(RM) -r $$($1_TEST_SUPPORT_DIR)
$$(RM) -r $$($1_TEST_RESULTS_DIR)
Expand Down
18 changes: 1 addition & 17 deletions src/hotspot/cpu/ppc/c2_init_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,5 @@
// Processor dependent initialization of C2 compiler for ppc.

void Compile::pd_compiler2_init() {

// Power7 and later.
if (PowerArchitecturePPC64 > 6) {
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
FLAG_SET_ERGO(UsePopCountInstruction, true);
}
}

if (!VM_Version::has_isel() && FLAG_IS_DEFAULT(ConditionalMoveLimit)) {
FLAG_SET_ERGO(ConditionalMoveLimit, 0);
}

if (OptimizeFill) {
warning("OptimizeFill is not supported on this CPU.");
FLAG_SET_DEFAULT(OptimizeFill, false);
}

guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "");
}
22 changes: 22 additions & 0 deletions src/hotspot/cpu/ppc/vm_version_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ void VM_Version::initialize() {
FLAG_SET_ERGO(TrapBasedRangeChecks, false);
}

// Power7 and later.
if (PowerArchitecturePPC64 > 6) {
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
FLAG_SET_ERGO(UsePopCountInstruction, true);
}
}

if (!VM_Version::has_isel() && FLAG_IS_DEFAULT(ConditionalMoveLimit)) {
FLAG_SET_ERGO(ConditionalMoveLimit, 0);
}

if (PowerArchitecturePPC64 >= 8) {
if (FLAG_IS_DEFAULT(SuperwordUseVSX)) {
FLAG_SET_ERGO(SuperwordUseVSX, true);
Expand Down Expand Up @@ -177,6 +188,17 @@ void VM_Version::initialize() {
FLAG_SET_DEFAULT(UseByteReverseInstructions, false);
}
}

if (OptimizeFill) {
warning("OptimizeFill is not supported on this CPU.");
FLAG_SET_DEFAULT(OptimizeFill, false);
}

if (OptoScheduling) {
// The OptoScheduling information is not maintained in ppd.ad.
warning("OptoScheduling is not supported on this CPU.");
FLAG_SET_DEFAULT(OptoScheduling, false);
}
#endif

// Create and print feature-string.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/s390/s390.ad
Original file line number Diff line number Diff line change
Expand Up @@ -2641,7 +2641,7 @@ operand uimmI5() %{
// operand type int
// Unsigned Integer Immediate: 9-bit
operand SSlenDW() %{
predicate(Immediate::is_uimm8(n->get_long()-1));
predicate(Immediate::is_uimm8((julong)n->get_long()-1));
match(ConL);
op_cost(1);
format %{ %}
Expand Down
15 changes: 15 additions & 0 deletions src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,21 @@ void os::print_context(outputStream *st, const void *context) {
st->print(", ERR=" INTPTR_FORMAT, (intptr_t)uc->uc_mcontext.gregs[REG_ERR]);
st->cr();
st->print(" TRAPNO=" INTPTR_FORMAT, (intptr_t)uc->uc_mcontext.gregs[REG_TRAPNO]);
// Add XMM registers + MXCSR. Note that C2 uses XMM to spill GPR values including pointers.
st->cr();
st->cr();
// Sanity check: fpregs should point into the context.
if ((address)uc->uc_mcontext.fpregs < (address)uc ||
pointer_delta(uc->uc_mcontext.fpregs, uc, 1) >= sizeof(ucontext_t)) {
st->print_cr("bad uc->uc_mcontext.fpregs: " INTPTR_FORMAT " (uc: " INTPTR_FORMAT ")",
p2i(uc->uc_mcontext.fpregs), p2i(uc));
} else {
for (int i = 0; i < 16; ++i) {
const int64_t* xmm_val_addr = (int64_t*)&(uc->uc_mcontext.fpregs->_xmm[i]);
st->print_cr("XMM[%d]=" INTPTR_FORMAT " " INTPTR_FORMAT, i, xmm_val_addr[1], xmm_val_addr[0]);
}
st->print(" MXCSR=" UINT32_FORMAT_X_0, uc->uc_mcontext.fpregs->mxcsr);
}
#else
st->print( "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]);
st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]);
Expand Down
9 changes: 9 additions & 0 deletions src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,15 @@ void os::print_context(outputStream *st, const void *context) {
st->cr();
st->print( "RIP=" INTPTR_FORMAT, uc->Rip);
st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
// Add XMM registers + MXCSR. Note that C2 uses XMM to spill GPR values including pointers.
st->cr();
st->cr();
for (int i = 0; i < 16; ++i) {
const uint64_t *xmm = ((const uint64_t*)&(uc->Xmm0)) + 2 * i;
st->print_cr("XMM[%d]=" INTPTR_FORMAT " " INTPTR_FORMAT,
i, xmm[1], xmm[0]);
}
st->print(" MXCSR=" UINT32_FORMAT_X_0, uc->MxCsr);
#else
st->print( "EAX=" INTPTR_FORMAT, uc->Eax);
st->print(", EBX=" INTPTR_FORMAT, uc->Ebx);
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/ci/ciEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,8 @@ void ciEnv::dump_replay_data_helper(outputStream* out) {
NoSafepointVerifier no_safepoint;
ResourceMark rm;

assert(this->task() != nullptr, "task must not be null");

dump_replay_data_version(out);
#if INCLUDE_JVMTI
out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables);
Expand All @@ -1675,9 +1677,7 @@ void ciEnv::dump_replay_data_helper(outputStream* out) {
objects->at(i)->dump_replay_data(out);
}

if (this->task() != nullptr) {
dump_compile_data(out);
}
dump_compile_data(out);
out->flush();
}

Expand Down
13 changes: 13 additions & 0 deletions src/hotspot/share/gc/z/zDirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,19 @@ static double calculate_young_to_old_worker_ratio(const ZDirectorStats& stats) {
const size_t reclaimed_per_old_gc = stats._old_stats._stat_heap._reclaimed_avg;
const double current_young_bytes_freed_per_gc_time = double(reclaimed_per_young_gc) / double(young_gc_time);
const double current_old_bytes_freed_per_gc_time = double(reclaimed_per_old_gc) / double(old_gc_time);

if (current_young_bytes_freed_per_gc_time == 0.0) {
if (current_old_bytes_freed_per_gc_time == 0.0) {
// Neither young nor old collections have reclaimed any memory.
// Give them equal priority.
return 1.0;
}

// Only old collections have reclaimed memory.
// Prioritize old.
return ZOldGCThreads;
}

const double old_vs_young_efficiency_ratio = current_old_bytes_freed_per_gc_time / current_young_bytes_freed_per_gc_time;

return old_vs_young_efficiency_ratio;
Expand Down
14 changes: 13 additions & 1 deletion src/hotspot/share/runtime/sharedRuntimeTrans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#include "jni.h"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "sanitizers/ub.hpp"

#include <limits>

// This file contains copies of the fdlibm routines used by
// StrictMath. It turns out that it is almost always required to use
Expand Down Expand Up @@ -110,11 +113,14 @@ ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */

static double zero = 0.0;

ATTRIBUTE_NO_UBSAN
static double __ieee754_log(double x) {
double hfsq,f,s,z,R,w,t1,t2,dk;
int k,hx,i,j;
unsigned lx;

static_assert(std::numeric_limits<double>::is_iec559, "IEEE 754 required");

hx = high(x); /* high word of x */
lx = low(x); /* low word of x */

Expand Down Expand Up @@ -204,11 +210,14 @@ ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */
log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */

ATTRIBUTE_NO_UBSAN
static double __ieee754_log10(double x) {
double y,z;
int i,k,hx;
unsigned lx;

static_assert(std::numeric_limits<double>::is_iec559, "IEEE 754 required");

hx = high(x); /* high word of x */
lx = low(x); /* low word of x */

Expand Down Expand Up @@ -440,13 +449,16 @@ bp[] = {1.0, 1.5,},
ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/
ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/

double __ieee754_pow(double x, double y) {
ATTRIBUTE_NO_UBSAN
static double __ieee754_pow(double x, double y) {
double z,ax,z_h,z_l,p_h,p_l;
double y1,t1,t2,r,s,t,u,v,w;
int i0,i1,i,j,k,yisint,n;
int hx,hy,ix,iy;
unsigned lx,ly;

static_assert(std::numeric_limits<double>::is_iec559, "IEEE 754 required");

i0 = ((*(int*)&one)>>29)^1; i1=1-i0;
hx = high(x); lx = low(x);
hy = high(y); ly = low(y);
Expand Down
14 changes: 13 additions & 1 deletion src/hotspot/share/utilities/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,22 @@ void disarm_assert_poison() {

static void store_context(const void* context) {
memcpy(&g_stored_assertion_context, context, sizeof(ucontext_t));
#if defined(LINUX) && defined(PPC64)
#if defined(LINUX)
// on Linux ppc64, ucontext_t contains pointers into itself which have to be patched up
// after copying the context (see comment in sys/ucontext.h):
#if defined(PPC64)
*((void**) &g_stored_assertion_context.uc_mcontext.regs) = &(g_stored_assertion_context.uc_mcontext.gp_regs);
#elif defined(AMD64)
// In the copied version, fpregs should point to the copied contents.
// Sanity check: fpregs should point into the context.
if ((address)((const ucontext_t*)context)->uc_mcontext.fpregs > (address)context) {
size_t fpregs_offset = pointer_delta(((const ucontext_t*)context)->uc_mcontext.fpregs, context, 1);
if (fpregs_offset < sizeof(ucontext_t)) {
// Preserve the offset.
*((void**) &g_stored_assertion_context.uc_mcontext.fpregs) = (void*)((address)(void*)&g_stored_assertion_context + fpregs_offset);
}
}
#endif
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/utilities/vmError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
skip_replay = true;
ciEnv* env = ciEnv::current();
if (env != nullptr) {
if (env != nullptr && env->task() != nullptr) {
const bool overwrite = false; // We do not overwrite an existing replay file.
int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer));
if (fd != -1) {
Expand Down
42 changes: 42 additions & 0 deletions src/java.base/share/native/libjava/ub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024 SAP SE. 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.
*
*/

#ifndef _UB_H_
#define _UB_H_

/* ATTRIBUTE_NO_UBSAN - Function attribute which informs the compiler to disable UBSan checks in the
* following function or method.
*/
#ifdef UNDEFINED_BEHAVIOR_SANITIZER
#if defined(__clang__) || defined(__GNUC__)
#define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined")))
#endif
#endif

#ifndef ATTRIBUTE_NO_UBSAN
#define ATTRIBUTE_NO_UBSAN
#endif

#endif
Loading

0 comments on commit 46ad177

Please sign in to comment.