Merge branch 'openjdk:master' into cas-alloc-1

This commit is contained in:
Xiaolong Peng 2026-01-07 16:21:44 -08:00 committed by GitHub
commit ef10341f73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
523 changed files with 14772 additions and 13590 deletions

View File

@ -96,6 +96,8 @@ jobs:
--with-boot-jdk=${{ steps.bootjdk.outputs.path }}
--with-zlib=system
--with-jmod-compress=zip-1
--with-external-symbols-in-bundles=none
--with-debug-info-level=1
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
echo "Dumping config.log:" &&
cat config.log &&

View File

@ -179,6 +179,8 @@ jobs:
--openjdk-target=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}
--with-sysroot=sysroot
--with-jmod-compress=zip-1
--with-external-symbols-in-bundles=none
--with-debug-info-level=1
CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-${{ inputs.gcc-major-version }}
CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-${{ inputs.gcc-major-version }}
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (

View File

@ -143,6 +143,8 @@ jobs:
--with-gtest=${{ steps.gtest.outputs.path }}
--with-zlib=system
--with-jmod-compress=zip-1
--with-external-symbols-in-bundles=none
--with-debug-info-level=1
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
echo "Dumping config.log:" &&
cat config.log &&

View File

@ -110,6 +110,8 @@ jobs:
--with-gtest=${{ steps.gtest.outputs.path }}
--with-zlib=system
--with-jmod-compress=zip-1
--with-external-symbols-in-bundles=none
--with-debug-info-level=1
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
echo "Dumping config.log:" &&
cat config.log &&

View File

@ -134,6 +134,7 @@ jobs:
--with-gtest=${{ steps.gtest.outputs.path }}
--with-msvc-toolset-version=${{ inputs.msvc-toolset-version }}
--with-jmod-compress=zip-1
--with-external-symbols-in-bundles=none
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
echo "Dumping config.log:" &&
cat config.log &&

View File

@ -69,6 +69,23 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
# Debug prefix mapping if supported by compiler
DEBUG_PREFIX_CFLAGS=
UTIL_ARG_WITH(NAME: debug-info-level, TYPE: string,
DEFAULT: "",
RESULT: DEBUG_INFO_LEVEL,
DESC: [Sets the debug info level, when debug info generation is enabled (GCC and Clang only)],
DEFAULT_DESC: [default])
AC_SUBST(DEBUG_INFO_LEVEL)
if test "x${TOOLCHAIN_TYPE}" = xgcc || \
test "x${TOOLCHAIN_TYPE}" = xclang; then
DEBUG_INFO_LEVEL_FLAGS="-g"
if test "x${DEBUG_INFO_LEVEL}" != "x"; then
DEBUG_INFO_LEVEL_FLAGS="-g${DEBUG_INFO_LEVEL}"
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${DEBUG_INFO_LEVEL_FLAGS}],
IF_FALSE: AC_MSG_ERROR("Debug info level ${DEBUG_INFO_LEVEL} is not supported"))
fi
fi
# Debug symbols
if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
@ -93,8 +110,9 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
)
fi
CFLAGS_DEBUG_SYMBOLS="-g -gdwarf-4"
ASFLAGS_DEBUG_SYMBOLS="-g"
# Debug info level should follow the debug format to be effective.
CFLAGS_DEBUG_SYMBOLS="-gdwarf-4 ${DEBUG_INFO_LEVEL_FLAGS}"
ASFLAGS_DEBUG_SYMBOLS="${DEBUG_INFO_LEVEL_FLAGS}"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
# Check if compiler supports -fdebug-prefix-map. If so, use that to make
@ -113,8 +131,9 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${GDWARF_FLAGS}],
IF_FALSE: [GDWARF_FLAGS=""])
CFLAGS_DEBUG_SYMBOLS="-g ${GDWARF_FLAGS}"
ASFLAGS_DEBUG_SYMBOLS="-g"
# Debug info level should follow the debug format to be effective.
CFLAGS_DEBUG_SYMBOLS="${GDWARF_FLAGS} ${DEBUG_INFO_LEVEL_FLAGS}"
ASFLAGS_DEBUG_SYMBOLS="${DEBUG_INFO_LEVEL_FLAGS}"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
CFLAGS_DEBUG_SYMBOLS="-Z7"
fi

View File

