Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
theaoqi committed Dec 11, 2023
2 parents ffb601f + d354141 commit d24b593
Show file tree
Hide file tree
Showing 1,165 changed files with 23,217 additions and 12,414 deletions.
3 changes: 3 additions & 0 deletions make/Main.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,9 @@ else
# All modules include the main license files from java.base.
$(JMOD_TARGETS): java.base-copy

# jdk.javadoc uses an internal copy of the main license files from java.base.
jdk.javadoc-copy: java.base-copy

zip-security: $(filter jdk.crypto%, $(JAVA_TARGETS))

ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
Expand Down
2 changes: 1 addition & 1 deletion make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# do this on s390x also for libjvm (where serviceability agent is not supported)
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -fdata-sections"
if test "x$OPENJDK_TARGET_CPU" = xs390x; then
if test "x$OPENJDK_TARGET_CPU" = xs390x && test "x$DEBUG_LEVEL" == xrelease; then
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -fdata-sections"
fi
fi
Expand Down
15 changes: 12 additions & 3 deletions make/autoconf/lib-hsdis.m4
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,25 @@ AC_DEFUN([LIB_SETUP_HSDIS_BINUTILS],
disasm_header="\"$BINUTILS_INSTALL_DIR/include/dis-asm.h\""
if test -e $BINUTILS_INSTALL_DIR/lib/libbfd.a && \
test -e $BINUTILS_INSTALL_DIR/lib/libopcodes.a && \
test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a; then
(test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a || test -e $BINUTILS_INSTALL_DIR/lib64/libiberty.a); then
HSDIS_CFLAGS="-DLIBARCH_$OPENJDK_TARGET_CPU_LEGACY_LIB -I$BINUTILS_INSTALL_DIR/include"
HSDIS_LIBS="$BINUTILS_INSTALL_DIR/lib/libbfd.a $BINUTILS_INSTALL_DIR/lib/libopcodes.a $BINUTILS_INSTALL_DIR/lib/libiberty.a"
# libiberty ignores --libdir and may be installed in $BINUTILS_INSTALL_DIR/lib or $BINUTILS_INSTALL_DIR/lib64
# depending on system setup
LIBIBERTY_LIB=""
if test -e $BINUTILS_INSTALL_DIR/lib/libiberty.a; then
LIBIBERTY_LIB="$BINUTILS_INSTALL_DIR/lib/libiberty.a"
else
LIBIBERTY_LIB="$BINUTILS_INSTALL_DIR/lib64/libiberty.a"
fi
HSDIS_LIBS="$BINUTILS_INSTALL_DIR/lib/libbfd.a $BINUTILS_INSTALL_DIR/lib/libopcodes.a $LIBIBERTY_LIB"
# If we have libsframe add it.
if test -e $BINUTILS_INSTALL_DIR/lib/libsframe.a; then
HSDIS_LIBS="$HSDIS_LIBS $BINUTILS_INSTALL_DIR/lib/libsframe.a"
fi
AC_CHECK_LIB(z, deflate, [ HSDIS_LIBS="$HSDIS_LIBS -lz" ], AC_MSG_ERROR([libz not found]))
else
AC_MSG_ERROR(["$BINUTILS_INSTALL_DIR/libs/ must contain libbfd.a, libopcodes.a, libiberty.a"])
AC_MSG_ERROR(["$BINUTILS_INSTALL_DIR/lib[64] must contain libbfd.a, libopcodes.a and libiberty.a"])
fi
fi
Expand Down
8 changes: 4 additions & 4 deletions make/langtools/tools/javacserver/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
public class Client {
private static final Log.Level LOG_LEVEL = Log.Level.INFO;

// Wait 2 seconds for response, before giving up on javac server.
private static final int CONNECTION_TIMEOUT = 2000;
private static final int MAX_CONNECT_ATTEMPTS = 3;
// Wait 4 seconds for response, before giving up on javac server.
private static final int CONNECTION_TIMEOUT = 4000;
private static final int MAX_CONNECT_ATTEMPTS = 10;
private static final int WAIT_BETWEEN_CONNECT_ATTEMPTS = 2000;

private final ClientConfiguration conf;
Expand Down Expand Up @@ -130,7 +130,7 @@ private Socket tryConnect() throws IOException, InterruptedException {
Log.error("Connection attempt failed: " + ex.getMessage());
if (attempt >= MAX_CONNECT_ATTEMPTS) {
Log.error("Giving up");
throw new IOException("Could not connect to server", ex);
throw new IOException("Could not connect to server after " + MAX_CONNECT_ATTEMPTS + " attempts with timeout " + CONNECTION_TIMEOUT, ex);
}
}
Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS);
Expand Down
5 changes: 5 additions & 0 deletions make/modules/java.desktop/lib/Awt2dLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ else
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
LIBFONTMANAGER_EXCLUDE_FILES += libharfbuzz/hb-ft.cc

# list of disabled warnings and the compilers for which it was specifically added.
# array-bounds -> GCC 12 on Alpine Linux
# parentheses -> GCC 6
# range-loop-analysis -> clang on Xcode12

HARFBUZZ_DISABLED_WARNINGS_gcc := missing-field-initializers strict-aliasing \
unused-result array-bounds parentheses
# noexcept-type required for GCC 7 builds. Not required for GCC 8+.
Expand Down
47 changes: 47 additions & 0 deletions make/modules/jdk.javadoc/Copy.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Copyright (c) 2023, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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.
#

include CopyCommon.gmk

JDK_JAVADOC_DIR := $(JDK_OUTPUTDIR)/modules/jdk.javadoc
JDK_JAVADOC_DOCLET_RESOURCE_DIR := $(JDK_JAVADOC_DIR)/jdk/javadoc/internal/doclets/formats/html/resources

################################################################################

$(eval $(call SetupCopyFiles, COPY_JAVADOC_MODULE_LEGAL_RESOURCES, \
DEST := $(JDK_JAVADOC_DOCLET_RESOURCE_DIR)/legal, \
FILES := $(wildcard $(MODULE_SRC)/share/legal/*.md), \
))
TARGETS += $(COPY_JAVADOC_MODULE_LEGAL_RESOURCES)

################################################################################

$(eval $(call SetupCopyFiles, COPY_JAVADOC_COMMON_LEGAL_RESOURCES, \
DEST := $(JDK_JAVADOC_DOCLET_RESOURCE_DIR)/legal, \
FILES := $(wildcard $(COMMON_LEGAL_DST_DIR)/*), \
))
TARGETS += $(COPY_JAVADOC_COMMON_LEGAL_RESOURCES)

################################################################################
21 changes: 20 additions & 1 deletion src/hotspot/cpu/riscv/assembler_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,26 @@ enum operand_size { int8, int16, int32, uint32, int64 };

#undef INSN

// Float and Double Conversion Instruction
enum fclass_mask {
minf = 1 << 0, // negative infinite
mnorm = 1 << 1, // negative normal number
msubnorm = 1 << 2, // negative subnormal number
mzero = 1 << 3, // negative zero
pzero = 1 << 4, // positive zero
psubnorm = 1 << 5, // positive subnormal number
pnorm = 1 << 6, // positive normal number
pinf = 1 << 7, // positive infinite
snan = 1 << 8, // signaling NaN
qnan = 1 << 9, // quiet NaN
zero = mzero | pzero,
subnorm = msubnorm | psubnorm,
norm = mnorm | pnorm,
inf = minf | pinf,
nan = snan | qnan,
finite = zero | subnorm | norm,
};

// Float and Double Conversion/Classify Instruction
#define INSN(NAME, op, funct3, funct5, funct7) \
void NAME(Register Rd, FloatRegister Rs1) { \
unsigned insn = 0; \
Expand Down
10 changes: 7 additions & 3 deletions src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void LIR_Assembler::arithmetic_idiv(LIR_Code code, LIR_Opr left, LIR_Opr right,
}
} else {
Register rreg = right->as_register();
__ corrected_idivl(dreg, lreg, rreg, is_irem);
__ corrected_idivl(dreg, lreg, rreg, is_irem, /* is_signed */ true);
}
}

Expand Down Expand Up @@ -172,8 +172,12 @@ void LIR_Assembler::arith_op_double_cpu(LIR_Code code, LIR_Opr left, LIR_Opr rig
case lir_add: __ add(dest->as_register_lo(), lreg_lo, rreg_lo); break;
case lir_sub: __ sub(dest->as_register_lo(), lreg_lo, rreg_lo); break;
case lir_mul: __ mul(dest->as_register_lo(), lreg_lo, rreg_lo); break;
case lir_div: __ corrected_idivq(dest->as_register_lo(), lreg_lo, rreg_lo, false); break;
case lir_rem: __ corrected_idivq(dest->as_register_lo(), lreg_lo, rreg_lo, true); break;
case lir_div: __ corrected_idivq(dest->as_register_lo(), lreg_lo, rreg_lo,
/* want_remainder */ false, /* is_signed */ true);
break;
case lir_rem: __ corrected_idivq(dest->as_register_lo(), lreg_lo, rreg_lo,
/* want_remainder */ true, /* is_signed */ true);
break;
default:
ShouldNotReachHere();
}
Expand Down
12 changes: 4 additions & 8 deletions src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void C2_MacroAssembler::fast_lock(Register objectReg, Register boxReg, Register
if (DiagnoseSyncOnValueBasedClasses != 0) {
load_klass(flag, oop);
lwu(flag, Address(flag, Klass::access_flags_offset()));
test_bit(flag, flag, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS), tmp /* tmp */);
test_bit(flag, flag, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
bnez(flag, cont, true /* is_far */);
}

Expand Down Expand Up @@ -1571,7 +1571,7 @@ void C2_MacroAssembler::minmax_fp(FloatRegister dst, FloatRegister src1, FloatRe
is_double ? fclass_d(t1, src2)
: fclass_s(t1, src2);
orr(t0, t0, t1);
andi(t0, t0, 0b1100000000); //if src1 or src2 is quiet or signaling NaN then return NaN
andi(t0, t0, fclass_mask::nan); // if src1 or src2 is quiet or signaling NaN then return NaN
beqz(t0, Compare);
is_double ? fadd_d(dst, src1, src2)
: fadd_s(dst, src1, src2);
Expand Down Expand Up @@ -1669,12 +1669,8 @@ void C2_MacroAssembler::signum_fp(FloatRegister dst, FloatRegister src, FloatReg
is_double ? fmv_d(dst, src)
: fmv_s(dst, src);

//bitmask 0b1100011000 specifies this bits:
// 3 - src is -0
// 4 - src is +0
// 8 - src is signaling NaN
// 9 - src is a quiet NaN
andi(tmp1, tmp1, 0b1100011000);
// check if input is -0, +0, signaling NaN or quiet NaN
andi(tmp1, tmp1, fclass_mask::zero | fclass_mask::nan);

bnez(tmp1, done);

Expand Down
42 changes: 33 additions & 9 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2386,7 +2386,7 @@ void MacroAssembler::store_heap_oop_null(Address dst) {
}

int MacroAssembler::corrected_idivl(Register result, Register rs1, Register rs2,
bool want_remainder)
bool want_remainder, bool is_signed)
{
// Full implementation of Java idiv and irem. The function
// returns the (pc) offset of the div instruction - may be needed
Expand All @@ -2402,15 +2402,24 @@ int MacroAssembler::corrected_idivl(Register result, Register rs1, Register rs2,

int idivl_offset = offset();
if (!want_remainder) {
divw(result, rs1, rs2);
if (is_signed) {
divw(result, rs1, rs2);
} else {
divuw(result, rs1, rs2);
}
} else {
remw(result, rs1, rs2); // result = rs1 % rs2;
// result = rs1 % rs2;
if (is_signed) {
remw(result, rs1, rs2);
} else {
remuw(result, rs1, rs2);
}
}
return idivl_offset;
}

int MacroAssembler::corrected_idivq(Register result, Register rs1, Register rs2,
bool want_remainder)
bool want_remainder, bool is_signed)
{
// Full implementation of Java ldiv and lrem. The function
// returns the (pc) offset of the div instruction - may be needed
Expand All @@ -2425,9 +2434,18 @@ int MacroAssembler::corrected_idivq(Register result, Register rs1, Register rs2,

int idivq_offset = offset();
if (!want_remainder) {
div(result, rs1, rs2);
if (is_signed) {
div(result, rs1, rs2);
} else {
divu(result, rs1, rs2);
}
} else {
rem(result, rs1, rs2); // result = rs1 % rs2;
// result = rs1 % rs2;
if (is_signed) {
rem(result, rs1, rs2);
} else {
remu(result, rs1, rs2);
}
}
return idivq_offset;
}
Expand Down Expand Up @@ -4228,7 +4246,7 @@ void MacroAssembler::FLOATCVT##_safe(Register dst, FloatRegister src, Register t
fclass_##FLOATSIG(tmp, src); \
mv(dst, zr); \
/* check if src is NaN */ \
andi(tmp, tmp, 0b1100000000); \
andi(tmp, tmp, fclass_mask::nan); \
bnez(tmp, done); \
FLOATCVT(dst, src); \
bind(done); \
Expand Down Expand Up @@ -4659,13 +4677,19 @@ void MacroAssembler::rt_call(address dest, Register tmp) {
}
}

void MacroAssembler::test_bit(Register Rd, Register Rs, uint32_t bit_pos, Register tmp) {
void MacroAssembler::test_bit(Register Rd, Register Rs, uint32_t bit_pos) {
assert(bit_pos < 64, "invalid bit range");
if (UseZbs) {
bexti(Rd, Rs, bit_pos);
return;
}
andi(Rd, Rs, 1UL << bit_pos, tmp);
int64_t imm = (int64_t)(1UL << bit_pos);
if (is_simm12(imm)) {
and_imm12(Rd, Rs, imm);
} else {
srli(Rd, Rs, bit_pos);
and_imm12(Rd, Rd, 1);
}
}

// Implements lightweight-locking.
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ class MacroAssembler: public Assembler {

// idiv variant which deals with MINLONG as dividend and -1 as divisor
int corrected_idivl(Register result, Register rs1, Register rs2,
bool want_remainder);
bool want_remainder, bool is_signed);
int corrected_idivq(Register result, Register rs1, Register rs2,
bool want_remainder);
bool want_remainder, bool is_signed);

// interface method calling
void lookup_interface_method(Register recv_klass,
Expand Down Expand Up @@ -1240,7 +1240,7 @@ class MacroAssembler: public Assembler {
void shadd(Register Rd, Register Rs1, Register Rs2, Register tmp, int shamt);

// test single bit in Rs, result is set to Rd
void test_bit(Register Rd, Register Rs, uint32_t bit_pos, Register tmp = t0);
void test_bit(Register Rd, Register Rs, uint32_t bit_pos);

// Here the float instructions with safe deal with some exceptions.
// e.g. convert from NaN, +Inf, -Inf to int, float, double
Expand Down
Loading

0 comments on commit d24b593

Please sign in to comment.