@ -114,7 +114,7 @@ EscapeDollar = $(subst $$,\$$,$(subst \$$,$$,$(strip $1)))
################################################################################
# This macro works just like EscapeDollar above, but for #.
EscapeHash = $(subst \#,\\\#,$(subst \\\#,\#,$(strip $1)))
EscapeHash = $(subst $(HASH),\$(HASH),$(subst \$(HASH),$(HASH),$(strip $1)))
################################################################################
# This macro translates $ into $$ to protect the string from make itself.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, 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.
*
@ -23,13 +23,13 @@
*
*/
#include <stdlib.h> // do not reorder
#include <stdint.h> // do not reorder
#include "cppstdlib/cstdlib.hpp"
#include "immediate_aarch64.hpp"
#include "metaprogramming/primitiveConversions.hpp"
#include "utilities/globalDefinitions.hpp"
#include <stdint.h>
// there are at most 2^13 possible logical immediate encodings
// however, some combinations of immr and imms are invalid
static const unsigned LI_TABLE_SIZE = (1 << 13);

View File

@ -1,4 +1,5 @@
/*
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -22,10 +23,10 @@
*
*/
#ifndef _IMMEDIATE_H
#define _IMMEDIATE_H
#ifndef CPU_AARCH64_IMMEDIATE_AARCH64_HPP
#define CPU_AARCH64_IMMEDIATE_AARCH64_HPP
#include <sys/types.h>
#include <stdint.h>
/*
* functions to map backwards and forwards between logical or floating
@ -51,4 +52,4 @@ uint32_t encoding_for_logical_immediate(uint64_t immediate);
uint64_t fp_immediate_for_encoding(uint32_t imm8, int is_dp);
uint32_t encoding_for_fp_immediate(float immediate);
#endif // _IMMEDIATE_H
#endif // CPU_AARCH64_IMMEDIATE_AARCH64_HPP

View File

@ -6259,14 +6259,10 @@ void MacroAssembler::fill_words(Register base, Register cnt, Register value)
// Intrinsic for
//
// - sun.nio.cs.ISO_8859_1.Encoder#encodeISOArray0(byte[] sa, int sp, byte[] da, int dp, int len)
// Encodes char[] to byte[] in ISO-8859-1
//
// - java.lang.StringCoding#encodeISOArray0(byte[] sa, int sp, byte[] da, int dp, int len)
// Encodes byte[] (containing UTF-16) to byte[] in ISO-8859-1
//
// - java.lang.StringCoding#encodeAsciiArray0(char[] sa, int sp, byte[] da, int dp, int len)
// Encodes char[] to byte[] in ASCII
// - sun/nio/cs/ISO_8859_1$Encoder.implEncodeISOArray
// return the number of characters copied.
// - java/lang/StringUTF16.compress
// return index of non-latin1 character if copy fails, otherwise 'len'.
//
// This version always returns the number of characters copied, and does not
// clobber the 'len' register. A successful copy will complete with the post-

View File

@ -2813,14 +2813,10 @@ void C2_MacroAssembler::char_array_compress_v(Register src, Register dst, Regist
// Intrinsic for
//
// - sun.nio.cs.ISO_8859_1.Encoder#encodeISOArray0(byte[] sa, int sp, byte[] da, int dp, int len)
// Encodes char[] to byte[] in ISO-8859-1
//
// - java.lang.StringCoding#encodeISOArray0(byte[] sa, int sp, byte[] da, int dp, int len)
// Encodes byte[] (containing UTF-16) to byte[] in ISO-8859-1
//
// - java.lang.StringCoding#encodeAsciiArray0(char[] sa, int sp, byte[] da, int dp, int len)
// Encodes char[] to byte[] in ASCII
// - sun/nio/cs/ISO_8859_1$Encoder.implEncodeISOArray
// return the number of characters copied.
// - java/lang/StringUTF16.compress
// return index of non-latin1 character if copy fails, otherwise 'len'.
//
// This version always returns the number of characters copied. A successful
// copy will complete with the post-condition: 'res' == 'len', while an

View File

@ -114,12 +114,12 @@ source %{
case Op_VectorCastHF2F:
case Op_VectorCastF2HF:
case Op_AddVHF:
case Op_SubVHF:
case Op_MulVHF:
case Op_DivVHF:
case Op_MaxVHF:
case Op_MinVHF:
case Op_MulVHF:
case Op_SqrtVHF:
case Op_SubVHF:
return UseZvfh;
case Op_FmaVHF:
return UseZvfh && UseFMA;
@ -147,13 +147,28 @@ source %{
if (!UseRVV) {
return false;
}
switch (opcode) {
case Op_SelectFromTwoVector:
// There is no masked version of selectFrom two vector, i.e. selectFrom(av, bv, mask) in vector API.
return false;
// Currently, the masked versions of the following 8 Float16 operations are disabled.
// When the support for Float16 vector classes is added in VectorAPI and the masked
// Float16 IR can be generated, these masked operations will be enabled and relevant
// backend support added.
case Op_AddVHF:
case Op_SubVHF:
case Op_MulVHF:
case Op_DivVHF:
case Op_MaxVHF:
case Op_MinVHF:
case Op_SqrtVHF:
case Op_FmaVHF:
return false;
default:
break;
}
return match_rule_supported_vector(opcode, vlen, bt);
}

View File

@ -6251,46 +6251,32 @@ void MacroAssembler::evpbroadcast(BasicType type, XMMRegister dst, Register src,
}
}
// Encode given char[]/byte[] to byte[] in ISO_8859_1 or ASCII
//
// @IntrinsicCandidate
// int sun.nio.cs.ISO_8859_1.Encoder#encodeISOArray0(
// char[] sa, int sp, byte[] da, int dp, int len) {
// int i = 0;
// for (; i < len; i++) {
// char c = sa[sp++];
// if (c > '\u00FF')
// break;
// da[dp++] = (byte) c;
// }
// return i;
// }
//
// @IntrinsicCandidate
// int java.lang.StringCoding.encodeISOArray0(
// byte[] sa, int sp, byte[] da, int dp, int len) {
// int i = 0;
// for (; i < len; i++) {
// char c = StringUTF16.getChar(sa, sp++);
// if (c > '\u00FF')
// break;
// da[dp++] = (byte) c;
// }
// return i;
// }
//
// @IntrinsicCandidate
// int java.lang.StringCoding.encodeAsciiArray0(
// char[] sa, int sp, byte[] da, int dp, int len) {
// int i = 0;
// for (; i < len; i++) {
// char c = sa[sp++];
// if (c >= '\u0080')
// break;
// da[dp++] = (byte) c;
// }
// return i;
// }
// encode char[] to byte[] in ISO_8859_1 or ASCII
//@IntrinsicCandidate
//private static int implEncodeISOArray(byte[] sa, int sp,
//byte[] da, int dp, int len) {
// int i = 0;
// for (; i < len; i++) {
// char c = StringUTF16.getChar(sa, sp++);
// if (c > '\u00FF')
// break;
// da[dp++] = (byte)c;
// }
// return i;
//}
//
//@IntrinsicCandidate
//private static int implEncodeAsciiArray(char[] sa, int sp,
// byte[] da, int dp, int len) {
// int i = 0;
// for (; i < len; i++) {
// char c = sa[sp++];
// if (c >= '\u0080')
// break;
// da[dp++] = (byte)c;
// }
// return i;
//}
void MacroAssembler::encode_iso_array(Register src, Register dst, Register len,
XMMRegister tmp1Reg, XMMRegister tmp2Reg,
XMMRegister tmp3Reg, XMMRegister tmp4Reg,

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2011, 2026, 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
@ -2633,17 +2633,19 @@ bool Matcher::supports_vector_calling_convention(void) {
return EnableVectorSupport;
}
static bool is_ndd_demotable_opr1(const MachNode* mdef) {
return ((mdef->flags() & Node::PD::Flag_ndd_demotable_opr1) != 0);
}
static bool is_ndd_demotable_opr2(const MachNode* mdef) {
return ((mdef->flags() & Node::PD::Flag_ndd_demotable_opr2) != 0);
}
#ifdef ASSERT
static bool is_ndd_demotable(const MachNode* mdef) {
return ((mdef->flags() & Node::PD::Flag_ndd_demotable) != 0);
}
static bool is_ndd_demotable_commutative(const MachNode* mdef) {
return ((mdef->flags() & Node::PD::Flag_ndd_demotable_commutative) != 0);
}
static bool is_demotion_candidate(const MachNode* mdef) {
return (is_ndd_demotable(mdef) || is_ndd_demotable_commutative(mdef));
return (is_ndd_demotable_opr1(mdef) || is_ndd_demotable_opr2(mdef));
}
#endif
bool Matcher::is_register_biasing_candidate(const MachNode* mdef,
int oper_index) {
@ -2653,8 +2655,8 @@ bool Matcher::is_register_biasing_candidate(const MachNode* mdef,
if (mdef->num_opnds() <= oper_index || mdef->operand_index(oper_index) < 0 ||
mdef->in(mdef->operand_index(oper_index)) == nullptr) {
assert(oper_index != 1 || !is_demotion_candidate(mdef), "%s", mdef->Name());
assert(oper_index != 2 || !is_ndd_demotable_commutative(mdef), "%s", mdef->Name());
assert(oper_index != 1 || !is_ndd_demotable_opr1(mdef), "%s", mdef->Name());
assert(oper_index != 2 || !is_ndd_demotable_opr2(mdef), "%s", mdef->Name());
return false;
}
@ -2662,14 +2664,13 @@ bool Matcher::is_register_biasing_candidate(const MachNode* mdef,
// address computation. Biasing def towards any address component will not
// result in NDD demotion by assembler.
if (mdef->operand_num_edges(oper_index) != 1) {
assert(!is_ndd_demotable(mdef), "%s", mdef->Name());
return false;
}
// Demotion candidate must be register mask compatible with definition.
const RegMask& oper_mask = mdef->in_RegMask(mdef->operand_index(oper_index));
if (!oper_mask.overlap(mdef->out_RegMask())) {
assert(!is_demotion_candidate(mdef), "%s", mdef->Name());
assert(!is_ndd_demotable(mdef), "%s", mdef->Name());
return false;
}
@ -2681,12 +2682,12 @@ bool Matcher::is_register_biasing_candidate(const MachNode* mdef,
// EVEX prefix with shorter REX/REX2 encoding. Demotion candidates
// are decorated with a special flag by instruction selector.
case 1:
return is_demotion_candidate(mdef);
return is_ndd_demotable_opr1(mdef);
// Definition operand of commutative operation can be biased towards second
// operand.
case 2:
return is_ndd_demotable_commutative(mdef);
return is_ndd_demotable_opr2(mdef);
// Current scheme only selects up to two biasing candidates
default:
@ -2888,9 +2889,9 @@ public:
Flag_clears_zero_flag = Node::_last_flag << 9,
Flag_clears_overflow_flag = Node::_last_flag << 10,
Flag_clears_sign_flag = Node::_last_flag << 11,
Flag_ndd_demotable = Node::_last_flag << 12,
Flag_ndd_demotable_commutative = Node::_last_flag << 13,
_last_flag = Flag_ndd_demotable_commutative
Flag_ndd_demotable_opr1 = Node::_last_flag << 12,
Flag_ndd_demotable_opr2 = Node::_last_flag << 13,
_last_flag = Flag_ndd_demotable_opr2
};
};
@ -9872,7 +9873,7 @@ instruct addI_rReg_ndd(rRegI dst, rRegI src1, rRegI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (AddI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
format %{ "eaddl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -9900,7 +9901,7 @@ instruct addI_rReg_rReg_imm_ndd(rRegI dst, rRegI src1, immI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (AddI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
format %{ "eaddl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -9943,7 +9944,7 @@ instruct addI_rReg_rReg_mem_ndd(rRegI dst, rRegI src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (AddI src1 (LoadI src2)));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(150);
format %{ "eaddl $dst, $src1, $src2\t# int ndd" %}
@ -10000,7 +10001,7 @@ instruct incI_rReg_ndd(rRegI dst, rRegI src, immI_1 val, rFlagsReg cr)
predicate(UseAPX && UseIncDec);
match(Set dst (AddI src val));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "eincl $dst, $src\t# int ndd" %}
ins_encode %{
@ -10055,7 +10056,7 @@ instruct decI_rReg_ndd(rRegI dst, rRegI src, immI_M1 val, rFlagsReg cr)
predicate(UseAPX && UseIncDec);
match(Set dst (AddI src val));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "edecl $dst, $src\t# int ndd" %}
ins_encode %{
@ -10162,7 +10163,7 @@ instruct addL_rReg_ndd(rRegL dst, rRegL src1, rRegL src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (AddL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
format %{ "eaddq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -10190,7 +10191,7 @@ instruct addL_rReg_rReg_imm_ndd(rRegL dst, rRegL src1, immL32 src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (AddL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
format %{ "eaddq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -10233,7 +10234,7 @@ instruct addL_rReg_rReg_mem_ndd(rRegL dst, rRegL src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (AddL src1 (LoadL src2)));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(150);
format %{ "eaddq $dst, $src1, $src2\t# long ndd" %}
@ -10289,7 +10290,7 @@ instruct incL_rReg_ndd(rRegL dst, rRegI src, immL1 val, rFlagsReg cr)
predicate(UseAPX && UseIncDec);
match(Set dst (AddL src val));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "eincq $dst, $src\t# long ndd" %}
ins_encode %{
@ -10344,7 +10345,7 @@ instruct decL_rReg_ndd(rRegL dst, rRegL src, immL_M1 val, rFlagsReg cr)
predicate(UseAPX && UseIncDec);
match(Set dst (AddL src val));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "edecq $dst, $src\t# long ndd" %}
ins_encode %{
@ -11059,7 +11060,7 @@ instruct subI_rReg_ndd(rRegI dst, rRegI src1, rRegI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (SubI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
format %{ "esubl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -11073,7 +11074,7 @@ instruct subI_rReg_rReg_imm_ndd(rRegI dst, rRegI src1, immI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (SubI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
format %{ "esubl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -11116,7 +11117,7 @@ instruct subI_rReg_rReg_mem_ndd(rRegI dst, rRegI src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (SubI src1 (LoadI src2)));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
ins_cost(150);
format %{ "esubl $dst, $src1, $src2\t# int ndd" %}
@ -11174,7 +11175,7 @@ instruct subL_rReg_ndd(rRegL dst, rRegL src1, rRegL src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (SubL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
format %{ "esubq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -11188,7 +11189,7 @@ instruct subL_rReg_rReg_imm_ndd(rRegL dst, rRegL src1, immL32 src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (SubL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
format %{ "esubq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -11231,7 +11232,7 @@ instruct subL_rReg_rReg_mem_ndd(rRegL dst, rRegL src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (SubL src1 (LoadL src2)));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_carry_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
ins_cost(150);
format %{ "esubq $dst, $src1, $src2\t# long ndd" %}
@ -11303,7 +11304,7 @@ instruct negI_rReg_ndd(rRegI dst, rRegI src, immI_0 zero, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (SubI zero src));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr2);
format %{ "enegl $dst, $src\t# int ndd" %}
ins_encode %{
@ -11331,7 +11332,7 @@ instruct negI_rReg_2_ndd(rRegI dst, rRegI src, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (NegI src));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
format %{ "enegl $dst, $src\t# int ndd" %}
ins_encode %{
@ -11372,7 +11373,7 @@ instruct negL_rReg_ndd(rRegL dst, rRegL src, immL0 zero, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (SubL zero src));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr2);
format %{ "enegq $dst, $src\t# long ndd" %}
ins_encode %{
@ -11400,7 +11401,7 @@ instruct negL_rReg_2_ndd(rRegL dst, rRegL src, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (NegL src));
effect(KILL cr);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_overflow_flag, PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_ndd_demotable_opr1);
format %{ "enegq $dst, $src\t# long ndd" %}
ins_encode %{
@ -11445,7 +11446,7 @@ instruct mulI_rReg_ndd(rRegI dst, rRegI src1, rRegI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (MulI src1 src2));
effect(KILL cr);
flag(PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(300);
format %{ "eimull $dst, $src1, $src2\t# int ndd" %}
@ -11487,7 +11488,7 @@ instruct mulI_rReg_rReg_mem_ndd(rRegI dst, rRegI src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (MulI src1 (LoadI src2)));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(350);
format %{ "eimull $dst, $src1, $src2\t# int ndd" %}
@ -11539,7 +11540,7 @@ instruct mulL_rReg_ndd(rRegL dst, rRegL src1, rRegL src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (MulL src1 src2));
effect(KILL cr);
flag(PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(300);
format %{ "eimulq $dst, $src1, $src2\t# long ndd" %}
@ -11581,7 +11582,7 @@ instruct mulL_rReg_rReg_mem_ndd(rRegL dst, rRegL src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (MulL src1 (LoadL src2)));
effect(KILL cr);
flag(PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(350);
format %{ "eimulq $dst, $src1, $src2 \t# long" %}
@ -11856,7 +11857,7 @@ instruct salI_rReg_immI2_ndd(rRegI dst, rRegI src, immI2 shift, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (LShiftI src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "esall $dst, $src, $shift\t# int(ndd)" %}
ins_encode %{
@ -11885,7 +11886,7 @@ instruct salI_rReg_imm_ndd(rRegI dst, rRegI src, immI8 shift, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (LShiftI src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "esall $dst, $src, $shift\t# int (ndd)" %}
ins_encode %{
@ -11992,7 +11993,7 @@ instruct sarI_rReg_imm_ndd(rRegI dst, rRegI src, immI8 shift, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (RShiftI src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "esarl $dst, $src, $shift\t# int (ndd)" %}
ins_encode %{
@ -12099,7 +12100,7 @@ instruct shrI_rReg_imm_ndd(rRegI dst, rRegI src, immI8 shift, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (URShiftI src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "eshrl $dst, $src, $shift\t # int (ndd)" %}
ins_encode %{
@ -12207,7 +12208,7 @@ instruct salL_rReg_immI2_ndd(rRegL dst, rRegL src, immI2 shift, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (LShiftL src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "esalq $dst, $src, $shift\t# long (ndd)" %}
ins_encode %{
@ -12236,7 +12237,7 @@ instruct salL_rReg_imm_ndd(rRegL dst, rRegL src, immI8 shift, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (LShiftL src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "esalq $dst, $src, $shift\t# long (ndd)" %}
ins_encode %{
@ -12343,7 +12344,7 @@ instruct sarL_rReg_imm_ndd(rRegL dst, rRegL src, immI shift, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (RShiftL src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "esarq $dst, $src, $shift\t# long (ndd)" %}
ins_encode %{
@ -12450,7 +12451,7 @@ instruct shrL_rReg_imm_ndd(rRegL dst, rRegL src, immI8 shift, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (URShiftL src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "eshrq $dst, $src, $shift\t# long (ndd)" %}
ins_encode %{
@ -12622,7 +12623,7 @@ instruct rolI_rReg_Var_ndd(rRegI dst, rRegI src, rcx_RegI shift, rFlagsReg cr)
predicate(UseAPX && n->bottom_type()->basic_type() == T_INT);
match(Set dst (RotateLeft src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "eroll $dst, $src, $shift\t# rotate left (int ndd)" %}
ins_encode %{
@ -12687,7 +12688,7 @@ instruct rorI_rReg_Var_ndd(rRegI dst, rRegI src, rcx_RegI shift, rFlagsReg cr)
predicate(UseAPX && n->bottom_type()->basic_type() == T_INT);
match(Set dst (RotateRight src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "erorl $dst, $src, $shift\t# rotate right(int ndd)" %}
ins_encode %{
@ -12754,7 +12755,7 @@ instruct rolL_rReg_Var_ndd(rRegL dst, rRegL src, rcx_RegI shift, rFlagsReg cr)
predicate(UseAPX && n->bottom_type()->basic_type() == T_LONG);
match(Set dst (RotateLeft src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "erolq $dst, $src, $shift\t# rotate left(long ndd)" %}
ins_encode %{
@ -12819,7 +12820,7 @@ instruct rorL_rReg_Var_ndd(rRegL dst, rRegL src, rcx_RegI shift, rFlagsReg cr)
predicate(UseAPX && n->bottom_type()->basic_type() == T_LONG);
match(Set dst (RotateRight src shift));
effect(KILL cr);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "erorq $dst, $src, $shift\t# rotate right(long ndd)" %}
ins_encode %{
@ -12897,7 +12898,7 @@ instruct andI_rReg_ndd(rRegI dst, rRegI src1, rRegI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (AndI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
format %{ "eandl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -12990,7 +12991,7 @@ instruct andI_rReg_rReg_imm_ndd(rRegI dst, rRegI src1, immI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (AndI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1);
format %{ "eandl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -13034,7 +13035,7 @@ instruct andI_rReg_rReg_mem_ndd(rRegI dst, rRegI src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (AndI src1 (LoadI src2)));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(150);
format %{ "eandl $dst, $src1, $src2\t# int ndd" %}
@ -13234,7 +13235,7 @@ instruct orI_rReg_ndd(rRegI dst, rRegI src1, rRegI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (OrI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
format %{ "eorl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -13263,7 +13264,7 @@ instruct orI_rReg_rReg_imm_ndd(rRegI dst, rRegI src1, immI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (OrI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1);
format %{ "eorl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -13277,7 +13278,7 @@ instruct orI_rReg_imm_rReg_ndd(rRegI dst, immI src1, rRegI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (OrI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1);
format %{ "eorl $dst, $src2, $src1\t# int ndd" %}
ins_encode %{
@ -13321,7 +13322,7 @@ instruct orI_rReg_rReg_mem_ndd(rRegI dst, rRegI src1, memory src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (OrI src1 (LoadI src2)));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(150);
format %{ "eorl $dst, $src1, $src2\t# int ndd" %}
@ -13397,7 +13398,7 @@ instruct xorI_rReg_ndd(rRegI dst, rRegI src1, rRegI src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (XorI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
format %{ "exorl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -13423,7 +13424,7 @@ instruct xorI_rReg_im1_ndd(rRegI dst, rRegI src, immI_M1 imm)
%{
match(Set dst (XorI src imm));
predicate(UseAPX);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "enotl $dst, $src" %}
ins_encode %{
@ -13454,7 +13455,7 @@ instruct xorI_rReg_rReg_imm_ndd(rRegI dst, rRegI src1, immI src2, rFlagsReg cr)
predicate(UseAPX && n->in(2)->bottom_type()->is_int()->get_con() != -1);
match(Set dst (XorI src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1);
format %{ "exorl $dst, $src1, $src2\t# int ndd" %}
ins_encode %{
@ -13500,7 +13501,7 @@ instruct xorI_rReg_rReg_mem_ndd(rRegI dst, rRegI src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (XorI src1 (LoadI src2)));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(150);
format %{ "exorl $dst, $src1, $src2\t# int ndd" %}
@ -13579,7 +13580,7 @@ instruct andL_rReg_ndd(rRegL dst, rRegL src1, rRegL src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (AndL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
format %{ "eandq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -13635,7 +13636,7 @@ instruct andL_rReg_rReg_imm_ndd(rRegL dst, rRegL src1, immL32 src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (AndL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1);
format %{ "eandq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -13679,7 +13680,7 @@ instruct andL_rReg_rReg_mem_ndd(rRegL dst, rRegL src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (AndL src1 (LoadL src2)));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(150);
format %{ "eandq $dst, $src1, $src2\t# long ndd" %}
@ -13882,7 +13883,7 @@ instruct orL_rReg_ndd(rRegL dst, rRegL src1, rRegL src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (OrL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
format %{ "eorq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -13937,7 +13938,7 @@ instruct orL_rReg_rReg_imm_ndd(rRegL dst, rRegL src1, immL32 src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (OrL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1);
format %{ "eorq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -13951,7 +13952,7 @@ instruct orL_rReg_imm_rReg_ndd(rRegL dst, immL32 src1, rRegL src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (OrL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1);
format %{ "eorq $dst, $src2, $src1\t# long ndd" %}
ins_encode %{
@ -13996,7 +13997,7 @@ instruct orL_rReg_rReg_mem_ndd(rRegL dst, rRegL src1, memory src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (OrL src1 (LoadL src2)));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(150);
format %{ "eorq $dst, $src1, $src2\t# long ndd" %}
@ -14075,7 +14076,7 @@ instruct xorL_rReg_ndd(rRegL dst, rRegL src1, rRegL src2, rFlagsReg cr)
predicate(UseAPX);
match(Set dst (XorL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
format %{ "exorq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -14101,7 +14102,7 @@ instruct xorL_rReg_im1_ndd(rRegL dst,rRegL src, immL_M1 imm)
%{
predicate(UseAPX);
match(Set dst (XorL src imm));
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
format %{ "enotq $dst, $src" %}
ins_encode %{
@ -14132,7 +14133,7 @@ instruct xorL_rReg_rReg_imm(rRegL dst, rRegL src1, immL32 src2, rFlagsReg cr)
predicate(UseAPX && n->in(2)->bottom_type()->is_long()->get_con() != -1L);
match(Set dst (XorL src1 src2));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1);
format %{ "exorq $dst, $src1, $src2\t# long ndd" %}
ins_encode %{
@ -14178,7 +14179,7 @@ instruct xorL_rReg_rReg_mem_ndd(rRegL dst, rRegL src1, memory src2, rFlagsReg cr
predicate(UseAPX);
match(Set dst (XorL src1 (LoadL src2)));
effect(KILL cr);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_commutative);
flag(PD::Flag_sets_sign_flag, PD::Flag_sets_zero_flag, PD::Flag_sets_parity_flag, PD::Flag_clears_overflow_flag, PD::Flag_clears_carry_flag, PD::Flag_ndd_demotable_opr1, PD::Flag_ndd_demotable_opr2);
ins_cost(150);
format %{ "exorq $dst, $src1, $src2\t# long ndd" %}
@ -16633,7 +16634,7 @@ instruct minI_rReg_ndd(rRegI dst, rRegI src1, rRegI src2)
predicate(UseAPX);
match(Set dst (MinI src1 src2));
effect(DEF dst, USE src1, USE src2);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
ins_cost(200);
expand %{
@ -16685,7 +16686,7 @@ instruct maxI_rReg_ndd(rRegI dst, rRegI src1, rRegI src2)
predicate(UseAPX);
match(Set dst (MaxI src1 src2));
effect(DEF dst, USE src1, USE src2);
flag(PD::Flag_ndd_demotable);
flag(PD::Flag_ndd_demotable_opr1);
ins_cost(200);
expand %{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -23,15 +23,15 @@
*
*/
#include "cppstdlib/cstdlib.hpp"
#include "libodm_aix.hpp"
#include "misc_aix.hpp"
#include <stdlib.h>
#include <dlfcn.h>
#include <string.h>
#include "runtime/arguments.hpp"
#include "runtime/os.hpp"
#include "utilities/permitForbiddenFunctions.hpp"
#include <dlfcn.h>
#include <string.h>
dynamicOdm::dynamicOdm() {
const char* libodmname = "/usr/lib/libodm.a(shr_64.o)";

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
* Copyright (c) 2022, IBM Corp.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -32,8 +32,9 @@
#ifndef OS_AIX_LIBPERFSTAT_AIX_HPP
#define OS_AIX_LIBPERFSTAT_AIX_HPP
#include "cppstdlib/cstdlib.hpp"
#include <sys/types.h>
#include <stdlib.h>
///////////////////////////////////////////////////////////////////////////////////////////////
// These are excerpts from the AIX 7.1 libperfstat.h -

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, IBM Corp.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -23,6 +23,7 @@
*
*/
#include "cppstdlib/cstdlib.hpp"
#include "jvm.h"
#include "libperfstat_aix.hpp"
#include "memory/allocation.inline.hpp"
@ -46,7 +47,6 @@
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
typedef struct {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -25,6 +25,7 @@
#if defined(__APPLE__)
#include "cppstdlib/cstdlib.hpp"
#include "nmt/memMapPrinter.hpp"
#include "runtime/os.hpp"
#include "utilities/align.hpp"
@ -34,7 +35,6 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <libproc.h>
#include <unistd.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -27,6 +27,7 @@
#include "code/vtableStubs.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "hugepages.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
@ -96,7 +97,6 @@
# include <signal.h>
# include <stdint.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <sys/ioctl.h>
# include <sys/ipc.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2026, 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
@ -22,6 +22,7 @@
*
*/
#include "cppstdlib/cstdlib.hpp"
#include "jvm.h"
#include "memory/allocation.inline.hpp"
#include "os_linux.inline.hpp"
@ -40,7 +41,6 @@
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h>
#include <sys/stat.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, 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
@ -36,15 +36,12 @@
#include <unistd.h>
#endif
// POSIX puts _exit in <unistd.h>.
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
// If needed, add os::strndup and use that instead.
FORBID_C_FUNCTION(char* strndup(const char*, size_t), noexcept, "don't use");
// These are unimplementable for Windows, and they aren't useful for a
// POSIX implementation of NMT either.
// https://stackoverflow.com/questions/62962839/stdaligned-alloc-missing-from-visual-studio-2019
FORBID_C_FUNCTION(int posix_memalign(void**, size_t, size_t), noexcept, "don't use");
FORBID_C_FUNCTION(void* aligned_alloc(size_t, size_t), noexcept, "don't use");
// realpath with a null second argument mallocs a string for the result.
// With a non-null second argument, there is a risk of buffer overrun.
PRAGMA_DIAG_PUSH

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2026, 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
@ -23,6 +23,7 @@
*/
#include "classfile/classLoader.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "jvmtifiles/jvmti.h"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, 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
@ -25,15 +25,20 @@
#ifndef OS_POSIX_PERMITFORBIDDENFUNCTIONS_POSIX_HPP
#define OS_POSIX_PERMITFORBIDDENFUNCTIONS_POSIX_HPP
#include "cppstdlib/cstdlib.hpp"
#include "utilities/compilerWarnings.hpp"
#include "utilities/globalDefinitions.hpp"
#include <unistd.h>
// Provide wrappers for some functions otherwise forbidden from use in HotSpot.
// See forbiddenFunctions.hpp for details.
namespace permit_forbidden_function {
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
[[noreturn]] inline void _exit(int status) { ::_exit(status); }
// Used by the POSIX implementation of os::realpath.
inline char* realpath(const char* path, char* resolved_path) {
return ::realpath(path, resolved_path);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, 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
@ -30,6 +30,7 @@
#include "code/vtableStubs.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "jvmtifiles/jvmti.h"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, 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
@ -25,6 +25,7 @@
#ifndef OS_WINDOWS_PERMITFORBIDDENFUNCTIONS_WINDOWS_HPP
#define OS_WINDOWS_PERMITFORBIDDENFUNCTIONS_WINDOWS_HPP
#include "cppstdlib/cstdlib.hpp"
#include "utilities/compilerWarnings.hpp"
#include "utilities/globalDefinitions.hpp"
@ -34,6 +35,8 @@
namespace permit_forbidden_function {
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
[[noreturn]] inline void _exit(int status) { ::_exit(status); }
// Used by the Windows implementation of os::realpath.
inline char* _fullpath(char* absPath, const char* relPath, size_t maxLength) {
return ::_fullpath(absPath, relPath, maxLength);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2026, 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
@ -24,6 +24,7 @@
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "runtime/arguments.hpp"
#include "runtime/javaThread.hpp"
#include "runtime/os.hpp"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -29,6 +29,7 @@
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
#include "code/vtableStubs.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "logging/log.hpp"
@ -63,7 +64,6 @@
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
# include <stdlib.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/resource.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2026, 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
@ -26,6 +26,7 @@
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
#include "code/vtableStubs.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "logging/log.hpp"
@ -58,7 +59,6 @@
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
# include <stdlib.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/resource.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -28,6 +28,7 @@
#include "code/codeCache.hpp"
#include "code/vtableStubs.hpp"
#include "code/nativeInst.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "memory/allocation.inline.hpp"
@ -59,7 +60,6 @@
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
# include <stdlib.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/resource.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2026, 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
@ -25,6 +25,7 @@
#include "asm/assembler.inline.hpp"
#include "classfile/vmSymbols.hpp"
#include "code/vtableStubs.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "memory/allocation.inline.hpp"
@ -57,7 +58,6 @@
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
# include <stdlib.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/resource.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2025 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -28,6 +28,7 @@
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
#include "code/vtableStubs.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "memory/allocation.inline.hpp"
@ -62,7 +63,6 @@
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
# include <stdlib.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/resource.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -28,6 +28,7 @@
#include "code/codeCache.hpp"
#include "code/nativeInst.hpp"
#include "code/vtableStubs.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "memory/allocation.inline.hpp"
@ -61,7 +62,6 @@
# include <pthread.h>
# include <signal.h>
# include <stdio.h>
# include <stdlib.h>
# include <sys/mman.h>
# include <sys/resource.h>
# include <sys/socket.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -30,6 +30,7 @@
#include "code/nativeInst.hpp"
#include "code/vtableStubs.hpp"
#include "compiler/disassembler.hpp"
#include "cppstdlib/cstdlib.h"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "memory/allocation.inline.hpp"
@ -62,7 +63,6 @@
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
# include <stdlib.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/resource.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2026, 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
@ -26,6 +26,7 @@
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
#include "code/vtableStubs.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "logging/log.hpp"
@ -59,7 +60,6 @@
# include <signal.h>
# include <errno.h>
# include <dlfcn.h>
# include <stdlib.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/resource.h>

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2020, Microsoft Corporation. All rights reserved.
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2026, 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
@ -28,6 +28,7 @@
#include "code/codeCache.hpp"
#include "code/vtableStubs.hpp"
#include "code/nativeInst.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/interpreter.hpp"
#include "jvm.h"
#include "memory/allocation.inline.hpp"
@ -54,7 +55,6 @@
# include <sys/types.h>
# include <signal.h>
# include <errno.h>
# include <stdlib.h>
# include <stdio.h>
# include <intrin.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2026, 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
@ -884,7 +884,6 @@ class LinearScanStatistic : public StackObj {
counter_throw,
counter_unwind,
counter_typecheck,
counter_fpu_stack,
counter_misc_inst,
counter_other_inst,
blank_line_2,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, 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
@ -42,6 +42,7 @@
#include "classfile/vmClasses.hpp"
#include "classfile/vmSymbols.hpp"
#include "compiler/compileBroker.hpp"
#include "cppstdlib/cstdlib.hpp"
#include "interpreter/bytecodeStream.hpp"
#include "interpreter/oopMapCache.hpp"
#include "jimage.hpp"
@ -81,7 +82,6 @@
#include "utilities/utf8.hpp"
#include <ctype.h>
#include <stdlib.h>
// Entry point in java.dll for path canonicalization

View File

@ -415,18 +415,18 @@ class methodHandle;
\
do_class(java_lang_StringCoding, "java/lang/StringCoding") \
do_intrinsic(_countPositives, java_lang_StringCoding, countPositives_name, countPositives_signature, F_S) \
do_name( countPositives_name, "countPositives0") \
do_name( countPositives_name, "countPositives") \
do_signature(countPositives_signature, "([BII)I") \
\
do_class(sun_nio_cs_iso8859_1_Encoder, "sun/nio/cs/ISO_8859_1$Encoder") \
do_intrinsic(_encodeISOArray, sun_nio_cs_iso8859_1_Encoder, encodeISOArray_name, encodeISOArray_signature, F_S) \
do_name( encodeISOArray_name, "encodeISOArray0") \
do_name( encodeISOArray_name, "implEncodeISOArray") \
do_signature(encodeISOArray_signature, "([CI[BII)I") \
\
do_intrinsic(_encodeByteISOArray, java_lang_StringCoding, encodeISOArray_name, indexOfI_signature, F_S) \
\
do_intrinsic(_encodeAsciiArray, java_lang_StringCoding, encodeAsciiArray_name, encodeISOArray_signature, F_S) \
do_name( encodeAsciiArray_name, "encodeAsciiArray0") \
do_name( encodeAsciiArray_name, "implEncodeAsciiArray") \
\
do_class(java_math_BigInteger, "java/math/BigInteger") \
do_intrinsic(_multiplyToLen, java_math_BigInteger, multiplyToLen_name, multiplyToLen_signature, F_S) \

View File

@ -0,0 +1,105 @@
/*
* Copyright (c) 2025, 2026, 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.
*
* 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 SHARE_CPPSTDLIB_CSTDLIB_HPP
#define SHARE_CPPSTDLIB_CSTDLIB_HPP
#include "utilities/compilerWarnings.hpp"
// HotSpot usage for <cstdlib>:
//
// Some functions are explicitly forbidden below. That may not be a complete
// list of all the functions we should forbid.
//
// We assume <cstdlib> provides definitions in the global namespace, in
// addition to providing them in the std namespace. We prefer to use the names
// in the global namespace.
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
#include "utilities/vmassert_uninstall.hpp"
#include <cstdlib>
#include "utilities/vmassert_reinstall.hpp" // don't reorder
END_ALLOW_FORBIDDEN_FUNCTIONS
// AIX may define malloc and calloc as macros when certain other features are
// present, causing us all sorts of grief.
// https://www.ibm.com/docs/en/openxl-c-and-cpp-aix/17.1.4?topic=compilers-memory-allocation
// Replace the macro definitions with something we can work with.
// AIX 7.3 no longer uses macro renaming when building with clang, instead
// using the same asm replacement approach as used below. This workaround can
// be removed once earlier versions are no longer supported as build platforms.
#if defined(AIX) && (defined(__VEC__) || defined(__AIXVEC))
#if defined(malloc) || defined(calloc)
#if !defined(malloc) || !defined(calloc)
#error "Inconsistent alloc macro mappings, expected both to be mapped."
#endif
// Remove the macros.
#undef malloc
#undef calloc
// Implement the mapping using gcc/clang asm name mapping.
extern "C" {
extern void* malloc(size_t) noexcept asm("vec_malloc");
extern void* calloc(size_t, size_t) noexcept asm("vec_calloc");
} // extern "C"
// Because the macros are in place when <cstdlib> brings names into the std
// namespace, macro replacement causes the expanded names to be added instead
// of the intended names. We can't remove std::vec_malloc and std::vec_calloc,
// but we do add the standard names in case someone uses them.
namespace std {
using ::malloc;
using ::calloc;
} // namespace std
#endif // Macro definition for malloc or calloc
#endif // AIX altivec allocator support
// Prefer os:: variants of these.
FORBID_IMPORTED_NORETURN_C_FUNCTION(void exit(int), noexcept, "use os::exit")
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _Exit(int), noexcept, "use os::exit")
// Windows puts _exit in <stdlib.h>. POSIX puts it in <unistd.h>.
// We can't forbid it here when using clang if it's not in <stdlib.h> - see
// the clang definition for FORBIDDEN_FUNCTION_NORETURN_ATTRIBUTE.
#ifdef _WINDOWS
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
#endif // _WINDOWS
// These functions return raw C-heap pointers or, in case of free(), take raw
// C-heap pointers. We generally want allocation to be done through NMT, using
// os::malloc and friends.
FORBID_IMPORTED_C_FUNCTION(void* malloc(size_t), noexcept, "use os::malloc");
FORBID_IMPORTED_C_FUNCTION(void free(void*), noexcept, "use os::free");
FORBID_IMPORTED_C_FUNCTION(void* calloc(size_t, size_t), noexcept, "use os::malloc and zero out manually");
FORBID_IMPORTED_C_FUNCTION(void* realloc(void*, size_t), noexcept, "use os::realloc");
// These are not provided (and are unimplementable?) by Windows.
// https://stackoverflow.com/questions/62962839/stdaligned-alloc-missing-from-visual-studio-2019
// They also aren't useful for a POSIX implementation of NMT.
#ifndef _WINDOWS
FORBID_C_FUNCTION(void* aligned_alloc(size_t, size_t), noexcept, "don't use");
FORBID_C_FUNCTION(int posix_memalign(void**, size_t, size_t), noexcept, "don't use");
#endif // !_WINDOWS
#endif // SHARE_CPPSTDLIB_CSTDLIB_HPP

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2025, 2026, 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.
*
* 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 SHARE_METAPROGRAMMING_DEPENDENTALWAYSFALSE_HPP
#define SHARE_METAPROGRAMMING_DEPENDENTALWAYSFALSE_HPP
// This provides a workaround for static_assert(false) in discarded or
// otherwise uninstantiated places. Instead use
// static_assert(DependentAlwaysFalse<T>, "...")
// See http://wg21.link/p2593r1. Some, but not all, compiler versions we're
// using have implemented that change as a DR:
// https://cplusplus.github.io/CWG/issues/2518.html
template<typename T> inline constexpr bool DependentAlwaysFalse = false;
#endif // SHARE_METAPROGRAMMING_DEPENDENTALWAYSFALSE_HPP

View File

@ -675,9 +675,6 @@
product(bool, PrintIntrinsics, false, DIAGNOSTIC, \
"prints attempted and successful inlining of intrinsics") \
\
develop(bool, VerifyIntrinsicChecks, false, \
"Verify in intrinsic that Java level checks work as expected") \
\
develop(bool, StressReflectiveCode, false, \
"Use inexact types at allocations, etc., to test reflection") \
\

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2026, 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
@ -418,7 +418,8 @@ bool LateInlineMHCallGenerator::do_late_inline_check(Compile* C, JVMState* jvms)
C->inline_printer()->record(cg->method(), call_node()->jvms(), InliningResult::FAILURE,
"late method handle call resolution");
}
assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline || StressIncrementalInlining, "we're doing late inlining");
assert(!cg->is_late_inline() || cg->is_mh_late_inline() || cg->is_virtual_late_inline() ||
AlwaysIncrementalInline || StressIncrementalInlining, "we're doing late inlining");
_inline_cg = cg;
return true;
} else {

View File

@ -940,11 +940,7 @@ inline Node* LibraryCallKit::generate_limit_guard(Node* offset,
}
// Emit range checks for the given String.value byte array
void LibraryCallKit::generate_string_range_check(Node* array,
Node* offset,
Node* count,
bool char_count,
bool halt_on_oob) {
void LibraryCallKit::generate_string_range_check(Node* array, Node* offset, Node* count, bool char_count) {
if (stopped()) {
return; // already stopped
}
@ -962,17 +958,10 @@ void LibraryCallKit::generate_string_range_check(Node* array,
generate_limit_guard(offset, count, load_array_length(array), bailout);
if (bailout->req() > 1) {
if (halt_on_oob) {
bailout = _gvn.transform(bailout)->as_Region();
Node* frame = _gvn.transform(new ParmNode(C->start(), TypeFunc::FramePtr));
Node* halt = _gvn.transform(new HaltNode(bailout, frame, "unexpected guard failure in intrinsic"));
C->root()->add_req(halt);
} else {
PreserveJVMState pjvms(this);
set_control(_gvn.transform(bailout));
uncommon_trap(Deoptimization::Reason_intrinsic,
Deoptimization::Action_maybe_recompile);
}
PreserveJVMState pjvms(this);
set_control(_gvn.transform(bailout));
uncommon_trap(Deoptimization::Reason_intrinsic,
Deoptimization::Action_maybe_recompile);
}
}
@ -1130,7 +1119,6 @@ bool LibraryCallKit::inline_array_equals(StrIntrinsicNode::ArgEnc ae) {
//------------------------------inline_countPositives------------------------------
// int java.lang.StringCoding#countPositives0(byte[] ba, int off, int len)
bool LibraryCallKit::inline_countPositives() {
if (too_many_traps(Deoptimization::Reason_intrinsic)) {
return false;
@ -1142,14 +1130,13 @@ bool LibraryCallKit::inline_countPositives() {
Node* offset = argument(1);
Node* len = argument(2);
if (VerifyIntrinsicChecks) {
ba = must_be_not_null(ba, true);
generate_string_range_check(ba, offset, len, false, true);
if (stopped()) {
return true;
}
}
ba = must_be_not_null(ba, true);
// Range checks
generate_string_range_check(ba, offset, len, false);
if (stopped()) {
return true;
}
Node* ba_start = array_element_address(ba, offset, T_BYTE);
Node* result = new CountPositivesNode(control(), memory(TypeAryPtr::BYTES), ba_start, len);
set_result(_gvn.transform(result));
@ -6184,9 +6171,6 @@ CallStaticJavaNode* LibraryCallKit::get_uncommon_trap_from_success_proj(Node* no
}
//-------------inline_encodeISOArray-----------------------------------
// int sun.nio.cs.ISO_8859_1.Encoder#encodeISOArray0(byte[] sa, int sp, byte[] da, int dp, int len)
// int java.lang.StringCoding#encodeISOArray0(byte[] sa, int sp, byte[] da, int dp, int len)
// int java.lang.StringCoding#encodeAsciiArray0(char[] sa, int sp, byte[] da, int dp, int len)
// encode char[] to byte[] in ISO_8859_1 or ASCII
bool LibraryCallKit::inline_encodeISOArray(bool ascii) {
assert(callee()->signature()->size() == 5, "encodeISOArray has 5 parameters");
@ -6197,14 +6181,8 @@ bool LibraryCallKit::inline_encodeISOArray(bool ascii) {
Node *dst_offset = argument(3);
Node *length = argument(4);
// Cast source & target arrays to not-null
if (VerifyIntrinsicChecks) {
src = must_be_not_null(src, true);
dst = must_be_not_null(dst, true);
if (stopped()) {
return true;
}
}
src = must_be_not_null(src, true);
dst = must_be_not_null(dst, true);
const TypeAryPtr* src_type = src->Value(&_gvn)->isa_aryptr();
const TypeAryPtr* dst_type = dst->Value(&_gvn)->isa_aryptr();
@ -6221,15 +6199,6 @@ bool LibraryCallKit::inline_encodeISOArray(bool ascii) {
return false;
}
// Check source & target bounds
if (VerifyIntrinsicChecks) {
generate_string_range_check(src, src_offset, length, src_elem == T_BYTE, true);
generate_string_range_check(dst, dst_offset, length, false, true);
if (stopped()) {
return true;
}
}
Node* src_start = array_element_address(src, src_offset, T_CHAR);
Node* dst_start = array_element_address(dst, dst_offset, dst_elem);
// 'src_start' points to src array + scaled offset

View File

@ -163,8 +163,7 @@ class LibraryCallKit : public GraphKit {
Node* array_length,
RegionNode* region);
void generate_string_range_check(Node* array, Node* offset,
Node* length, bool char_count,
bool halt_on_oob = false);
Node* length, bool char_count);
Node* current_thread_helper(Node* &tls_output, ByteSize handle_offset,
bool is_immutable);
Node* generate_current_thread(Node* &tls_output);

View File

@ -187,7 +187,10 @@ VStatus VLoopAnalyzer::setup_submodules_helper() {
return body_status;
}
_memory_slices.find_memory_slices();
VStatus slices_status = _memory_slices.find_memory_slices();
if (!slices_status.is_success()) {
return slices_status;
}
// If there is no memory slice detected, it means there is no store.
// If there is no reduction and no store, then we give up, because
@ -207,9 +210,11 @@ VStatus VLoopAnalyzer::setup_submodules_helper() {
}
// There are 2 kinds of slices:
// - No memory phi: only loads. All have the same input memory state from before the loop.
// - No memory phi: only loads.
// - Usually, all loads have the same input memory state from before the loop.
// - Only rarely this is not the case, and we just bail out for now.
// - With memory phi. Chain of memory operations inside the loop.
void VLoopMemorySlices::find_memory_slices() {
VStatus VLoopMemorySlices::find_memory_slices() {
Compile* C = _vloop.phase()->C;
// We iterate over the body, which is topologically sorted. Hence, if there is a phi
// in a slice, we will find it first, and the loads and stores afterwards.
@ -228,8 +233,15 @@ void VLoopMemorySlices::find_memory_slices() {
PhiNode* head = _heads.at(alias_idx);
if (head == nullptr) {
// We did not find a phi on this slice yet -> must be a slice with only loads.
assert(_inputs.at(alias_idx) == nullptr || _inputs.at(alias_idx) == load->in(1),
"not yet touched or the same input");
// For now, we can only handle slices with a single memory input before the loop,
// so if we find multiple, we bail out of auto vectorization. If this becomes
// too restrictive in the fututure, we could consider tracking multiple inputs.
// Different memory inputs can for example happen if one load has its memory state
// optimized, and the other load fails to have it optimized, for example because
// it does not end up on the IGVN worklist any more.
if (_inputs.at(alias_idx) != nullptr && _inputs.at(alias_idx) != load->in(1)) {
return VStatus::make_failure(FAILURE_DIFFERENT_MEMORY_INPUT);
}
_inputs.at_put(alias_idx, load->in(1));
} // else: the load belongs to a slice with a phi that already set heads and inputs.
#ifdef ASSERT
@ -243,6 +255,7 @@ void VLoopMemorySlices::find_memory_slices() {
}
}
NOT_PRODUCT( if (_vloop.is_trace_memory_slices()) { print(); } )
return VStatus::make_success();
}
#ifndef PRODUCT

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, Arm Limited. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -504,6 +504,8 @@ private:
//
class VLoopMemorySlices : public StackObj {
private:
static constexpr char const* FAILURE_DIFFERENT_MEMORY_INPUT = "Load only slice has multiple memory inputs";
const VLoop& _vloop;
const VLoopBody& _body;
@ -521,7 +523,7 @@ public:
const GrowableArray<Node*>& inputs() const { return _inputs; }
const GrowableArray<PhiNode*>& heads() const { return _heads; }
void find_memory_slices();
VStatus find_memory_slices();
void get_slice_in_reverse_order(PhiNode* head, MemNode* tail, GrowableArray<MemNode*>& slice) const;
bool same_memory_slice(MemNode* m1, MemNode* m2) const;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, 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
@ -26,6 +26,7 @@
#define SHARE_RUNTIME_ATOMIC_HPP
#include "cppstdlib/type_traits.hpp"
#include "metaprogramming/dependentAlwaysFalse.hpp"
#include "metaprogramming/primitiveConversions.hpp"
#include "runtime/atomicAccess.hpp"
#include "utilities/globalDefinitions.hpp"

View File

@ -1,4 +1,5 @@
/*
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Google and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -141,7 +142,7 @@ struct ByteswapImpl : public ByteswapFallbackImpl<T, N> {};
*****************************************************************************/
#elif defined(TARGET_COMPILER_visCPP)
#include <cstdlib>
#include "cppstdlib/cstdlib.hpp"
#pragma intrinsic(_byteswap_ushort)
#pragma intrinsic(_byteswap_ulong)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, 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
@ -70,7 +70,7 @@ class ConcurrentHashTable : public CHeapObj<MT> {
class Node {
private:
DEBUG_ONLY(size_t _saved_hash);
Node * volatile _next;
Atomic<Node*> _next;
VALUE _value;
public:
Node(const VALUE& value, Node* next = nullptr)
@ -80,8 +80,8 @@ class ConcurrentHashTable : public CHeapObj<MT> {
}
Node* next() const;
void set_next(Node* node) { _next = node; }
Node* const volatile * next_ptr() { return &_next; }
void set_next(Node* node) { _next.store_relaxed(node); }
const Atomic<Node*>* next_ptr() const { return &_next; }
#ifdef ASSERT
size_t saved_hash() const { return _saved_hash; }
void set_saved_hash(size_t hash) { _saved_hash = hash; }
@ -123,7 +123,7 @@ class ConcurrentHashTable : public CHeapObj<MT> {
// unlocked -> locked -> redirect
// Locked state only applies to an updater.
// Reader only check for redirect.
Node * volatile _first;
Atomic<Node*> _first;
static const uintptr_t STATE_LOCK_BIT = 0x1;
static const uintptr_t STATE_REDIRECT_BIT = 0x2;
@ -157,20 +157,25 @@ class ConcurrentHashTable : public CHeapObj<MT> {
// A bucket is only one pointer with the embedded state.
Bucket() : _first(nullptr) {};
NONCOPYABLE(Bucket);
// Copy bucket's first entry to this.
void assign(const Bucket& bucket);
// Get the first pointer unmasked.
Node* first() const;
// Get a pointer to the const first pointer. Do not deference this
// pointer, the pointer pointed to _may_ contain an embedded state. Such
// pointer should only be used as input to release_assign_node_ptr.
Node* const volatile * first_ptr() { return &_first; }
const Atomic<Node*>* first_ptr() const { return &_first; }
// This is the only place where a pointer to a Node pointer that potentially
// is _first should be changed. Otherwise we destroy the embedded state. We
// only give out pointer to const Node pointer to avoid accidental
// assignment, thus here we must cast const part away. Method is not static
// due to an assert.
void release_assign_node_ptr(Node* const volatile * dst, Node* node) const;
void release_assign_node_ptr(const Atomic<Node*>* dst, Node* node) const;
// This method assigns this buckets last Node next ptr to input Node.
void release_assign_last_node_next(Node* node);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, 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
@ -63,7 +63,7 @@ inline typename ConcurrentHashTable<CONFIG, MT>::Node*
ConcurrentHashTable<CONFIG, MT>::
Node::next() const
{
return AtomicAccess::load_acquire(&_next);
return _next.load_acquire();
}
// Bucket
@ -72,19 +72,26 @@ inline typename ConcurrentHashTable<CONFIG, MT>::Node*
ConcurrentHashTable<CONFIG, MT>::
Bucket::first_raw() const
{
return AtomicAccess::load_acquire(&_first);
return _first.load_acquire();
}
template <typename CONFIG, MemTag MT>
inline void ConcurrentHashTable<CONFIG, MT>::
Bucket::release_assign_node_ptr(
typename ConcurrentHashTable<CONFIG, MT>::Node* const volatile * dst,
const Atomic<typename ConcurrentHashTable<CONFIG, MT>::Node*>* dst,
typename ConcurrentHashTable<CONFIG, MT>::Node* node) const
{
// Due to this assert this methods is not static.
assert(is_locked(), "Must be locked.");
Node** tmp = (Node**)dst;
AtomicAccess::release_store(tmp, clear_set_state(node, *dst));
Atomic<Node*>* tmp = const_cast<Atomic<Node*>*>(dst);
tmp->release_store(clear_set_state(node, dst->load_relaxed()));
}
template <typename CONFIG, MemTag MT>
inline void ConcurrentHashTable<CONFIG, MT>::
Bucket::assign(const Bucket& bucket)
{
_first.store_relaxed(bucket._first.load_relaxed());
}
template <typename CONFIG, MemTag MT>
@ -93,7 +100,7 @@ ConcurrentHashTable<CONFIG, MT>::
Bucket::first() const
{
// We strip the states bit before returning the ptr.
return clear_state(AtomicAccess::load_acquire(&_first));
return clear_state(_first.load_acquire());
}
template <typename CONFIG, MemTag MT>
@ -134,9 +141,9 @@ inline void ConcurrentHashTable<CONFIG, MT>::
typename ConcurrentHashTable<CONFIG, MT>::Node* node)
{
assert(is_locked(), "Must be locked.");
Node* const volatile * ret = first_ptr();
while (clear_state(*ret) != nullptr) {
ret = clear_state(*ret)->next_ptr();
const Atomic<Node*>* ret = first_ptr();
while (clear_state(ret->load_relaxed()) != nullptr) {
ret = clear_state(ret->load_relaxed())->next_ptr();
}
release_assign_node_ptr(ret, node);
}
@ -150,7 +157,7 @@ inline bool ConcurrentHashTable<CONFIG, MT>::
if (is_locked()) {
return false;
}
if (AtomicAccess::cmpxchg(&_first, expect, node) == expect) {
if (_first.compare_exchange(expect, node) == expect) {
return true;
}
return false;
@ -165,7 +172,7 @@ inline bool ConcurrentHashTable<CONFIG, MT>::
}
// We will expect a clean first pointer.
Node* tmp = first();
if (AtomicAccess::cmpxchg(&_first, tmp, set_state(tmp, STATE_LOCK_BIT)) == tmp) {
if (_first.compare_exchange(tmp, set_state(tmp, STATE_LOCK_BIT)) == tmp) {
return true;
}
return false;
@ -178,7 +185,7 @@ inline void ConcurrentHashTable<CONFIG, MT>::
assert(is_locked(), "Must be locked.");
assert(!have_redirect(),
"Unlocking a bucket after it has reached terminal state.");
AtomicAccess::release_store(&_first, clear_state(first()));
_first.release_store(clear_state(first()));
}
template <typename CONFIG, MemTag MT>
@ -186,7 +193,7 @@ inline void ConcurrentHashTable<CONFIG, MT>::
Bucket::redirect()
{
assert(is_locked(), "Must be locked.");
AtomicAccess::release_store(&_first, set_state(_first, STATE_REDIRECT_BIT));
_first.release_store(set_state(_first.load_relaxed(), STATE_REDIRECT_BIT));
}
// InternalTable
@ -413,8 +420,8 @@ inline void ConcurrentHashTable<CONFIG, MT>::
bucket->lock();
size_t odd_index = even_index + _table->_size;
_new_table->get_buckets()[even_index] = *bucket;
_new_table->get_buckets()[odd_index] = *bucket;
_new_table->get_buckets()[even_index].assign(*bucket);
_new_table->get_buckets()[odd_index].assign(*bucket);
// Moves lockers go to new table, where they will wait until unlock() below.
bucket->redirect(); /* Must release stores above */
@ -445,7 +452,7 @@ inline bool ConcurrentHashTable<CONFIG, MT>::
{
Bucket* bucket = get_bucket_locked(thread, lookup_f.get_hash());
assert(bucket->is_locked(), "Must be locked.");
Node* const volatile * rem_n_prev = bucket->first_ptr();
const Atomic<Node*>* rem_n_prev = bucket->first_ptr();
Node* rem_n = bucket->first();
while (rem_n != nullptr) {
if (lookup_f.equals(rem_n->value())) {
@ -534,7 +541,7 @@ inline void ConcurrentHashTable<CONFIG, MT>::
size_t dels = 0;
Node* ndel[StackBufferSize];
Node* const volatile * rem_n_prev = bucket->first_ptr();
const Atomic<Node*>* rem_n_prev = bucket->first_ptr();
Node* rem_n = bucket->first();
while (rem_n != nullptr) {
if (lookup_f.is_dead(rem_n->value())) {
@ -643,8 +650,8 @@ inline bool ConcurrentHashTable<CONFIG, MT>::
return false;
}
Node* delete_me = nullptr;
Node* const volatile * even = new_table->get_bucket(even_index)->first_ptr();
Node* const volatile * odd = new_table->get_bucket(odd_index)->first_ptr();
const Atomic<Node*>* even = new_table->get_bucket(even_index)->first_ptr();
const Atomic<Node*>* odd = new_table->get_bucket(odd_index)->first_ptr();
while (aux != nullptr) {
bool dead_hash = false;
size_t aux_hash = CONFIG::get_hash(*aux->value(), &dead_hash);
@ -742,11 +749,11 @@ inline void ConcurrentHashTable<CONFIG, MT>::
b_old_even->lock();
b_old_odd->lock();
_new_table->get_buckets()[bucket_it] = *b_old_even;
_new_table->get_buckets()[bucket_it].assign(*b_old_even);
// Put chains together.
_new_table->get_bucket(bucket_it)->
release_assign_last_node_next(*(b_old_odd->first_ptr()));
release_assign_last_node_next(b_old_odd->first_ptr()->load_relaxed());
b_old_even->redirect();
b_old_odd->redirect();
@ -981,7 +988,7 @@ inline size_t ConcurrentHashTable<CONFIG, MT>::
size_t num_del, Node** ndel, GrowableArrayCHeap<Node*, MT>& extra)
{
size_t dels = 0;
Node* const volatile * rem_n_prev = bucket->first_ptr();
const Atomic<Node*>* rem_n_prev = bucket->first_ptr();
Node* rem_n = bucket->first();
while (rem_n != nullptr) {
if (eval_f(rem_n->value())) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, 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
@ -32,12 +32,6 @@
#include <stdarg.h>
#include <stddef.h>
// Workaround for noreturn functions: exit, _exit, _Exit - see the clang
// definition of FORBIDDEN_FUNCTION_NORETURN_ATTRIBUTE.
#ifdef __clang__
#include <stdlib.h>
#endif
#ifdef _WINDOWS
#include "forbiddenFunctions_windows.hpp"
#else
@ -49,12 +43,6 @@
// or have security concerns, either with preferred alternatives, or to be
// avoided entirely.
FORBID_IMPORTED_NORETURN_C_FUNCTION(void exit(int), noexcept, "use os::exit")
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _Exit(int), noexcept, "use os::exit")
// Windows puts _exit in <stdlib.h>, POSIX in <unistd.h>.
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
FORBID_IMPORTED_C_FUNCTION(char* strerror(int), noexcept, "use os::strerror");
FORBID_IMPORTED_C_FUNCTION(char* strtok(char*, const char*), noexcept, "use strtok_r");
@ -70,13 +58,8 @@ FORBID_C_FUNCTION(int vsprintf(char*, const char*, va_list), noexcept, "use os::
FORBID_C_FUNCTION(int vsnprintf(char*, size_t, const char*, va_list), noexcept, "use os::vsnprintf");
PRAGMA_DIAG_POP
// All of the following functions return raw C-heap pointers (sometimes as an
// option, e.g. realpath or getwd) or, in case of free(), take raw C-heap
// pointers. We generally want allocation to be done through NMT.
FORBID_IMPORTED_C_FUNCTION(void* malloc(size_t size), noexcept, "use os::malloc");
FORBID_IMPORTED_C_FUNCTION(void free(void *ptr), noexcept, "use os::free");
FORBID_IMPORTED_C_FUNCTION(void* calloc(size_t nmemb, size_t size), noexcept, "use os::malloc and zero out manually");
FORBID_IMPORTED_C_FUNCTION(void* realloc(void *ptr, size_t size), noexcept, "use os::realloc");
// All of the following functions return raw C-heap pointers. We generally
// want allocation to be done through NMT.
FORBID_IMPORTED_C_FUNCTION(char* strdup(const char *s), noexcept, "use os::strdup");
FORBID_IMPORTED_C_FUNCTION(wchar_t* wcsdup(const wchar_t *s), noexcept, "don't use");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, 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
@ -1374,14 +1374,6 @@ template<typename K> int primitive_compare(const K& k0, const K& k1) {
template<typename T>
std::add_rvalue_reference_t<T> declval() noexcept;
// This provides a workaround for static_assert(false) in discarded or
// otherwise uninstantiated places. Instead use
// static_assert(DependentAlwaysFalse<T>, "...")
// See http://wg21.link/p2593r1. Some, but not all, compiler versions we're
// using have implemented that change as a DR:
// https://cplusplus.github.io/CWG/issues/2518.html
template<typename T> inline constexpr bool DependentAlwaysFalse = false;
// Quickly test to make sure IEEE-754 subnormal numbers are correctly
// handled.
bool IEEE_subnormal_handling_OK();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2026, 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
@ -31,6 +31,8 @@
// globally used constants & types, class (forward)
// declarations and a few frequently used utility functions.
#include "cppstdlib/cstdlib.hpp"
#include <alloca.h>
#include <ctype.h>
#include <dlfcn.h>
@ -44,15 +46,6 @@
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// In stdlib.h on AIX malloc is defined as a macro causing
// compiler errors when resolving them in different depths as it
// happens in the log tags. This avoids the macro.
#if (defined(__VEC__) || defined(__AIXVEC)) && defined(AIX) \
&& defined(__open_xl_version__) && __open_xl_version__ >= 17
#undef malloc
extern void *malloc(size_t) asm("vec_malloc");
#endif
#include <string.h>
#include <time.h>
#include <wchar.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, 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
@ -34,6 +34,8 @@
// Need this on windows to get the math constants (e.g., M_PI).
#define _USE_MATH_DEFINES
#include "cppstdlib/cstdlib.hpp"
# include <ctype.h>
# include <fcntl.h>
# include <float.h> // for _isnan
@ -45,7 +47,6 @@
# include <stddef.h>// for offsetof
# include <stdint.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <sys/stat.h>
# include <time.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2026, 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
@ -25,6 +25,7 @@
#ifndef SHARE_UTILITIES_LOCKFREESTACK_HPP
#define SHARE_UTILITIES_LOCKFREESTACK_HPP
#include "metaprogramming/dependentAlwaysFalse.hpp"
#include "runtime/atomic.hpp"
#include "runtime/atomicAccess.hpp"
#include "utilities/debug.hpp"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -26,6 +26,7 @@
#ifndef SHARE_UTILITIES_PARSE_INTEGER_HPP
#define SHARE_UTILITIES_PARSE_INTEGER_HPP
#include "cppstdlib/cstdlib.hpp"
#include "cppstdlib/limits.hpp"
#include "metaprogramming/enableIf.hpp"
#include "utilities/debug.hpp"
@ -33,7 +34,6 @@
#include "utilities/macros.hpp"
#include <errno.h>
#include <stdlib.h>
// *************************************************************************
// ** Attention compatibility! **

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, 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
@ -25,6 +25,7 @@
#ifndef SHARE_UTILITIES_PERMITFORBIDDENFUNCTIONS_HPP
#define SHARE_UTILITIES_PERMITFORBIDDENFUNCTIONS_HPP
#include "cppstdlib/cstdlib.hpp"
#include "utilities/compilerWarnings.hpp"
#include "utilities/globalDefinitions.hpp"
@ -34,6 +35,9 @@
#include "permitForbiddenFunctions_posix.hpp"
#endif
#include <stdio.h>
#include <string.h>
// Provide wrappers for some functions otherwise forbidden from use in HotSpot.
//
// There may be special circumstances where an otherwise forbidden function
@ -53,7 +57,6 @@ namespace permit_forbidden_function {
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
[[noreturn]] inline void exit(int status) { ::exit(status); }
[[noreturn]] inline void _exit(int status) { ::_exit(status); }
ATTRIBUTE_PRINTF(3, 0)
inline int vsnprintf(char* str, size_t size, const char* format, va_list ap) {

View File

@ -1111,7 +1111,7 @@ public final class String
int sp = 0;
int sl = len;
while (sp < sl) {
int ret = StringCoding.encodeISOArray(val, sp, dst, dp, len);
int ret = StringCoding.implEncodeISOArray(val, sp, dst, dp, len);
sp = sp + ret;
dp = dp + ret;
if (ret != len) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, Alibaba Group Holding Limited. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -26,11 +26,8 @@
package java.lang;
import jdk.internal.util.Preconditions;
import jdk.internal.vm.annotation.IntrinsicCandidate;
import java.util.function.BiFunction;
/**
* Utility class for string encoding and decoding.
*/
@ -41,7 +38,7 @@ class StringCoding {
/**
* Count the number of leading non-zero ascii chars in the range.
*/
static int countNonZeroAscii(String s) {
public static int countNonZeroAscii(String s) {
byte[] value = s.value();
if (s.isLatin1()) {
return countNonZeroAsciiLatin1(value, 0, value.length);
@ -53,7 +50,7 @@ class StringCoding {
/**
* Count the number of non-zero ascii chars in the range.
*/
private static int countNonZeroAsciiLatin1(byte[] ba, int off, int len) {
public static int countNonZeroAsciiLatin1(byte[] ba, int off, int len) {
int limit = off + len;
for (int i = off; i < limit; i++) {
if (ba[i] <= 0) {
@ -66,7 +63,7 @@ class StringCoding {
/**
* Count the number of leading non-zero ascii chars in the range.
*/
private static int countNonZeroAsciiUTF16(byte[] ba, int off, int strlen) {
public static int countNonZeroAsciiUTF16(byte[] ba, int off, int strlen) {
int limit = off + strlen;
for (int i = off; i < limit; i++) {
char c = StringUTF16.charAt(ba, i);
@ -77,7 +74,7 @@ class StringCoding {
return strlen;
}
static boolean hasNegatives(byte[] ba, int off, int len) {
public static boolean hasNegatives(byte[] ba, int off, int len) {
return countPositives(ba, off, len) != len;
}
@ -88,24 +85,9 @@ class StringCoding {
* bytes in the range. If there are negative bytes, the implementation must return
* a value that is less than or equal to the index of the first negative byte
* in the range.
*
* @param ba a byte array
* @param off the index of the first byte to start reading from
* @param len the total number of bytes to read
* @throws NullPointerException if {@code ba} is null
* @throws ArrayIndexOutOfBoundsException if the provided sub-range is
* {@linkplain Preconditions#checkFromIndexSize(int, int, int, BiFunction) out of bounds}
*/
static int countPositives(byte[] ba, int off, int len) {
Preconditions.checkFromIndexSize(
off, len,
ba.length, // Implicit null check on `ba`
Preconditions.AIOOBE_FORMATTER);
return countPositives0(ba, off, len);
}
@IntrinsicCandidate
private static int countPositives0(byte[] ba, int off, int len) {
public static int countPositives(byte[] ba, int off, int len) {
int limit = off + len;
for (int i = off; i < limit; i++) {
if (ba[i] < 0) {
@ -115,37 +97,9 @@ class StringCoding {
return len;
}
/**
* Encodes as many ISO-8859-1 codepoints as possible from the source byte
* array containing characters encoded in UTF-16, into the destination byte
* array, assuming that the encoding is ISO-8859-1 compatible.
*
* @param sa the source byte array containing characters encoded in UTF-16
* @param sp the index of the <em>character (not byte!)</em> from the source array to start reading from
* @param da the target byte array
* @param dp the index of the target array to start writing to
* @param len the maximum number of <em>characters (not bytes!)</em> to be encoded
* @return the total number of <em>characters (not bytes!)</em> successfully encoded
* @throws NullPointerException if any of the provided arrays is null
*/
static int encodeISOArray(byte[] sa, int sp,
byte[] da, int dp, int len) {
// This method should tolerate invalid arguments, matching the lenient behavior of the VM intrinsic.
// Hence, using operator expressions instead of `Preconditions`, which throw on failure.
int sl;
if ((sp | dp | len) < 0 ||
// Halving the length of `sa` to obtain the number of characters:
sp >= (sl = sa.length >>> 1) || // Implicit null check on `sa`
dp >= da.length) { // Implicit null check on `da`
return 0;
}
int minLen = Math.min(len, Math.min(sl - sp, da.length - dp));
return encodeISOArray0(sa, sp, da, dp, minLen);
}
@IntrinsicCandidate
private static int encodeISOArray0(byte[] sa, int sp,
byte[] da, int dp, int len) {
public static int implEncodeISOArray(byte[] sa, int sp,
byte[] da, int dp, int len) {
int i = 0;
for (; i < len; i++) {
char c = StringUTF16.getChar(sa, sp++);
@ -156,35 +110,10 @@ class StringCoding {
return i;
}
/**
* Encodes as many ASCII codepoints as possible from the source
* character array into the destination byte array, assuming that
* the encoding is ASCII compatible.
*
* @param sa the source character array
* @param sp the index of the source array to start reading from
* @param da the target byte array
* @param dp the index of the target array to start writing to
* @param len the maximum number of characters to be encoded
* @return the total number of characters successfully encoded
* @throws NullPointerException if any of the provided arrays is null
*/
static int encodeAsciiArray(char[] sa, int sp,
byte[] da, int dp, int len) {
// This method should tolerate invalid arguments, matching the lenient behavior of the VM intrinsic.
// Hence, using operator expressions instead of `Preconditions`, which throw on failure.
if ((sp | dp | len) < 0 ||
sp >= sa.length || // Implicit null check on `sa`
dp >= da.length) { // Implicit null check on `da`
return 0;
}
int minLen = Math.min(len, Math.min(sa.length - sp, da.length - dp));
return encodeAsciiArray0(sa, sp, da, dp, minLen);
}
@IntrinsicCandidate
static int encodeAsciiArray0(char[] sa, int sp,
byte[] da, int dp, int len) {
public static int implEncodeAsciiArray(char[] sa, int sp,
byte[] da, int dp, int len)
{
int i = 0;
for (; i < len; i++) {
char c = sa[sp++];

View File

@ -55,6 +55,7 @@ import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Supplier;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
@ -2176,8 +2177,8 @@ public final class System {
return String.decodeASCII(src, srcOff, dst, dstOff, len);
}
public int encodeASCII(char[] sa, int sp, byte[] da, int dp, int len) {
return StringCoding.encodeAsciiArray(sa, sp, da, dp, len);
public int uncheckedEncodeASCII(char[] src, int srcOff, byte[] dst, int dstOff, int len) {
return StringCoding.implEncodeAsciiArray(src, srcOff, dst, dstOff, len);
}
public InputStream initialSystemIn() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, 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
@ -89,15 +89,19 @@ final class VirtualThread extends BaseVirtualThread {
*
* RUNNING -> PARKING // Thread parking with LockSupport.park
* PARKING -> PARKED // cont.yield successful, parked indefinitely
* PARKING -> PINNED // cont.yield failed, parked indefinitely on carrier
* PARKED -> UNPARKED // unparked, may be scheduled to continue
* PINNED -> RUNNING // unparked, continue execution on same carrier
* UNPARKED -> RUNNING // continue execution after park
*
* PARKING -> RUNNING // cont.yield failed, need to park on carrier
* RUNNING -> PINNED // park on carrier
* PINNED -> RUNNING // unparked, continue execution on same carrier
*
* RUNNING -> TIMED_PARKING // Thread parking with LockSupport.parkNanos
* TIMED_PARKING -> TIMED_PARKED // cont.yield successful, timed-parked
* TIMED_PARKING -> TIMED_PINNED // cont.yield failed, timed-parked on carrier
* TIMED_PARKED -> UNPARKED // unparked, may be scheduled to continue
*
* TIMED_PARKING -> RUNNING // cont.yield failed, need to park on carrier
* RUNNING -> TIMED_PINNED // park on carrier
* TIMED_PINNED -> RUNNING // unparked, continue execution on same carrier
*
* RUNNING -> BLOCKING // blocking on monitor enter
@ -108,7 +112,7 @@ final class VirtualThread extends BaseVirtualThread {
* RUNNING -> WAITING // transitional state during wait on monitor
* WAITING -> WAIT // waiting on monitor
* WAIT -> BLOCKED // notified, waiting to be unblocked by monitor owner
* WAIT -> UNBLOCKED // timed-out/interrupted
* WAIT -> UNBLOCKED // interrupted
*
* RUNNING -> TIMED_WAITING // transition state during timed-waiting on monitor
* TIMED_WAITING -> TIMED_WAIT // timed-waiting on monitor
@ -856,16 +860,20 @@ final class VirtualThread extends BaseVirtualThread {
* Re-enables this virtual thread for scheduling. If this virtual thread is parked
* then its task is scheduled to continue, otherwise its next call to {@code park} or
* {@linkplain #parkNanos(long) parkNanos} is guaranteed not to block.
* @param lazySubmit to use lazySubmit if possible
* @throws RejectedExecutionException if the scheduler cannot accept a task
*/
@Override
void unpark() {
private void unpark(boolean lazySubmit) {
if (!getAndSetParkPermit(true) && currentThread() != this) {
int s = state();
// unparked while parked
if ((s == PARKED || s == TIMED_PARKED) && compareAndSetState(s, UNPARKED)) {
submitRunContinuation();
if (lazySubmit) {
lazySubmitRunContinuation();
} else {
submitRunContinuation();
}
return;
}
@ -888,6 +896,11 @@ final class VirtualThread extends BaseVirtualThread {
}
}
@Override
void unpark() {
unpark(false);
}
/**
* Invoked by unblocker thread to unblock this virtual thread.
*/
@ -904,11 +917,7 @@ final class VirtualThread extends BaseVirtualThread {
*/
private void parkTimeoutExpired() {
assert !VirtualThread.currentThread().isVirtual();
if (!getAndSetParkPermit(true)
&& (state() == TIMED_PARKED)
&& compareAndSetState(TIMED_PARKED, UNPARKED)) {
lazySubmitRunContinuation();
}
unpark(true);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2026, 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
@ -1081,10 +1081,9 @@ public sealed interface StructuredTaskScope<T, R>
* does not throw then the {@code Joiner}'s {@code result()} method is invoked to
* get the result or throw.
*
* <p> This method may only be invoked by the scope owner. Once the result or
* exception outcome is obtained, this method may not be invoked again. The only
* case where the method may be called again is where {@code InterruptedException}
* is thrown while waiting.
* <p> This method may only be invoked by the scope owner. It may only be invoked once
* to get the result, exception or timeout outcome, unless the previous invocation
* resulted in an {@code InterruptedException} being thrown.
*
* @return the result
* @throws WrongThreadException if the current thread is not the scope owner
@ -1093,8 +1092,11 @@ public sealed interface StructuredTaskScope<T, R>
* exception from {@link Joiner#result() Joiner.result()} as the cause
* @throws TimeoutException if a timeout is set, the timeout expires before or while
* waiting, and {@link Joiner#onTimeout() Joiner.onTimeout()} throws this exception
* @throws InterruptedException if interrupted while waiting
* @throws InterruptedException if the current thread is interrupted before or
* while waiting. The current thread's interrupted status is cleared when this
* exception is thrown.
* @since 25
* @see Thread##thread-interruption Thread Interruption
*/
R join() throws InterruptedException;

View File

@ -448,19 +448,15 @@ public interface JavaLangAccess {
PrintStream initialSystemErr();
/**
* Encodes as many ASCII codepoints as possible from the source
* character array into the destination byte array, assuming that
* the encoding is ASCII compatible.
* Encodes as many ASCII codepoints as possible from the source array into
* the destination byte array, assuming that the encoding is ASCII
* compatible.
* <p>
* <b>WARNING: This method does not perform any bound checks.</b>
*
* @param sa the source character array
* @param sp the index of the source array to start reading from
* @param da the target byte array
* @param dp the index of the target array to start writing to
* @param len the total number of characters to be encoded
* @return the total number of characters successfully encoded
* @throws NullPointerException if any of the provided arrays is null
* @return the number of bytes successfully encoded, or 0 if none
*/
int encodeASCII(char[] sa, int sp, byte[] da, int dp, int len);
int uncheckedEncodeASCII(char[] src, int srcOff, byte[] dst, int dstOff, int len);
/**
* Set the cause of Throwable

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2026, 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
@ -220,14 +220,6 @@ public class BasicImageReader implements AutoCloseable {
return slice(buffer, offset, size).order(byteOrder).asIntBuffer();
}
public static void releaseByteBuffer(ByteBuffer buffer) {
Objects.requireNonNull(buffer);
if (!MAP_ALL) {
ImageBufferCache.releaseBuffer(buffer);
}
}
public String getName() {
return name;
}
@ -362,13 +354,15 @@ public class BasicImageReader implements AutoCloseable {
if (offset < 0 || Integer.MAX_VALUE <= offset) {
throw new IndexOutOfBoundsException("Bad offset: " + offset);
}
int checkedOffset = (int) offset;
if (size < 0 || Integer.MAX_VALUE <= size) {
throw new IndexOutOfBoundsException("Bad size: " + size);
throw new IllegalArgumentException("Bad size: " + size);
}
int checkedSize = (int) size;
if (MAP_ALL) {
ByteBuffer buffer = slice(memoryMap, (int)offset, (int)size);
ByteBuffer buffer = slice(memoryMap, checkedOffset, checkedSize);
buffer.order(ByteOrder.BIG_ENDIAN);
return buffer;
@ -376,21 +370,18 @@ public class BasicImageReader implements AutoCloseable {
if (channel == null) {
throw new InternalError("Image file channel not open");
}
ByteBuffer buffer = ImageBufferCache.getBuffer(size);
ByteBuffer buffer = ByteBuffer.allocate(checkedSize);
int read;
try {
read = channel.read(buffer, offset);
read = channel.read(buffer, checkedOffset);
buffer.rewind();
} catch (IOException ex) {
ImageBufferCache.releaseBuffer(buffer);
throw new RuntimeException(ex);
}
if (read != size) {
ImageBufferCache.releaseBuffer(buffer);
if (read != checkedSize) {
throw new RuntimeException("Short read: " + read +
" instead of " + size + " bytes");
" instead of " + checkedSize + " bytes");
}
return buffer;
@ -406,17 +397,12 @@ public class BasicImageReader implements AutoCloseable {
public byte[] getResource(ImageLocation loc) {
ByteBuffer buffer = getResourceBuffer(loc);
if (buffer != null) {
byte[] bytes = getBufferBytes(buffer);
ImageBufferCache.releaseBuffer(buffer);
return bytes;
}
return null;
return buffer != null ? getBufferBytes(buffer) : null;
}
/**
* Returns the content of jimage location in a newly allocated byte buffer.
*/
public ByteBuffer getResourceBuffer(ImageLocation loc) {
Objects.requireNonNull(loc);
long offset = loc.getContentOffset() + indexSize;
@ -437,10 +423,8 @@ public class BasicImageReader implements AutoCloseable {
return readBuffer(offset, uncompressedSize);
} else {
ByteBuffer buffer = readBuffer(offset, compressedSize);
if (buffer != null) {
byte[] bytesIn = getBufferBytes(buffer);
ImageBufferCache.releaseBuffer(buffer);
byte[] bytesOut;
try {

View File

@ -1,158 +0,0 @@
/*
* Copyright (c) 2014, 2016, 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.
*/
package jdk.internal.jimage;
import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
/**
* @implNote This class needs to maintain JDK 8 source compatibility.
*
* It is used internally in the JDK to implement jimage/jrtfs access,
* but also compiled and delivered as part of the jrt-fs.jar to support access
* to the jimage file provided by the shipped JDK by tools running on JDK 8.
*/
class ImageBufferCache {
private static final int MAX_CACHED_BUFFERS = 3;
private static final int LARGE_BUFFER = 0x10000;
/*
* We used to have a class BufferReference extending from WeakReference<ByteBuffer>.
* BufferReference class had an instance field called "capacity". This field was
* used to make DECREASING_CAPACITY_NULLS_LAST comparator stable in the presence
* of GC clearing the WeakReference concurrently.
*
* But this scheme results in metaspace leak. The thread local is alive till the
* the thread is alive. And so ImageBufferCache$BufferReference class was kept alive.
* Because this class and ImageBufferCache$BufferReference are all loaded by a URL
* class loader from jrt-fs.jar, the class loader and so all the classes loaded by it
* were alive!
*
* Solution is to avoid using a URL loader loaded class type with thread local. All we
* need is a pair of WeakReference<ByteBuffer>, Integer (saved capacity for stability
* of comparator). We use Map.Entry as pair implementation. With this, all types used
* with thread local are bootstrap types and so no metaspace leak.
*/
@SuppressWarnings("unchecked")
private static final ThreadLocal<Map.Entry<WeakReference<ByteBuffer>, Integer>[]> CACHE =
new ThreadLocal<Map.Entry<WeakReference<ByteBuffer>, Integer>[]>() {
@Override
protected Map.Entry<WeakReference<ByteBuffer>, Integer>[] initialValue() {
// 1 extra slot to simplify logic of releaseBuffer()
return (Map.Entry<WeakReference<ByteBuffer>, Integer>[])new Map.Entry<?,?>[MAX_CACHED_BUFFERS + 1];
}
};
private static ByteBuffer allocateBuffer(long size) {
return ByteBuffer.allocateDirect((int)((size + 0xFFF) & ~0xFFF));
}
static ByteBuffer getBuffer(long size) {
if (size < 0 || Integer.MAX_VALUE < size) {
throw new IndexOutOfBoundsException("size");
}
ByteBuffer result = null;
if (size > LARGE_BUFFER) {
result = allocateBuffer(size);
} else {
Map.Entry<WeakReference<ByteBuffer>, Integer>[] cache = CACHE.get();
// buffers are ordered by decreasing capacity
// cache[MAX_CACHED_BUFFERS] is always null
for (int i = MAX_CACHED_BUFFERS - 1; i >= 0; i--) {
Map.Entry<WeakReference<ByteBuffer>, Integer> reference = cache[i];
if (reference != null) {
ByteBuffer buffer = getByteBuffer(reference);
if (buffer != null && size <= buffer.capacity()) {
cache[i] = null;
result = buffer;
result.rewind();
break;
}
}
}
if (result == null) {
result = allocateBuffer(size);
}
}
result.limit((int)size);
return result;
}
static void releaseBuffer(ByteBuffer buffer) {
if (buffer.capacity() > LARGE_BUFFER) {
return;
}
Map.Entry<WeakReference<ByteBuffer>, Integer>[] cache = CACHE.get();
// expunge cleared BufferRef(s)
for (int i = 0; i < MAX_CACHED_BUFFERS; i++) {
Map.Entry<WeakReference<ByteBuffer>, Integer> reference = cache[i];
if (reference != null && getByteBuffer(reference) == null) {
cache[i] = null;
}
}
// insert buffer back with new BufferRef wrapping it
cache[MAX_CACHED_BUFFERS] = newCacheEntry(buffer);
Arrays.sort(cache, DECREASING_CAPACITY_NULLS_LAST);
// squeeze the smallest one out
cache[MAX_CACHED_BUFFERS] = null;
}
private static Map.Entry<WeakReference<ByteBuffer>, Integer> newCacheEntry(ByteBuffer bb) {
return new AbstractMap.SimpleEntry<WeakReference<ByteBuffer>, Integer>(
new WeakReference<ByteBuffer>(bb), bb.capacity());
}
private static int getCapacity(Map.Entry<WeakReference<ByteBuffer>, Integer> e) {
return e == null? 0 : e.getValue();
}
private static ByteBuffer getByteBuffer(Map.Entry<WeakReference<ByteBuffer>, Integer> e) {
return e == null? null : e.getKey().get();
}
private static Comparator<Map.Entry<WeakReference<ByteBuffer>, Integer>> DECREASING_CAPACITY_NULLS_LAST =
new Comparator<Map.Entry<WeakReference<ByteBuffer>, Integer>>() {
@Override
public int compare(Map.Entry<WeakReference<ByteBuffer>, Integer> br1,
Map.Entry<WeakReference<ByteBuffer>, Integer> br2) {
return Integer.compare(getCapacity(br1), getCapacity(br2));
}
};
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2026, 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
@ -190,20 +190,7 @@ public final class ImageReader implements AutoCloseable {
}
/**
* Releases a (possibly cached) {@link ByteBuffer} obtained via
* {@link #getResourceBuffer(Node)}.
*
* <p>Note that no testing is performed to check whether the buffer about
* to be released actually came from a call to {@code getResourceBuffer()}.
*/
public static void releaseByteBuffer(ByteBuffer buffer) {
BasicImageReader.releaseByteBuffer(buffer);
}
/**
* Returns the content of a resource node in a possibly cached byte buffer.
* Callers of this method must call {@link #releaseByteBuffer(ByteBuffer)}
* when they are finished with it.
* Returns the content of a resource node in a newly allocated byte buffer.
*/
public ByteBuffer getResourceBuffer(Node node) {
requireOpen();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2026, 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
@ -467,12 +467,6 @@ public final class SystemModuleFinders {
.map(reader::getResourceBuffer);
}
@Override
public void release(ByteBuffer bb) {
Objects.requireNonNull(bb);
ImageReader.releaseByteBuffer(bb);
}
@Override
public Stream<String> list() throws IOException {
if (closed)

View File

@ -445,7 +445,7 @@ class CESU_8 extends Unicode
int dl = dst.arrayOffset() + dst.limit();
// Handle ASCII-only prefix
int n = JLA.encodeASCII(sa, sp, da, dp, Math.min(sl - sp, dl - dp));
int n = JLA.uncheckedEncodeASCII(sa, sp, da, dp, Math.min(sl - sp, dl - dp));
sp += n;
dp += n;

View File

@ -600,7 +600,7 @@ public class DoubleByte {
try {
if (isASCIICompatible) {
int n = JLA.encodeASCII(sa, sp, da, dp, Math.min(dl - dp, sl - sp));
int n = JLA.uncheckedEncodeASCII(sa, sp, da, dp, Math.min(dl - dp, sl - sp));
sp += n;
dp += n;
}

View File

@ -35,6 +35,7 @@ import java.util.Objects;
import jdk.internal.access.JavaLangAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.util.Preconditions;
import jdk.internal.vm.annotation.IntrinsicCandidate;
public class ISO_8859_1
@ -141,34 +142,20 @@ public class ISO_8859_1
private final Surrogate.Parser sgp = new Surrogate.Parser();
/**
* Encodes as many ISO-8859-1 codepoints as possible from the source
* character array into the destination byte array, assuming that
* the encoding is ISO-8859-1 compatible.
*
* @param sa the source character array
* @param sp the index of the source array to start reading from
* @param da the target byte array
* @param dp the index of the target array to start writing to
* @param len the maximum number of characters to be encoded
* @return the total number of characters successfully encoded
* @throws NullPointerException if any of the provided arrays is null
*/
// Method possible replaced with a compiler intrinsic.
private static int encodeISOArray(char[] sa, int sp,
byte[] da, int dp, int len) {
// This method should tolerate invalid arguments, matching the lenient behavior of the VM intrinsic.
// Hence, using operator expressions instead of `Preconditions`, which throw on failure.
if ((sp | dp | len) < 0 ||
sp >= sa.length || // Implicit null check on `sa`
dp >= da.length) { // Implicit null check on `da`
if (len <= 0) {
return 0;
}
int minLen = Math.min(len, Math.min(sa.length - sp, da.length - dp));
return encodeISOArray0(sa, sp, da, dp, minLen);
encodeISOArrayCheck(sa, sp, da, dp, len);
return implEncodeISOArray(sa, sp, da, dp, len);
}
@IntrinsicCandidate
private static int encodeISOArray0(char[] sa, int sp, byte[] da, int dp, int len) {
private static int implEncodeISOArray(char[] sa, int sp,
byte[] da, int dp, int len)
{
int i = 0;
for (; i < len; i++) {
char c = sa[sp++];
@ -179,6 +166,17 @@ public class ISO_8859_1
return i;
}
private static void encodeISOArrayCheck(char[] sa, int sp,
byte[] da, int dp, int len) {
Objects.requireNonNull(sa);
Objects.requireNonNull(da);
Preconditions.checkIndex(sp, sa.length, Preconditions.AIOOBE_FORMATTER);
Preconditions.checkIndex(dp, da.length, Preconditions.AIOOBE_FORMATTER);
Preconditions.checkIndex(sp + len - 1, sa.length, Preconditions.AIOOBE_FORMATTER);
Preconditions.checkIndex(dp + len - 1, da.length, Preconditions.AIOOBE_FORMATTER);
}
private CoderResult encodeArrayLoop(CharBuffer src,
ByteBuffer dst)
{

View File

@ -217,7 +217,7 @@ public class SingleByte
int len = Math.min(dl - dp, sl - sp);
if (isASCIICompatible) {
int n = JLA.encodeASCII(sa, sp, da, dp, len);
int n = JLA.uncheckedEncodeASCII(sa, sp, da, dp, len);
sp += n;
dp += n;
len -= n;

View File

@ -159,7 +159,7 @@ public class US_ASCII
assert (dp <= dl);
dp = (dp <= dl ? dp : dl);
int n = JLA.encodeASCII(sa, sp, da, dp, Math.min(sl - sp, dl - dp));
int n = JLA.uncheckedEncodeASCII(sa, sp, da, dp, Math.min(sl - sp, dl - dp));
sp += n;
dp += n;

View File

@ -452,7 +452,7 @@ public final class UTF_8 extends Unicode {
int dl = dst.arrayOffset() + dst.limit();
// Handle ASCII-only prefix
int n = JLA.encodeASCII(sa, sp, da, dp, Math.min(sl - sp, dl - dp));
int n = JLA.uncheckedEncodeASCII(sa, sp, da, dp, Math.min(sl - sp, dl - dp));
sp += n;
dp += n;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2026, 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
@ -32,6 +32,7 @@ import java.util.Arrays;
import jdk.internal.access.SharedSecrets;
import jdk.internal.io.JdkConsoleImpl;
import jdk.internal.misc.VM;
/**
* A utility class for reading passwords
@ -65,7 +66,9 @@ public class Password {
}
consoleBytes = ConsoleHolder.convertToBytes(consoleEntered);
in = new ByteArrayInputStream(consoleBytes);
} else if (System.in.available() == 0) {
} else if (in == System.in && VM.isBooted()
&& System.in.available() == 0) {
// Warn if reading password from System.in but it's empty.
// This may be running in an IDE Run Window or in JShell,
// which acts like an interactive console and echoes the
// entered password. In this case, print a warning that
@ -73,6 +76,7 @@ public class Password {
// it's more likely the input comes from a pipe, such as
// "echo password |" or "cat password_file |" where input
// will be silently consumed without echoing to the screen.
// Warn only if VM is booted and ResourcesMgr is available.
System.err.print(ResourcesMgr.getString
("warning.input.may.be.visible.on.screen"));
}

View File

@ -59,6 +59,9 @@ public class Pem {
// Pattern matching for stripping whitespace.
private static final Pattern STRIP_WHITESPACE_PATTERN;
// Pattern matching for inserting line breaks.
private static final Pattern LINE_WRAP_64_PATTERN;
// Lazy initialized PBES2 OID value
private static ObjectIdentifier PBES2OID;
@ -72,6 +75,7 @@ public class Pem {
PBE_PATTERN = Pattern.compile("^PBEWith.*And.*",
Pattern.CASE_INSENSITIVE);
STRIP_WHITESPACE_PATTERN = Pattern.compile("\\s+");
LINE_WRAP_64_PATTERN = Pattern.compile("(.{64})");
}
public static final String CERTIFICATE = "CERTIFICATE";
@ -359,7 +363,7 @@ public class Pem {
* @return PEM in a string
*/
public static String pemEncoded(PEM pem) {
String p = pem.content().replaceAll("(.{64})", "$1\r\n");
String p = LINE_WRAP_64_PATTERN.matcher(pem.content()).replaceAll("$1\r\n");
return pemEncoded(pem.type(), p);
}

View File

@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata2025b
tzdata2025c

View File

@ -27,9 +27,9 @@
# 2009-05-17 by Arthur David Olson.
# This file is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@iana.org for general use in the future). For more, please see
# the file CONTRIBUTING in the tz distribution.
# go ahead and edit the file, and please send any changes to
# the public mailing list tz@iana.org for general use in the future.
# For more, please see the file CONTRIBUTING in the tz distribution.
# From Paul Eggert (2018-05-27):
#
@ -138,8 +138,9 @@ Zone Atlantic/Cape_Verde -1:34:04 - LMT 1912 Jan 01 2:00u # Praia
-1:00 - %z
# Chad
# Fort-Lamy was renamed to NDjamena on 1973-04-06.
# Zone NAME STDOFF RULES FORMAT [UNTIL]
Zone Africa/Ndjamena 1:00:12 - LMT 1912 Jan 1 # N'Djamena
Zone Africa/Ndjamena 1:00:12 - LMT 1912 Jan 1 # Fort-Lamy
1:00 - WAT 1979 Oct 14
1:00 1:00 WAST 1980 Mar 8
1:00 - WAT

View File

@ -26,13 +26,10 @@
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# From Paul Eggert (1999-11-15):
# To keep things manageable, we list only locations occupied year-round; see
# COMNAP - Stations and Bases
# http://www.comnap.aq/comnap/comnap.nsf/P/Stations/
# and
# Summary of the Peri-Antarctic Islands (1998-07-23)
# http://www.spri.cam.ac.uk/bob/periant.htm
# From Paul Eggert (2025-08-16):
# To keep things manageable, list only locations occupied year-round; see
# Antarctic Facilities Information
# https://www.comnap.aq/antarctic-facilities-information
# for information.
# Unless otherwise specified, we have no time zone information.
@ -167,6 +164,7 @@ Zone Antarctica/Mawson 0 - -00 1954 Feb 13
# China - year-round bases
# Great Wall, King George Island, -6213-05858, since 1985-02-20
# Zhongshan, Larsemann Hills, Prydz Bay, -6922+07623, since 1989-02-26
# Qinling, Inexpressible I, Terra Nova Bay, -7456+16343, since 2024-02-07
# France - year-round bases (also see "France & Italy")
#

View File

@ -27,9 +27,9 @@
# 2009-05-17 by Arthur David Olson.
# This file is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@iana.org for general use in the future). For more, please see
# the file CONTRIBUTING in the tz distribution.
# go ahead and edit the file, and please send any changes to
# the public mailing list tz@iana.org for general use in the future.
# For more, please see the file CONTRIBUTING in the tz distribution.
# From Paul Eggert (2019-07-11):
#

View File

@ -960,9 +960,9 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila
# NOTES
# This file is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@iana.org for general use in the future). For more, please see
# the file CONTRIBUTING in the tz distribution.
# go ahead and edit the file, and please send any changes to
# the public mailing list tz@iana.org for general use in the future.
# For more, please see the file CONTRIBUTING in the tz distribution.
# From Paul Eggert (2018-11-18):
#
@ -2011,6 +2011,7 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila
# From Paul Eggert (2018-11-19):
# The 1921-01-15 introduction of standard time is in Shanks; it is also in
# "Standard Time Throughout the World", US National Bureau of Standards (1935),
# https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular406.pdf
# page 3, which does not give the UT offset. In response to a comment by
# Phake Nick I set the Nauru time of occupation by Japan to
# 1942-08-29/1945-09-08 by using dates from:
@ -2078,9 +2079,10 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila
# https://webspace.science.uu.nl/~gent0113/idl/idl_alaska_samoa.htm
# Although Shanks & Pottenger says they both switched to UT -11:30
# in 1911, and to -11 in 1950. many earlier sources give -11
# in 1911, and to -11 in 1950, many earlier sources give -11
# for American Samoa, e.g., the US National Bureau of Standards
# circular "Standard Time Throughout the World", 1932.
# https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular399.pdf
# Assume American Samoa switched to -11 in 1911, not 1950,
# and that after 1950 they agreed until (western) Samoa skipped a
# day in 2011. Assume also that the Samoas follow the US and New

View File

@ -27,9 +27,9 @@
# 2009-05-17 by Arthur David Olson.
# This file is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@iana.org for general use in the future). For more, please see
# the file CONTRIBUTING in the tz distribution.
# go ahead and edit the file, and please send any changes to
# the public mailing list tz@iana.org for general use in the future.
# For more, please see the file CONTRIBUTING in the tz distribution.
# From Paul Eggert (2017-02-10):
#
@ -65,7 +65,7 @@
# <https://www.jstor.org/stable/1774359>. He writes:
# "It is requested that corrections and additions to these tables
# may be sent to Mr. John Milne, Royal Geographical Society,
# Savile Row, London." Nowadays please email them to tz@iana.org.
# Savile Row, London." Nowadays please see the file CONTRIBUTING.
#
# Byalokoz EL. New Counting of Time in Russia since July 1, 1919.
# This Russian-language source was consulted by Vladimir Karpinsky; see
@ -77,7 +77,7 @@
# Десятая гос. тип., 1919.
# http://resolver.gpntb.ru/purl?docushare/dsweb/Get/Resource-2011/Byalokoz__E.L.__Novyy__schet__vremeni__v__techenie__sutok__izd__2(1).pdf
#
# Brazil's Divisão Serviço da Hora (DSHO),
# Brazil's Divisão de Serviços da Hora (DISHO)
# History of Summer Time
# <http://pcdsh01.on.br/HISTHV.htm>
# (1998-09-21, in Portuguese)
@ -937,7 +937,7 @@ Rule Belgium 1922 1927 - Oct Sat>=1 23:00s 0 -
Rule Belgium 1923 only - Apr 21 23:00s 1:00 S
Rule Belgium 1924 only - Mar 29 23:00s 1:00 S
Rule Belgium 1925 only - Apr 4 23:00s 1:00 S
# DSH writes that a royal decree of 1926-02-22 specified the Sun following 3rd
# DISHO writes that a royal decree of 1926-02-22 specified the Sun following 3rd
# Sat in Apr (except if it's Easter, in which case it's one Sunday earlier),
# to Sun following 1st Sat in Oct, and that a royal decree of 1928-09-15
# changed the transition times to 02:00 GMT.
@ -1333,6 +1333,13 @@ Zone Europe/Helsinki 1:39:49 - LMT 1878 May 31
# France
# Monaco
# From Robert H. van Gent (2025-07-21):
# The most recent issue of the Annuaire [par le Bureau des Longitudes]
# on Gallica (2021) ... lists information for France
# https://gallica.bnf.fr/ark:/12148/bpt6k9127672b/f52.item
# From Paul Eggert (2025-07-21):
# Go with the 2020 Annuaire (published 2021) except as noted below.
# From Ciro Discepolo (2000-12-20):
#
# Henri Le Corre, Régimes horaires pour le monde entier, Éditions
@ -1394,7 +1401,6 @@ Zone Europe/Helsinki 1:39:49 - LMT 1878 May 31
# problems in Algiers, Monaco and Tunis.
#
# Shank & Pottenger seem to use '24:00' ambiguously; resolve it with Whitman.
# Rule NAME FROM TO - IN ON AT SAVE LETTER/S
Rule France 1916 only - Jun 14 23:00s 1:00 S
Rule France 1916 1919 - Oct Sun>=1 23:00s 0 -
@ -1406,9 +1412,25 @@ Rule France 1920 only - Oct 23 23:00s 0 -
Rule France 1921 only - Mar 14 23:00s 1:00 S
Rule France 1921 only - Oct 25 23:00s 0 -
Rule France 1922 only - Mar 25 23:00s 1:00 S
# DSH writes that a law of 1923-05-24 specified 3rd Sat in Apr at 23:00 to 1st
# Sat in Oct at 24:00; and that in 1930, because of Easter, the transitions
# were Apr 12 and Oct 5. Go with Shanks & Pottenger.
# From Robert H. van Gent (2025-07-22):
# There is a curious history behind the erroneous date for the start of
# daylight saving in France in 1923 as listed in the current issues of
# the Annuaire du Bureau des Longitudes. [See:]
# https://lists.iana.org/hyperkitty/list/tz@iana.org/message/MYQEJMSXO2AIEZ3UIXZKMTTAIPY7KNT2/
# From Brian Inglis (2025-07-23):
# Légifrance JORF No. 0073 du 15 mars 1922
# https://www.legifrance.gouv.fr/jorf/jo/id/JORFCONT000000008324
# Légifrance JORF No. 0139 du 25 mai 1923
# https://www.legifrance.gouv.fr/jorf/jo/id/JORFCONT000000008416
# From Paul Eggert (2025-07-23):
# The latter specifies March's last Saturday at 23:00 to October's first
# Saturday at 24:00, except that if neighboring allies agree the dates
# can be moved to April's third Saturday and September's third Saturday.
# Apparently spring 1923 was tricky. DISHO writes that in 1930,
# because of Easter, the transitions were Apr 12 and Oct 5.
# Use the 2020 Annuaire dates, except for spring 1923 where
# Shanks & Pottenger's May 26 matches the dates given in the 1924 and
# 1961-2001 issues of the Annuaire.
Rule France 1922 1938 - Oct Sat>=1 23:00s 0 -
Rule France 1923 only - May 26 23:00s 1:00 S
Rule France 1924 only - Mar 29 23:00s 1:00 S
@ -2119,12 +2141,10 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880
# all clocks therefore having to be advanced or set back correspondingly ...
# Rule NAME FROM TO - IN ON AT SAVE LETTER/S
# From Tim Parenti (2024-07-01), per Paul Eggert (1999-01-30):
# DSH writes in their history that Decreto 1469 of 1915-03-30 established
# summer time and that, "despite" this, the change to the clocks was not done
# every year, depending on what Spain did, because of railroad schedules.
# In fact, that decree had nothing to do with DST; rather, it regulated the
# sending of time signals. But we do see linkage to Spain in the 1920s below.
# From Tim Parenti (2024-07-01):
# Decreto 1469 of 1915-03-30 ... had nothing to do with DST;
# rather it regulated the sending of time signals.
# But we do see linkage to Spain in the 1920s below.
# https://dre.pt/dr/detalhe/decreto/1469-1915-285721
# https://dre.pt/application/conteudo/285721
#

View File

@ -26,22 +26,22 @@
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
# From Paul Eggert (2023-09-06):
# From Paul Eggert (2025-07-01):
# This file contains a table of two-letter country codes. Columns are
# separated by a single tab. Lines beginning with '#' are comments.
# separated by a single tab. Lines beginning with # are comments.
# All text uses UTF-8 encoding. The columns of the table are as follows:
#
# 1. ISO 3166-1 alpha-2 country code, current as of
# ISO/TC 46 N1108 (2023-04-05). See: ISO/TC 46 Documents
# ISO/TC 46 N1127 (2024-02-29). See: ISO/TC 46 Documents
# https://www.iso.org/committee/48750.html?view=documents
# 2. The usual English name for the coded region. This sometimes
# departs from ISO-listed names, sometimes so that sorted subsets
# of names are useful (e.g., "Samoa (American)" and "Samoa
# (western)" rather than "American Samoa" and "Samoa"),
# of names are useful (e.g., “Samoa (American)” and “Samoa
# (western)” rather than “American Samoa” and “Samoa”),
# sometimes to avoid confusion among non-experts (e.g.,
# "Czech Republic" and "Turkey" rather than "Czechia" and "Türkiye"),
# and sometimes to omit needless detail or churn (e.g., "Netherlands"
# rather than "Netherlands (the)" or "Netherlands (Kingdom of the)").
# “Czech Republic” and “Turkey” rather than “Czechia” and “Türkiye”),
# and sometimes to omit needless detail or churn (e.g., “Netherlands”
# rather than “Netherlands (the)” or “Netherlands (Kingdom of the)”).
#
# The table is sorted by country code.
#
@ -94,7 +94,7 @@ CD Congo (Dem. Rep.)
CF Central African Rep.
CG Congo (Rep.)
CH Switzerland
CI Côte d'Ivoire
CI Côte dIvoire
CK Cook Islands
CL Chile
CM Cameroon

View File

@ -28,7 +28,8 @@
# This file is generated automatically from the data in the public-domain
# NIST/IERS format leap-seconds.list file, which can be copied from
# <https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list>
# or, in a variant with different comments, from
# or via a less-secure protocol and with different comments and
# less volatile last-modified and expiration timestamps, from
# <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>.
# For more about leap-seconds.list, please see
# The NTP Timescale and Leap Seconds
@ -92,11 +93,17 @@ Leap 2016 Dec 31 23:59:60 + S
# Any additional leap seconds will come after this.
# This Expires line is commented out for now,
# so that pre-2020a zic implementations do not reject this file.
#Expires 2025 Dec 28 00:00:00
#Expires 2026 Jun 28 00:00:00
# POSIX timestamps for the data in this file:
#updated 1736208000 (2025-01-07 00:00:00 UTC)
#expires 1766880000 (2025-12-28 00:00:00 UTC)
# Here are POSIX timestamps for the data in this file.
# "#updated" gives the last time the leap seconds data changed
# or, if this file was derived from the IERS leap-seconds.list,
# the last time that file changed in any way.
# "#expires" gives the first time this file might be wrong;
# if this file was derived from the IERS leap-seconds.list,
# this is typically a bit less than one year after "updated".
#updated 1751846400 (2025-07-07 00:00:00 UTC)
#expires 1782604800 (2026-06-28 00:00:00 UTC)
# Updated through IERS Bulletin C (https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat)
# File expires on 28 December 2025
# File expires on 28 June 2026

View File

@ -29,9 +29,9 @@
# also includes Central America and the Caribbean
# This file is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@iana.org for general use in the future). For more, please see
# the file CONTRIBUTING in the tz distribution.
# go ahead and edit the file, and please send any changes to
# the public mailing list tz@iana.org for general use in the future.
# For more, please see the file CONTRIBUTING in the tz distribution.
# From Paul Eggert (1999-03-22):
# A reliable and entertaining source about time zones is
@ -1241,6 +1241,16 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00
# _Los Angeles Times_ (1998-11-10), A1, A10; it cites
# Jimmy Skaggs, _The Great Guano Rush_ (1994).
# From Rob van Gent (2025-07-23):
# Another useful source for historical time zone information appears to be
# a series of circulars with the title "Standard Time Throughout the World"
# issued between 1925 and 1950 by the U.S. Bureau of Standards.
# I found the following issues online:
# https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular280.pdf (1925)
# https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular399.pdf (1932)
# https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular406.pdf (1935)
# https://nvlpubs.nist.gov/nistpubs/Legacy/circ/nbscircular496.pdf (1950)
################################################################################
@ -2457,12 +2467,35 @@ Zone America/Dawson -9:17:40 - LMT 1900 Aug 20
# on the same dates or with a difference of one day.
# So it may be easier to implement these changes as DST with rule CA
# during this whole period.
# From Alois Treindl (2025-07-29):
# I did a quick newspaper archive research on https://hndm.iib.unam.mx/
# and found that Periódico Oficial del Estado de Baja California Norte
# (1973-04-20) states clearly that DST was observed from last Sunday
# in April to last Sunday in October.... I have a few more data from the
# official bulletin for DST begin or end in Baja California 1964 1967 1969
# 1972 1973 (already sent) 1974 1975 1976 I do not know whether it is safe to
# assume that it also applied in the years where I did not yet find proof.
# The 1974 end of DST contains a reference to an Acuerdo of 1973-dec-20 which
# I could not find.... One might assume that Baja California, which followed
# US-CA in all these other yours, did the same.
#
# From Paul Eggert (2024-08-18):
# For now, maintain the slightly-different history for Baja California,
# From Paul Eggert (2025-08-04):
# Assume that Tijuana agreed with San Diego from 1953 through 1996,
# as this agrees with Alois Treindl's data and with Shanks.
# For now, keep the slightly-different 1948/1952 history for Baja California,
# as we have no information on whether 1948/1952 clocks in Tijuana followed
# the decrees or followed San Diego.
# From Mark Schapiro, writing in The Nation (2002-10-28):
# https://www.thenation.com/article/archive/sowing-disaster/
# When Mexican clocks were turned back for daylight saving time in the spring,
# the Zapotecs refused to make the adjustment, insisting that they live in
# "God's time," not in what they derisively call "Fox time," referring to
# President Vicente Fox in far-off Mexico City.
# From Paul Eggert (2025-08-04):
# Unfortunately we have no data to track this informal practice.
# From Alan Perry (1996-02-15):
# A guy from our Mexico subsidiary finally found the Presidential Decree
# outlining the timezone changes in Mexico.
@ -2728,7 +2761,7 @@ Zone America/Mexico_City -6:36:36 - LMT 1922 Jan 1 7:00u
# Chihuahua (near US border - western side)
# This includes the municipios of Janos, Ascensión, Juárez, Guadalupe, and
# Práxedis G Guerrero.
# http://gaceta.diputados.gob.mx/PDF/65/2a022/nov/20221124-VII.pdf
# https://gaceta.diputados.gob.mx/PDF/65/2022/nov/20221124-VII.pdf
Zone America/Ciudad_Juarez -7:05:56 - LMT 1922 Jan 1 7:00u
-7:00 - MST 1927 Jun 10
-6:00 - CST 1930 Nov 15
@ -2743,7 +2776,7 @@ Zone America/Ciudad_Juarez -7:05:56 - LMT 1922 Jan 1 7:00u
# Chihuahua (near US border - eastern side)
# This includes the municipios of Coyame del Sotol, Ojinaga, and Manuel
# Benavides.
# http://gaceta.diputados.gob.mx/PDF/65/2a022/nov/20221124-VII.pdf
# https://gaceta.diputados.gob.mx/PDF/65/2022/nov/20221124-VII.pdf
Zone America/Ojinaga -6:57:40 - LMT 1922 Jan 1 7:00u
-7:00 - MST 1927 Jun 10
-6:00 - CST 1930 Nov 15
@ -2840,9 +2873,7 @@ Zone America/Tijuana -7:48:04 - LMT 1922 Jan 1 7:00u
-8:00 1:00 PDT 1951 Sep 30 2:00
-8:00 - PST 1952 Apr 27 2:00
-8:00 1:00 PDT 1952 Sep 28 2:00
-8:00 - PST 1954
-8:00 CA P%sT 1961
-8:00 - PST 1976
-8:00 CA P%sT 1967
-8:00 US P%sT 1996
-8:00 Mexico P%sT 2001
-8:00 US P%sT 2002 Feb 20

View File

@ -27,9 +27,9 @@
# 2009-05-17 by Arthur David Olson.
# This file is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@iana.org for general use in the future). For more, please see
# the file CONTRIBUTING in the tz distribution.
# go ahead and edit the file, and please send any changes to
# the public mailing list tz@iana.org for general use in the future.
# For more, please see the file CONTRIBUTING in the tz distribution.
# From Paul Eggert (2016-12-05):
#

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2026, 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
@ -98,7 +98,8 @@ class UnixFileAttributes
path, flag, attrs);
if (errno == 0)
return attrs;
else if (errno == UnixConstants.ENOENT)
else if (errno == UnixConstants.ENOENT ||
errno == UnixConstants.ENOTDIR)
return null;
else
throw new UnixException(errno);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2026, 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
@ -62,19 +62,18 @@ import java.awt.geom.AffineTransform;
* @see java.awt.Graphics2D#getFontRenderContext()
* @see java.awt.font.LineMetrics
*/
public class FontRenderContext {
private transient AffineTransform tx;
private transient Object aaHintValue;
private transient Object fmHintValue;
private transient boolean defaulting;
private final transient AffineTransform tx;
private final transient Object aaHintValue;
private final transient Object fmHintValue;
private final transient boolean defaulting;
/**
* Constructs a new {@code FontRenderContext}
* object.
*
*/
protected FontRenderContext() {
tx = null;
aaHintValue = VALUE_TEXT_ANTIALIAS_DEFAULT;
fmHintValue = VALUE_FRACTIONALMETRICS_DEFAULT;
defaulting = true;
@ -105,6 +104,8 @@ public class FontRenderContext {
boolean usesFractionalMetrics) {
if (tx != null && !tx.isIdentity()) {
this.tx = new AffineTransform(tx);
} else {
this.tx = null;
}
if (isAntiAliased) {
aaHintValue = VALUE_TEXT_ANTIALIAS_ON;
@ -116,6 +117,7 @@ public class FontRenderContext {
} else {
fmHintValue = VALUE_FRACTIONALMETRICS_OFF;
}
defaulting = false;
}
/**
@ -145,6 +147,8 @@ public class FontRenderContext {
public FontRenderContext(AffineTransform tx, Object aaHint, Object fmHint){
if (tx != null && !tx.isIdentity()) {
this.tx = new AffineTransform(tx);
} else {
this.tx = null;
}
try {
if (KEY_TEXT_ANTIALIASING.isCompatibleValue(aaHint)) {
@ -164,6 +168,7 @@ public class FontRenderContext {
} catch (Exception e) {
throw new IllegalArgumentException("FM hint:" +fmHint);
}
defaulting = false;
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2026, 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
@ -396,10 +396,7 @@ final class TextLine {
BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = im.createGraphics();
g2d.setColor(Color.WHITE);
g2d.fillRect(0, 0, im.getWidth(), im.getHeight());
g2d.setColor(Color.BLACK);
g2d.setColor(Color.WHITE); // white over transparent black bg
draw(g2d, rx + MARGIN - bounds.x, ry + MARGIN - bounds.y);
result = computePixelBounds(im);
@ -428,7 +425,7 @@ final class TextLine {
loop: while (++t < h) {
im.getRGB(0, t, buf.length, 1, buf, 0, w); // w ignored
for (int i = 0; i < buf.length; i++) {
if (buf[i] != -1) {
if (buf[i] != 0) {
break loop;
}
}
@ -441,7 +438,7 @@ final class TextLine {
loop: while (--b > t) {
im.getRGB(0, b, buf.length, 1, buf, 0, w); // w ignored
for (int i = 0; i < buf.length; ++i) {
if (buf[i] != -1) {
if (buf[i] != 0) {
break loop;
}
}
@ -454,7 +451,7 @@ final class TextLine {
loop: while (++l < r) {
for (int i = t; i < b; ++i) {
int v = im.getRGB(l, i);
if (v != -1) {
if (v != 0) {
break loop;
}
}
@ -466,7 +463,7 @@ final class TextLine {
loop: while (--r > l) {
for (int i = t; i < b; ++i) {
int v = im.getRGB(r, i);
if (v != -1) {
if (v != 0) {
break loop;
}
}

View File

@ -309,7 +309,7 @@ public class EUC_JP
try {
if (enc0201.isASCIICompatible()) {
int n = JLA.encodeASCII(sa, sp, da, dp, Math.min(dl - dp, sl - sp));
int n = JLA.uncheckedEncodeASCII(sa, sp, da, dp, Math.min(dl - dp, sl - sp));
sp += n;
dp += n;
}

View File

@ -1,5 +1,5 @@
---
# Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2017, 2026, 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
@ -70,6 +70,7 @@ Developers are responsible for updating their custom runtime images.
and zip-9 provides the best compression. Default is zip-6.
: Deprecated values to be removed in a future release:
- `0`: No compression. Use zip-0 instead.
- `1`: Constant string sharing
- `2`: ZIP. Use zip-6 instead.
@ -182,6 +183,7 @@ Description
and zip-9 provides the best compression. Default is zip-6.
: Deprecated values to be removed in a future release:
- Level 0: No compression. Use zip-0 instead.
- Level 1: Constant string sharing
- Level 2: ZIP. Use zip-6 instead.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, 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
@ -40,6 +40,7 @@ import javax.naming.ldap.Rdn;
import javax.security.auth.x500.X500Principal;
import jdk.jpackage.internal.MacCertificateUtils.CertificateHash;
import jdk.jpackage.internal.model.ConfigException;
import jdk.jpackage.internal.model.JPackageException;
import jdk.jpackage.internal.model.SigningIdentity;
final class SigningIdentityBuilder {
@ -147,11 +148,9 @@ final class SigningIdentityBuilder {
Objects.requireNonNull(keychain);
switch (certs.size()) {
case 0 -> {
var errMsg = I18N.format("error.cert.not.found", certificateSelector.signingIdentities().getFirst(),
keychain.map(Keychain::name).orElse(""));
Log.error(I18N.format("message.error-header", errMsg));
throw I18N.buildConfigException("error.explicit-sign-no-cert")
.advice("error.explicit-sign-no-cert.advice").create();
throw new JPackageException(I18N.format("error.cert.not.found",
certificateSelector.signingIdentities().getFirst(),
keychain.map(Keychain::name).orElse("")));
}
case 1 -> {
return certs.getFirst();

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2017, 2026, 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
@ -24,8 +24,6 @@
#
#
error.invalid-cfbundle-version.advice=Set a compatible 'app-version' value. Valid versions are one to three integers separated by dots.
error.explicit-sign-no-cert=Signature explicitly requested but no signing certificate found
error.explicit-sign-no-cert.advice=Specify a valid mac-signing-key-user-name and mac-signing-keychain
error.certificate.expired=Certificate expired {0}
error.cert.not.found=No certificate found matching [{0}] using keychain [{1}]
error.multiple.certs.found=Multiple certificates matching name [{0}] found in keychain [{1}]

View File

@ -1,4 +1,5 @@
/*
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -23,20 +24,21 @@
*/
#include "cds/archiveUtils.hpp"
#include "runtime/atomic.hpp"
#include "unittest.hpp"
class TestArchiveWorkerTask : public ArchiveWorkerTask {
private:
volatile int _sum;
int _max;
Atomic<int> _sum;
Atomic<int> _max;
public:
TestArchiveWorkerTask() : ArchiveWorkerTask("Test"), _sum(0), _max(0) {}
void work(int chunk, int max_chunks) override {
AtomicAccess::add(&_sum, chunk);
AtomicAccess::store(&_max, max_chunks);
_sum.add_then_fetch(chunk);
_max.store_relaxed(max_chunks);
}
int sum() { return AtomicAccess::load(&_sum); }
int max() { return AtomicAccess::load(&_max); }
int sum() { return _sum.load_relaxed(); }
int max() { return _max.load_relaxed(); }
};
// Test a repeated cycle of workers init/shutdown without task works.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2026, 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
@ -22,9 +22,10 @@
*
*/
#include "cppstdlib/new.hpp"
#include "gc/g1/g1BatchedTask.hpp"
#include "gc/shared/workerThread.hpp"
#include "runtime/atomicAccess.hpp"
#include "runtime/atomic.hpp"
#include "unittest.hpp"
class G1BatchedTaskWorkers : AllStatic {
@ -49,26 +50,26 @@ WorkerThreads* G1BatchedTaskWorkers::_workers = nullptr;
class G1TestSubTask : public G1AbstractSubTask {
mutable uint _phase;
volatile uint _num_do_work; // Amount of do_work() has been called.
Atomic<uint> _num_do_work; // Amount of do_work() has been called.
void check_and_inc_phase(uint expected) const {
ASSERT_EQ(_phase, expected);
_phase++;
}
bool volatile* _do_work_called_by;
Atomic<bool>* _do_work_called_by;
protected:
uint _max_workers;
void do_work_called(uint worker_id) {
AtomicAccess::inc(&_num_do_work);
bool orig_value = AtomicAccess::cmpxchg(&_do_work_called_by[worker_id], false, true);
_num_do_work.add_then_fetch(1u);
bool orig_value = _do_work_called_by[worker_id].compare_exchange(false, true);
ASSERT_EQ(orig_value, false);
}
void verify_do_work_called_by(uint num_workers) {
ASSERT_EQ(AtomicAccess::load(&_num_do_work), num_workers);
ASSERT_EQ(_num_do_work.load_relaxed(), num_workers);
// Do not need to check the _do_work_called_by array. The count is already verified
// by above statement, and we already check that a given flag is only set once.
}
@ -86,7 +87,7 @@ public:
~G1TestSubTask() {
check_and_inc_phase(3);
FREE_C_HEAP_ARRAY(bool, _do_work_called_by);
FREE_C_HEAP_ARRAY(Atomic<bool>, _do_work_called_by);
}
double worker_cost() const override {
@ -100,9 +101,9 @@ public:
assert(max_workers >= 1, "must be");
check_and_inc_phase(2);
_do_work_called_by = NEW_C_HEAP_ARRAY(bool, max_workers, mtInternal);
_do_work_called_by = NEW_C_HEAP_ARRAY(Atomic<bool>, max_workers, mtInternal);
for (uint i = 0; i < max_workers; i++) {
_do_work_called_by[i] = false;
::new (&_do_work_called_by[i]) Atomic<bool>{false};
}
_max_workers = max_workers;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2026, 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
@ -30,6 +30,7 @@
#include "gc/shared/workerThread.hpp"
#include "logging/log.hpp"
#include "memory/allocation.hpp"
#include "runtime/atomic.hpp"
#include "unittest.hpp"
#include "utilities/powerOfTwo.hpp"
@ -385,8 +386,8 @@ void G1CardSetTest::cardset_basic_test() {
class G1CardSetMtTestTask : public WorkerTask {
G1CardSet* _card_set;
size_t _added;
size_t _found;
Atomic<size_t> _added;
Atomic<size_t> _found;
public:
G1CardSetMtTestTask(G1CardSet* card_set) :
@ -413,12 +414,12 @@ public:
found++;
}
}
AtomicAccess::add(&_added, added);
AtomicAccess::add(&_found, found);
_added.add_then_fetch(added);
_found.add_then_fetch(found);
}
size_t added() const { return _added; }
size_t found() const { return _found; }
size_t added() const { return _added.load_relaxed(); }
size_t found() const { return _found.load_relaxed(); }
};
void G1CardSetTest::cardset_mt_test() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2026, 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
@ -26,7 +26,7 @@
#include "gc/g1/g1RegionToSpaceMapper.hpp"
#include "gc/shared/workerThread.hpp"
#include "memory/memoryReserver.hpp"
#include "runtime/atomicAccess.hpp"
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
#include "unittest.hpp"
@ -51,7 +51,7 @@ WorkerThreads* G1MapperWorkers::_workers = nullptr;
class G1TestCommitUncommit : public WorkerTask {
G1RegionToSpaceMapper* _mapper;
uint _claim_id;
Atomic<uint> _claim_id;
public:
G1TestCommitUncommit(G1RegionToSpaceMapper* mapper) :
WorkerTask("Stress mapper"),
@ -59,7 +59,7 @@ public:
_claim_id(0) { }
void work(uint worker_id) {
uint index = AtomicAccess::fetch_then_add(&_claim_id, 1u);
uint index = _claim_id.fetch_then_add(1u);
for (int i = 0; i < 100000; i++) {
// Stress commit and uncommit of a single region. The same

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, 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
@ -24,7 +24,7 @@
#include "gc/shared/bufferNode.hpp"
#include "memory/allocation.hpp"
#include "runtime/atomicAccess.hpp"
#include "runtime/atomic.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/semaphore.inline.hpp"
#include "runtime/thread.hpp"
@ -116,16 +116,16 @@ public:
class BufferNode::TestSupport::AllocatorThread : public JavaTestThread {
BufferNode::Allocator* _allocator;
CompletedList* _cbl;
volatile size_t* _total_allocations;
volatile bool* _continue_running;
Atomic<size_t>* _total_allocations;
Atomic<bool>* _continue_running;
size_t _allocations;
public:
AllocatorThread(Semaphore* post,
BufferNode::Allocator* allocator,
CompletedList* cbl,
volatile size_t* total_allocations,
volatile bool* continue_running) :
Atomic<size_t>* total_allocations,
Atomic<bool>* continue_running) :
JavaTestThread(post),
_allocator(allocator),
_cbl(cbl),
@ -135,14 +135,14 @@ public:
{}
virtual void main_run() {
while (AtomicAccess::load_acquire(_continue_running)) {
while (_continue_running->load_acquire()) {
BufferNode* node = _allocator->allocate();
_cbl->push(node);
++_allocations;
ThreadBlockInVM tbiv(this); // Safepoint check.
}
tty->print_cr("allocations: %zu", _allocations);
AtomicAccess::add(_total_allocations, _allocations);
_total_allocations->add_then_fetch(_allocations);
}
};
@ -151,13 +151,13 @@ public:
class BufferNode::TestSupport::ProcessorThread : public JavaTestThread {
BufferNode::Allocator* _allocator;
CompletedList* _cbl;
volatile bool* _continue_running;
Atomic<bool>* _continue_running;
public:
ProcessorThread(Semaphore* post,
BufferNode::Allocator* allocator,
CompletedList* cbl,
volatile bool* continue_running) :
Atomic<bool>* continue_running) :
JavaTestThread(post),
_allocator(allocator),
_cbl(cbl),
@ -172,7 +172,7 @@ public:
_allocator->release(node);
} else if (shutdown_requested) {
return;
} else if (!AtomicAccess::load_acquire(_continue_running)) {
} else if (!_continue_running->load_acquire()) {
// To avoid a race that could leave buffers in the list after this
// thread has shut down, continue processing until the list is empty
// *after* the shut down request has been received.
@ -193,9 +193,9 @@ static void run_test(BufferNode::Allocator* allocator, CompletedList* cbl) {
constexpr uint milliseconds_to_run = 1000;
Semaphore post;
volatile size_t total_allocations = 0;
volatile bool allocator_running = true;
volatile bool processor_running = true;
Atomic<size_t> total_allocations{0};
Atomic<bool> allocator_running{true};
Atomic<bool> processor_running{true};
ProcessorThread* proc_threads[num_processor_threads] = {};
for (uint i = 0; i < num_processor_threads; ++i) {
@ -222,18 +222,18 @@ static void run_test(BufferNode::Allocator* allocator, CompletedList* cbl) {
ThreadInVMfromNative invm(this_thread);
this_thread->sleep(milliseconds_to_run);
}
AtomicAccess::release_store(&allocator_running, false);
allocator_running.release_store(false);
for (uint i = 0; i < num_allocator_threads; ++i) {
ThreadInVMfromNative invm(this_thread);
post.wait_with_safepoint_check(this_thread);
}
AtomicAccess::release_store(&processor_running, false);
processor_running.release_store(false);
for (uint i = 0; i < num_processor_threads; ++i) {
ThreadInVMfromNative invm(this_thread);
post.wait_with_safepoint_check(this_thread);
}
ASSERT_TRUE(BufferNode::TestSupport::try_transfer_pending(allocator));
tty->print_cr("total allocations: %zu", total_allocations);
tty->print_cr("total allocations: %zu", total_allocations.load_relaxed());
tty->print_cr("allocator free count: %zu", allocator->free_count());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2026, 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
@ -22,6 +22,7 @@
*
*/
#include "cppstdlib/cstdlib.hpp"
#include "jni.h"
#include "runtime/os.hpp"
#include "runtime/thread.inline.hpp"
@ -31,7 +32,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <dlfcn.h>
#endif

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2024, 2025, Red Hat, Inc. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, 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
@ -32,7 +32,6 @@ TEST_VM(CompressedKlass, basics) {
if (!UseCompressedClassPointers) {
return;
}
ASSERT_LE((address)0, CompressedKlassPointers::base());
ASSERT_LE(CompressedKlassPointers::base(), CompressedKlassPointers::klass_range_start());
ASSERT_LT(CompressedKlassPointers::klass_range_start(), CompressedKlassPointers::klass_range_end());
ASSERT_LE(CompressedKlassPointers::klass_range_end(), CompressedKlassPointers::encoding_range_end());
@ -50,7 +49,7 @@ TEST_VM(CompressedKlass, basics) {
ASSERT_EQ(CompressedKlassPointers::encoding_range_end() - CompressedKlassPointers::base(), (ptrdiff_t)expected_size);
}
#else
ASSERT_EQ(CompressedKlassPointers::base(), (address)0);
ASSERT_EQ(CompressedKlassPointers::base(), nullptr);
ASSERT_EQ(CompressedKlassPointers::encoding_range_end(), (address)(UINT_MAX));
#endif // _LP64
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2026, 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
@ -24,9 +24,9 @@
#ifndef UNITTEST_HPP
#define UNITTEST_HPP
#include "cppstdlib/cstdlib.hpp"
#include "utilities/globalDefinitions.hpp"
#include <stdlib.h>
#include <stdio.h>
#define GTEST_DONT_DEFINE_TEST 1

Some files were not shown because too many files have changed in this diff Show More