代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/openjdk-17 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
---
src/hotspot/cpu/aarch64/assembler_aarch64.cpp | 20 ++
src/hotspot/cpu/aarch64/assembler_aarch64.hpp | 13 +-
src/hotspot/os/linux/osContainer_linux.cpp | 2 +-
src/hotspot/os/linux/os_perf_linux.cpp | 2 +-
src/hotspot/share/c1/c1_globals.hpp | 6 +-
src/hotspot/share/gc/parallel/psScavenge.cpp | 8 +-
.../recorder/checkpoint/types/jfrTypeSet.cpp | 2 +-
src/hotspot/share/opto/c2compiler.cpp | 1 +
src/hotspot/share/opto/compile.cpp | 2 +-
src/hotspot/share/opto/library_call.cpp | 11 +-
src/hotspot/share/opto/loopPredicate.cpp | 2 +-
src/hotspot/share/opto/loopopts.cpp | 6 +-
src/hotspot/share/opto/macroArrayCopy.cpp | 4 +-
src/hotspot/share/utilities/exceptions.cpp | 4 +-
.../classes/java/nio/charset/Charset.java | 8 +-
.../sun/security/jca/ProviderList.java | 8 +-
.../classes/sun/security/provider/SHA3.java | 14 +-
.../sun/security/provider/SHAKE128.java | 49 ++++
.../media/sound/StandardMidiFileReader.java | 10 +-
.../classes/java/awt/image/BufferedImage.java | 28 +--
.../java/awt/image/WritableRaster.java | 37 +--
.../swing/plaf/basic/BasicComboPopup.java | 4 +-
.../swing/plaf/basic/BasicDirectoryModel.java | 103 ++++-----
.../classes/javax/swing/text/html/CSS.java | 6 +-
.../sun/jndi/ldap/sasl/SaslInputStream.java | 4 +-
.../jdk/internal/net/http/common/Utils.java | 10 +-
.../share/native/libj2gss/GSSLibStub.c | 10 +-
.../com/sun/tools/javac/comp/Annotate.java | 7 +-
.../sun/tools/javac/comp/DeferredAttr.java | 5 +-
.../classes/sun/security/pkcs11/P11Key.java | 9 +-
.../sun/jvmstat/monitor/MonitoredHost.java | 16 +-
.../arraycopy/TestArrayCopyOfRangeGuards.java | 61 +++++
.../TestCountedLoopMinJintStride.java | 64 ++++++
.../TestSplitDivThroughPhiWithControl.java | 210 ++++++++++++++++++
.../containers/docker/TestContainerInfo.java | 97 ++++++++
.../java/awt/image/BufferedImage/SetData.java | 114 ++++++++++
.../net/httpclient/HttpClientBuilderTest.java | 19 +-
.../java/nio/charset/Charset/AliasesCopy.java | 69 ++++++
.../File/SMFInterruptedRunningStatus.java | 143 ++++++++++++
.../javax/swing/JComboBox/ComboPopupBug.java | 91 ++++++++
.../jfr/api/consumer/TestRecordedClass.java | 115 ++++++++++
.../ConcurrentGetMonitoredHost.java | 90 ++++++++
.../sun/security/jca/NullPreferredList.java | 41 ++++
.../sun/security/jca/app-security.properties | 1 +
test/langtools/tools/javac/T8320144.java | 19 ++
test/langtools/tools/javac/T8320144.out | 4 +
.../recovery/CrashDueToUnreportedError.java | 29 +++
.../recovery/CrashDueToUnreportedError.out | 2 +
48 files changed, 1403 insertions(+), 177 deletions(-)
create mode 100644 src/java.base/share/classes/sun/security/provider/SHAKE128.java
create mode 100644 test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyOfRangeGuards.java
create mode 100644 test/hotspot/jtreg/compiler/predicates/TestCountedLoopMinJintStride.java
create mode 100644 test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java
create mode 100644 test/hotspot/jtreg/containers/docker/TestContainerInfo.java
create mode 100644 test/jdk/java/awt/image/BufferedImage/SetData.java
create mode 100644 test/jdk/java/nio/charset/Charset/AliasesCopy.java
create mode 100644 test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
create mode 100644 test/jdk/javax/swing/JComboBox/ComboPopupBug.java
create mode 100644 test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java
create mode 100644 test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
create mode 100644 test/jdk/sun/security/jca/NullPreferredList.java
create mode 100644 test/jdk/sun/security/jca/app-security.properties
create mode 100644 test/langtools/tools/javac/T8320144.java
create mode 100644 test/langtools/tools/javac/T8320144.out
create mode 100644 test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java
create mode 100644 test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out
diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp
index d31f63883..ca033b71a 100644
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp
@@ -156,6 +156,26 @@ void Assembler::adrp(Register reg1, const Address &dest, uint64_t &byte_offset)
rf(Rd, 0);
}
+// This encoding is similar (but not quite identical) to the encoding used
+// by literal ld/st. see JDK-8324123.
+// PRFM does not support writeback or pre/post index.
+void Assembler::prfm(const Address &adr, prfop pfop) {
+ Address::mode mode = adr.getMode();
+ // PRFM does not support pre/post index
+ guarantee((mode != Address::pre) && (mode != Address::post), "prfm does not support pre/post indexing");
+ if (mode == Address::literal) {
+ starti;
+ f(0b11, 31, 30), f(0b011, 29, 27), f(0b000, 26, 24);
+ f(pfop, 4, 0);
+ int64_t offset = (adr.target() - pc()) >> 2;
+ sf(offset, 23, 5);
+ } else {
+ assert((mode == Address::base_plus_offset)
+ || (mode == Address::base_plus_offset_reg), "must be base_plus_offset/base_plus_offset_reg");
+ ld_st2(as_Register(pfop), adr, 0b11, 0b10);
+ }
+}
+
#undef starti
Address::Address(address target, relocInfo::relocType rtype) : _mode(literal){
diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp
index 1fea866cc..313c22318 100644
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp
@@ -763,6 +763,8 @@ public:
void adrp(Register Rd, const Address &dest, uint64_t &offset);
+ void prfm(const Address &adr, prfop pfop = PLDL1KEEP);
+
#undef INSN
void add_sub_immediate(Register Rd, Register Rn, unsigned uimm, int op,
@@ -1498,17 +1500,6 @@ public:
#undef INSN
-#define INSN(NAME, size, op) \
- void NAME(const Address &adr, prfop pfop = PLDL1KEEP) { \
- ld_st2((Register)pfop, adr, size, op); \
- }
-
- INSN(prfm, 0b11, 0b10); // FIXME: PRFM should not be used with
- // writeback modes, but the assembler
- // doesn't enfore that.
-
-#undef INSN
-
#define INSN(NAME, size, op) \
void NAME(FloatRegister Rt, const Address &adr) { \
ld_st2((Register)Rt, adr, size, op, 1); \
diff --git a/src/hotspot/os/linux/osContainer_linux.cpp b/src/hotspot/os/linux/osContainer_linux.cpp
index 52e6ab86c..88a9289b9 100644
--- a/src/hotspot/os/linux/osContainer_linux.cpp
+++ b/src/hotspot/os/linux/osContainer_linux.cpp
@@ -138,7 +138,7 @@ jlong OSContainer::pids_current() {
void OSContainer::print_container_helper(outputStream* st, jlong j, const char* metrics) {
st->print("%s: ", metrics);
- if (j > 0) {
+ if (j >= 0) {
if (j >= 1024) {
st->print_cr(UINT64_FORMAT " k", uint64_t(j) / 1024);
} else {
diff --git a/src/hotspot/share/c1/c1_globals.hpp b/src/hotspot/share/c1/c1_globals.hpp
index 7564b2b8a..41d4607f8 100644
--- a/src/hotspot/share/c1/c1_globals.hpp
+++ b/src/hotspot/share/c1/c1_globals.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -287,9 +287,11 @@
develop(bool, InstallMethods, true, \
"Install methods at the end of successful compilations") \
\
+ /* The compiler assumes, in many places, that methods are at most 1MB. */ \
+ /* Therefore, we restrict this flag to at most 1MB. */ \
develop(intx, NMethodSizeLimit, (64*K)*wordSize, \
"Maximum size of a compiled method.") \
- range(0, max_jint) \
+ range(0, 1*M) \
\
develop(bool, TraceFPUStack, false, \
"Trace emulation of the FPU stack (intel only)") \
diff --git a/src/hotspot/share/gc/parallel/psScavenge.cpp b/src/hotspot/share/gc/parallel/psScavenge.cpp
index 98ab42022..56ed8a5dd 100644
--- a/src/hotspot/share/gc/parallel/psScavenge.cpp
+++ b/src/hotspot/share/gc/parallel/psScavenge.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -750,12 +750,14 @@ bool PSScavenge::should_attempt_scavenge() {
size_t avg_promoted = (size_t) policy->padded_average_promoted_in_bytes();
size_t promotion_estimate = MIN2(avg_promoted, young_gen->used_in_bytes());
- bool result = promotion_estimate < old_gen->free_in_bytes();
+ // Total free size after possible old gen expansion
+ size_t free_in_old_gen = old_gen->max_gen_size() - old_gen->used_in_bytes();
+ bool result = promotion_estimate < free_in_old_gen;
log_trace(ergo)("%s scavenge: average_promoted " SIZE_FORMAT " padded_average_promoted " SIZE_FORMAT " free in old gen " SIZE_FORMAT,
result ? "Do" : "Skip", (size_t) policy->average_promoted_in_bytes(),
(size_t) policy->padded_average_promoted_in_bytes(),
- old_gen->free_in_bytes());
+ free_in_old_gen);
if (young_gen->used_in_bytes() < (size_t) policy->padded_average_promoted_in_bytes()) {
log_trace(ergo)(" padded_promoted_average is greater than maximum promotion = " SIZE_FORMAT, young_gen->used_in_bytes());
}
diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp
index 13de7651e..411733814 100644
--- a/src/hotspot/share/opto/c2compiler.cpp
+++ b/src/hotspot/share/opto/c2compiler.cpp
@@ -103,6 +103,7 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, boo
bool do_locks_coarsening = EliminateLocks;
while (!env->failing()) {
+ ResourceMark rm;
// Attempt to compile while subsuming loads into machine instructions.
Compile C(env, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing, do_locks_coarsening, install_code, directive);
diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp
index 10ab50369..5d1422519 100644
--- a/src/hotspot/share/opto/compile.cpp
+++ b/src/hotspot/share/opto/compile.cpp
@@ -4610,7 +4610,7 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) {
const Type* t_no_spec = t->remove_speculative();
if (t_no_spec != t) {
bool in_hash = igvn.hash_delete(n);
- assert(in_hash, "node should be in igvn hash table");
+ assert(in_hash || n->hash() == Node::NO_HASH, "node should be in igvn hash table");
tn->set_type(t_no_spec);
igvn.hash_insert(n);
igvn._worklist.push(n); // give it a chance to go away
diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp
index c52f24834..d732c706e 100644
--- a/src/hotspot/share/opto/library_call.cpp
+++ b/src/hotspot/share/opto/library_call.cpp
@@ -3599,12 +3599,16 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
length = _gvn.transform(new SubINode(end, start));
}
- // Bail out if length is negative.
+ // Bail out if length is negative (i.e., if start > end).
// Without this the new_array would throw
// NegativeArraySizeException but IllegalArgumentException is what
// should be thrown
generate_negative_guard(length, bailout, &length);
+ // Bail out if start is larger than the original length
+ Node* orig_tail = _gvn.transform(new SubINode(orig_length, start));
+ generate_negative_guard(orig_tail, bailout, &orig_tail);
+
if (bailout->req() > 1) {
PreserveJVMState pjvms(this);
set_control(_gvn.transform(bailout));
@@ -3614,8 +3618,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
if (!stopped()) {
// How many elements will we copy from the original?
- // The answer is MinI(orig_length - start, length).
- Node* orig_tail = _gvn.transform(new SubINode(orig_length, start));
+ // The answer is MinI(orig_tail, length).
Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
// Generate a direct call to the right arraycopy function(s).
@@ -3663,7 +3666,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
if (!stopped()) {
newcopy = new_array(klass_node, length, 0); // no arguments to push
- ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, true, false,
+ ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, true, true,
load_object_klass(original), klass_node);
if (!is_copyOfRange) {
ac->set_copyof(validated);
diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp
index 0a189bf49..9df2a8fb8 100644
--- a/src/hotspot/share/opto/loopPredicate.cpp
+++ b/src/hotspot/share/opto/loopPredicate.cpp
@@ -1042,7 +1042,7 @@ bool PhaseIdealLoop::loop_predication_should_follow_branches(IdealLoopTree *loop
CountedLoopNode* cl = head->as_CountedLoop();
if (cl->phi() != nullptr) {
const TypeInt* t = _igvn.type(cl->phi())->is_int();
- float worst_case_trip_cnt = ((float)t->_hi - t->_lo) / ABS(cl->stride_con());
+ float worst_case_trip_cnt = ((float)t->_hi - t->_lo) / ABS((float)cl->stride_con());
if (worst_case_trip_cnt < loop_trip_cnt) {
loop_trip_cnt = worst_case_trip_cnt;
}
diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp
index 880dbff83..0165c6410 100644
--- a/src/hotspot/share/opto/loopopts.cpp
+++ b/src/hotspot/share/opto/loopopts.cpp
@@ -236,7 +236,11 @@ bool PhaseIdealLoop::cannot_split_division(const Node* n, const Node* region) co
return false;
}
- assert(n->in(0) == nullptr, "divisions with zero check should already have bailed out earlier in split-if");
+ if (n->in(0) != nullptr) {
+ // Cannot split through phi if Div or Mod node has a control dependency to a zero check.
+ return true;
+ }
+
Node* divisor = n->in(2);
return is_divisor_counted_loop_phi(divisor, region) &&
loop_phi_backedge_type_contains_zero(divisor, zero);
diff --git a/src/hotspot/share/opto/macroArrayCopy.cpp b/src/hotspot/share/opto/macroArrayCopy.cpp
index 4785e45b7..5d88a84f9 100644
--- a/src/hotspot/share/opto/macroArrayCopy.cpp
+++ b/src/hotspot/share/opto/macroArrayCopy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1266,7 +1266,7 @@ void PhaseMacroExpand::expand_arraycopy_node(ArrayCopyNode *ac) {
generate_arraycopy(ac, alloc, &ctrl, merge_mem, &io,
adr_type, T_OBJECT,
src, src_offset, dest, dest_offset, length,
- true, !ac->is_copyofrange());
+ true, ac->has_negative_length_guard());
return;
}
diff --git a/src/hotspot/share/utilities/exceptions.cpp b/src/hotspot/share/utilities/exceptions.cpp
index cf9291f6d..499542235 100644
--- a/src/hotspot/share/utilities/exceptions.cpp
+++ b/src/hotspot/share/utilities/exceptions.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -440,6 +440,7 @@ void Exceptions::wrap_dynamic_exception(bool is_indy, JavaThread* THREAD) {
// Pass through an Error, including BootstrapMethodError, any other form
// of linkage error, or say ThreadDeath/OutOfMemoryError
if (ls != NULL) {
+ ResourceMark rm(THREAD);
ls->print_cr("bootstrap method invocation wraps BSME around " INTPTR_FORMAT, p2i((void *)exception));
exception->print_on(ls);
}
@@ -448,6 +449,7 @@ void Exceptions::wrap_dynamic_exception(bool is_indy, JavaThread* THREAD) {
// Otherwise wrap the exception in a BootstrapMethodError
if (ls != NULL) {
+ ResourceMark rm(THREAD);
ls->print_cr("%s throws BSME for " INTPTR_FORMAT, is_indy ? "invokedynamic" : "dynamic constant", p2i((void *)exception));
exception->print_on(ls);
}
diff --git a/src/java.base/share/classes/java/nio/charset/Charset.java b/src/java.base/share/classes/java/nio/charset/Charset.java
index 0ac18a23b..2b1942122 100644
--- a/src/java.base/share/classes/java/nio/charset/Charset.java
+++ b/src/java.base/share/classes/java/nio/charset/Charset.java
@@ -41,7 +41,6 @@ import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.Set;
@@ -636,7 +635,12 @@ public abstract class Charset
* If the canonical name or any of the aliases are illegal
*/
protected Charset(String canonicalName, String[] aliases) {
- String[] as = Objects.requireNonNullElse(aliases, zeroAliases);
+ String[] as =
+ aliases == null ?
+ zeroAliases :
+ VM.isSystemDomainLoader(getClass().getClassLoader()) ?
+ aliases :
+ Arrays.copyOf(aliases, aliases.length);
// Skip checks for the standard, built-in Charsets we always load
// during initialization.
diff --git a/src/java.base/share/classes/sun/security/jca/ProviderList.java b/src/java.base/share/classes/sun/security/jca/ProviderList.java
index 9b41172c0..4b30c76cf 100644
--- a/src/java.base/share/classes/sun/security/jca/ProviderList.java
+++ b/src/java.base/share/classes/sun/security/jca/ProviderList.java
@@ -366,17 +366,19 @@ public final class ProviderList {
int i;
// Preferred provider list
- if (preferredPropList != null &&
- (pList = preferredPropList.getAll(type, name)) != null) {
+ if (preferredPropList != null) {
+ pList = preferredPropList.getAll(type, name);
for (i = 0; i < pList.size(); i++) {
Provider p = getProvider(pList.get(i).provider);
+ if (p == null) {
+ continue;
+ }
Service s = p.getService(type, name);
if (s != null) {
return s;
}
}
}
-
for (i = 0; i < configs.length; i++) {
Provider p = getProvider(i);
Service s = p.getService(type, name);
diff --git a/src/java.base/share/classes/sun/security/provider/SHA3.java b/src/java.base/share/classes/sun/security/provider/SHA3.java
index fb21e3ceb..931056f81 100644
--- a/src/java.base/share/classes/sun/security/provider/SHA3.java
+++ b/src/java.base/share/classes/sun/security/provider/SHA3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -106,7 +106,15 @@ abstract class SHA3 extends DigestBase {
throw new ProviderException("Incorrect pad size: " + numOfPadding);
}
implCompress(buffer, 0);
- System.arraycopy(state, 0, out, ofs, engineGetDigestLength());
+ int availableBytes = buffer.length;
+ int numBytes = engineGetDigestLength();
+ while (numBytes > availableBytes) {
+ System.arraycopy(state, 0, out, ofs, availableBytes);
+ numBytes -= availableBytes;
+ ofs += availableBytes;
+ keccak();
+ }
+ System.arraycopy(state, 0, out, ofs, numBytes);
}
/**
@@ -253,7 +261,7 @@ abstract class SHA3 extends DigestBase {
/**
* The function Keccak as defined in section 5.2 with
- * rate r = 1600 and capacity c = (digest length x 2).
+ * rate r = 1600 and capacity c.
*/
private void keccak() {
// convert the 200-byte state into 25 lanes
diff --git a/src/java.base/share/classes/sun/security/provider/SHAKE128.java b/src/java.base/share/classes/sun/security/provider/SHAKE128.java
new file mode 100644
index 000000000..0d62497b3
--- /dev/null
+++ b/src/java.base/share/classes/sun/security/provider/SHAKE128.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.security.provider;
+
+/*
+ * The SHAKE128 extendable output function.
+ */
+public final class SHAKE128 extends SHA3 {
+ public SHAKE128(int d) {
+ super("SHAKE128", d, (byte) 0x1F, 32);
+ }
+
+ public void update(byte in) {
+ engineUpdate(in);
+ }
+ public void update(byte[] in, int off, int len) {
+ engineUpdate(in, off, len);
+ }
+
+ public byte[] digest() {
+ return engineDigest();
+ }
+
+ public void reset() {
+ engineReset();
+ }
+}
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java b/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java
index 85f31acb0..a60c47469 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java
@@ -326,10 +326,10 @@ final class SMFParser {
// reset current tick to 0
long tick = 0;
- // reset current status byte to 0 (invalid value).
+ // reset current running status byte to 0 (invalid value).
// this should cause us to throw an InvalidMidiDataException if we don't
// get a valid status byte from the beginning of the track.
- int status = 0;
+ int runningStatus = 0;
boolean endOfTrackFound = false;
while (!trackFinished() && !endOfTrackFound) {
@@ -346,9 +346,15 @@ final class SMFParser {
// check for new status
int byteValue = readUnsigned();
+ int status;
if (byteValue >= 0x80) {
status = byteValue;
+ // update running status (only for channel messages)
+ if ((status & 0xF0) != 0xF0) {
+ runningStatus = status;
+ }
} else {
+ status = runningStatus;
data1 = byteValue;
}
diff --git a/src/java.desktop/share/classes/java/awt/image/BufferedImage.java b/src/java.desktop/share/classes/java/awt/image/BufferedImage.java
index 3c937dd38..b7db576a3 100644
--- a/src/java.desktop/share/classes/java/awt/image/BufferedImage.java
+++ b/src/java.desktop/share/classes/java/awt/image/BufferedImage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1509,31 +1509,7 @@ public class BufferedImage extends java.awt.Image
* @see #getData(Rectangle)
*/
public void setData(Raster r) {
- int width = r.getWidth();
- int height = r.getHeight();
- int startX = r.getMinX();
- int startY = r.getMinY();
-
- int[] tdata = null;
-
- // Clip to the current Raster
- Rectangle rclip = new Rectangle(startX, startY, width, height);
- Rectangle bclip = new Rectangle(0, 0, raster.width, raster.height);
- Rectangle intersect = rclip.intersection(bclip);
- if (intersect.isEmpty()) {
- return;
- }
- width = intersect.width;
- height = intersect.height;
- startX = intersect.x;
- startY = intersect.y;
-
- // remind use get/setDataElements for speed if Rasters are
- // compatible
- for (int i = startY; i < startY+height; i++) {
- tdata = r.getPixels(startX,i,width,1,tdata);
- raster.setPixels(startX,i,width,1, tdata);
- }
+ raster.setRect(r);
}
diff --git a/src/java.desktop/share/classes/java/awt/image/WritableRaster.java b/src/java.desktop/share/classes/java/awt/image/WritableRaster.java
index 0e345026c..bcca029c1 100644
--- a/src/java.desktop/share/classes/java/awt/image/WritableRaster.java
+++ b/src/java.desktop/share/classes/java/awt/image/WritableRaster.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -422,36 +422,19 @@ public class WritableRaster extends Raster {
* @throws NullPointerException if srcRaster is null.
*/
public void setRect(int dx, int dy, Raster srcRaster) {
- int width = srcRaster.getWidth();
- int height = srcRaster.getHeight();
int srcOffX = srcRaster.getMinX();
int srcOffY = srcRaster.getMinY();
- int dstOffX = dx+srcOffX;
- int dstOffY = dy+srcOffY;
-
- // Clip to this raster
- if (dstOffX < this.minX) {
- int skipX = this.minX - dstOffX;
- width -= skipX;
- srcOffX += skipX;
- dstOffX = this.minX;
- }
- if (dstOffY < this.minY) {
- int skipY = this.minY - dstOffY;
- height -= skipY;
- srcOffY += skipY;
- dstOffY = this.minY;
- }
- if (dstOffX+width > this.minX+this.width) {
- width = this.minX + this.width - dstOffX;
- }
- if (dstOffY+height > this.minY+this.height) {
- height = this.minY + this.height - dstOffY;
- }
-
- if (width <= 0 || height <= 0) {
+ Rectangle bsrc = new Rectangle(dx+srcOffX, dy+srcOffY, srcRaster.getWidth(), srcRaster.getHeight());
+ Rectangle clip = bsrc.intersection(new Rectangle(minX, minY, width, height));
+ if (clip.isEmpty()) {
return;
}
+ srcOffX += clip.x - bsrc.x;
+ srcOffY += clip.y - bsrc.y;
+ final int dstOffX = clip.x;
+ final int dstOffY = clip.y;
+ final int width = clip.width;
+ final int height = clip.height;
switch (srcRaster.getSampleModel().getDataType()) {
case DataBuffer.TYPE_BYTE:
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
index 050f27e72..197f3238b 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -921,7 +921,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
if (e.getSource() == list) {
return;
}
- if (!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled())
+ if (!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled() || !comboBox.isShowing())
return;
if ( comboBox.isEditable() ) {
diff --git a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
index c14b5a126..311f172b8 100644
--- a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
+++ b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
@@ -2830,8 +2830,8 @@ public class CSS implements Serializable {
*/
@SuppressWarnings("serial") // Same-version serialization only
static class BackgroundImage extends CssValue {
- private boolean loadedImage;
- private ImageIcon image;
+ private volatile boolean loadedImage;
+ private ImageIcon image;
Object parseCssValue(String value) {
BackgroundImage retValue = new BackgroundImage();
@@ -2849,7 +2849,6 @@ public class CSS implements Serializable {
synchronized(this) {
if (!loadedImage) {
URL url = CSS.getURL(base, svalue);
- loadedImage = true;
if (url != null) {
image = new ImageIcon();
Image tmpImg = Toolkit.getDefaultToolkit().createImage(url);
@@ -2857,6 +2856,7 @@ public class CSS implements Serializable {
image.setImage(tmpImg);
}
}
+ loadedImage = true;
}
}
}
diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
index f0746c103..534f7dac7 100644
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@ public class SaslInputStream extends InputStream {
byte[] inBuf = new byte[1];
int count = read(inBuf, 0, 1);
if (count > 0) {
- return inBuf[0];
+ return inBuf[0] & 0xff;
} else {
return -1;
}
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
index a3f6a11aa..0955bdffe 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -535,7 +535,12 @@ public final class Utils {
p1.setMaximumPacketSize(p.getMaximumPacketSize());
// JDK 8 EXCL END
p1.setEndpointIdentificationAlgorithm(p.getEndpointIdentificationAlgorithm());
- p1.setNeedClientAuth(p.getNeedClientAuth());
+ if (p.getNeedClientAuth()) {
+ p1.setNeedClientAuth(true);
+ }
+ if (p.getWantClientAuth()) {
+ p1.setWantClientAuth(true);
+ }
String[] protocols = p.getProtocols();
if (protocols != null) {
p1.setProtocols(protocols.clone());
@@ -543,7 +548,6 @@ public final class Utils {
p1.setSNIMatchers(p.getSNIMatchers());
p1.setServerNames(p.getServerNames());
p1.setUseCipherSuitesOrder(p.getUseCipherSuitesOrder());
- p1.setWantClientAuth(p.getWantClientAuth());
return p1;
}
diff --git a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c
index d6e1712a2..cc9e8c3cb 100644
--- a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c
+++ b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -197,7 +197,10 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) {
return GSS_C_NO_CHANNEL_BINDINGS;
}
- cb = malloc(sizeof(struct gss_channel_bindings_struct));
+ // initialize cb as zeroes to avoid uninitialized pointer being
+ // freed when deleteGSSCB is called at cleanup.
+ cb = calloc(1, sizeof(struct gss_channel_bindings_struct));
+
if (cb == NULL) {
throwOutOfMemoryError(env,NULL);
return NULL;
@@ -217,9 +220,6 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) {
cb->initiator_addrtype = GSS_C_AF_NULLADDR;
cb->acceptor_addrtype = GSS_C_AF_NULLADDR;
}
- // addresses needs to be initialized to empty
- memset(&cb->initiator_address, 0, sizeof(cb->initiator_address));
- memset(&cb->acceptor_address, 0, sizeof(cb->acceptor_address));
/* set up initiator address */
jinetAddr = (*env)->CallObjectMethod(env, jcb,
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
index 2561ae38f..bafbdb5a6 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
@@ -554,7 +554,6 @@ public class Annotate {
if (expectedElementType.hasTag(ARRAY)) {
return getAnnotationArrayValue(expectedElementType, tree, env);
-
}
//error recovery
@@ -706,11 +705,15 @@ public class Annotate {
}
JCNewArray na = (JCNewArray)tree;
+ List<JCExpression> elems = na.elems;
if (na.elemtype != null) {
log.error(na.elemtype.pos(), Errors.NewNotAllowedInAnnotation);
+ if (elems == null) {
+ elems = List.nil();
+ }
}
ListBuffer<Attribute> buf = new ListBuffer<>();
- for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
+ for (List<JCExpression> l = elems; l.nonEmpty(); l = l.tail) {
buf.append(attributeAnnotationValue(types.elemtype(expectedElementType),
l.head,
env));
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
index d5400cdd8..7fd883ace 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
@@ -1074,7 +1074,10 @@ public class DeferredAttr extends JCTree.Visitor {
boolean isLambdaOrMemberRef =
dt.tree.hasTag(REFERENCE) || dt.tree.hasTag(LAMBDA);
boolean needsRecoveryType =
- pt == null || (isLambdaOrMemberRef && !types.isFunctionalInterface(pt));
+ pt == null ||
+ ((dt instanceof ArgumentAttr.ArgumentType<?> at) &&
+ at.speculativeTypes.values().stream().allMatch(type -> type.hasTag(ERROR))) ||
+ (isLambdaOrMemberRef && !types.isFunctionalInterface(pt));
Type ptRecovery = needsRecoveryType ? Type.recoveryType: pt;
dt.check(attr.new RecoveryInfo(deferredAttrContext, ptRecovery) {
@Override
diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java
index d12244337..f3c7fdf99 100644
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1483,7 +1483,12 @@ final class NativeKeyHolder {
// destroy
this.keyID = 0;
- this.ref.removeNativeKey();
+ try {
+ this.ref.removeNativeKey();
+ } finally {
+ // prevent enqueuing SessionKeyRef until removeNativeKey is done
+ Reference.reachabilityFence(this);
+ }
} else {
if (cnt < 0) {
// should never happen as we start count at 1 and pair get/release calls
diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java
index b119a0045..fafcce1c4 100644
--- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java
+++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ import sun.jvmstat.monitor.event.HostListener;
* @see HostListener
*/
public abstract class MonitoredHost {
- private static Map<HostIdentifier, MonitoredHost> monitoredHosts =
+ private static final Map<HostIdentifier, MonitoredHost> monitoredHosts =
new HashMap<HostIdentifier, MonitoredHost>();
/*
@@ -133,13 +133,6 @@ public abstract class MonitoredHost {
return getMonitoredHost(hostId);
}
-
- /*
- * Load the MonitoredHostServices
- */
- private static ServiceLoader<MonitoredHostService> monitoredHostServiceLoader =
- ServiceLoader.load(MonitoredHostService.class, MonitoredHostService.class.getClassLoader());
-
/**
* Factory method to construct a MonitoredHost instance to manage the
* connection to the host indicated by {@code hostId}.
@@ -167,9 +160,12 @@ public abstract class MonitoredHost {
hostId = resolveHostId(hostId);
- for (MonitoredHostService mhs : monitoredHostServiceLoader) {
+ ServiceLoader<MonitoredHostService> services = ServiceLoader.load(
+ MonitoredHostService.class, MonitoredHostService.class.getClassLoader());
+ for (MonitoredHostService mhs : services) {
if (mhs.getScheme().equals(hostId.getScheme())) {
mh = mhs.getMonitoredHost(hostId);
+ break;
}
}
diff --git a/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyOfRangeGuards.java b/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyOfRangeGuards.java
new file mode 100644
index 000000000..e5886d700
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyOfRangeGuards.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8323682
+ * @summary Test that the appropriate guards are generated for the copyOfRange
+ * intrinsic, even if the result of the array copy is not used.
+ *
+ * @run main/othervm -XX:-TieredCompilation
+ * -XX:CompileCommand=compileonly,compiler.arraycopy.TestArrayCopyOfRangeGuards::test
+ * -Xbatch
+ * compiler.arraycopy.TestArrayCopyOfRangeGuards
+ */
+
+package compiler.arraycopy;
+
+import java.util.Arrays;
+
+public class TestArrayCopyOfRangeGuards {
+ static int counter = 0;
+
+ public static void main(String[] args) {
+ Object[] array = new Object[10];
+ for (int i = 0; i < 50_000; i++) {
+ test(array);
+ }
+ if (counter != 50_000) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ static void test(Object[] array) {
+ try {
+ Arrays.copyOfRange(array, 15, 20, Object[].class);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected
+ counter++;
+ }
+ }
+}
diff --git a/test/hotspot/jtreg/compiler/predicates/TestCountedLoopMinJintStride.java b/test/hotspot/jtreg/compiler/predicates/TestCountedLoopMinJintStride.java
new file mode 100644
index 000000000..62bfc60cc
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/predicates/TestCountedLoopMinJintStride.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2024, Red Hat, Inc. 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.
+ */
+
+/*
+ * @test
+ * @bug 8328822
+ * @summary C2: "negative trip count?" assert failure in profile predicate code
+ * @run main/othervm -XX:-BackgroundCompilation TestCountedLoopMinJintStride
+ */
+
+import java.util.Objects;
+
+public class TestCountedLoopMinJintStride {
+ public static void main(String[] args) {
+ for (int i = 0; i < 20_000; i++) {
+ test1(Integer.MAX_VALUE-1, Integer.MAX_VALUE, 0);
+ testHelper1(100, -1, Integer.MAX_VALUE, 0);
+ test2(Integer.MAX_VALUE-1, Integer.MAX_VALUE, 0);
+ testHelper2(100, -1, Integer.MAX_VALUE, 0);
+ }
+ }
+
+ private static void test1(int stop, int range, int start) {
+ testHelper1(stop, Integer.MIN_VALUE, range, start);
+ }
+
+ private static void testHelper1(int stop, int stride, int range, int start) {
+ for (int i = stop; i >= start; i += stride) {
+ Objects.checkIndex(i, range);
+ }
+ }
+
+ private static void test2(int stop, int range, int start) {
+ testHelper1(stop, Integer.MIN_VALUE, range, start);
+ }
+
+ private static void testHelper2(int stop, int stride, int range, int start) {
+ for (int i = stop; i >= start; i += stride) {
+ if (i < 0 || i >= range) {
+ throw new RuntimeException("out of bounds");
+ }
+ }
+ }
+}
diff --git a/test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java b/test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java
new file mode 100644
index 000000000..28e4db334
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/*
+ * @test id=normal
+ * @bug 8323101
+ * @summary Test split_thru_phi with pinned divisions/modulo that have phi as inputs.
+ * @run main/othervm -Xbatch
+ * -XX:CompileCommand=compileonly,compiler.splitif.TestSplitDivThroughPhiWithControl::*
+ * compiler.splitif.TestSplitDivThroughPhiWithControl
+ */
+
+/*
+ * @test id=fuzzer
+ * @bug 8323101
+ * @summary Test split_thru_phi with pinned divisions/modulo that have phi as inputs.
+ * @run main/othervm -Xbatch -XX:PerMethodTrapLimit=0
+ * -XX:CompileCommand=compileonly,compiler.splitif.TestSplitDivThroughPhiWithControl::*
+ * compiler.splitif.TestSplitDivThroughPhiWithControl
+ */
+
+package compiler.splitif;
+
+public class TestSplitDivThroughPhiWithControl {
+ static int divisorInt = 34;
+ static int iFld;
+ static int x;
+ static int y;
+ static long divisorLong = 34L;
+ static long lFld;
+ static long lFld2;
+ static long lFld3;
+ static boolean flag;
+
+ static int[] iArr = new int[400];
+
+ public static void main(String[] strArr) {
+ iArr[0] = 52329;
+ for (int i = 0; i < 10000; i++) {
+ flag = i % 3 == 0; // Avoid unstable if trap
+ divisorInt = i % 2 == 0 ? 0 : 23; // Avoid div by zero trap
+ divisorLong = divisorInt; // Avoid div by zero trap
+ try {
+ testIntDiv();
+ } catch (ArithmeticException e) {
+ // Expected.
+ }
+
+ try {
+ testIntMod();
+ } catch (ArithmeticException e) {
+ // Expected.
+ }
+
+ try {
+ testLongDiv(); // Currently does not trigger due to JDK-8323652
+ } catch (ArithmeticException e) {
+ // Expected.
+ }
+
+ try {
+ testLongMod(); // Currently does not trigger due to JDK-8323652
+ } catch (ArithmeticException e) {
+ // Expected.
+ }
+
+ testFuzzer();
+ }
+ }
+
+ static void testIntDiv() {
+ int a;
+
+ for (int j = 0; j < 100; j++) {
+ y += 5;
+ int sub = j - 3; // AddI
+ int div = (sub / divisorInt); // DivI with AddI input
+
+ if (flag) {
+ a = y;
+ } else {
+ a = 2;
+ }
+ // Region
+
+ // Use StoreI with AddI input. Store needs to be split through Region in Split-If which is done together
+ // with AddI.
+ iFld = sub;
+
+ if (a < 3) { // If that's split in Split-If
+ // Use of DivI -> after Split-If, DivI gets a Phi input that merges the split AddI nodes.
+ // -> triggers assert that we should not find pinned div nodes in cannot_split_division().
+ x = div;
+ }
+ }
+ }
+
+ // Same as testIntDiv() but with ModI
+ static void testIntMod() {
+ int a;
+
+ for (int j = 0; j < 100; j++) {
+ y += 5;
+ int sub = j - 3;
+ int mod = (sub % divisorInt);
+
+ if (flag) {
+ a = y;
+ } else {
+ a = 2;
+ }
+
+ iFld = sub;
+
+ if (a < 3) {
+ x = mod; // Only StoreI visited first but not mod since it's an input
+ }
+ }
+ }
+
+ // Same as testIntDiv() but with DivL
+ static void testLongDiv() {
+ long a;
+
+ for (int j = 0; j < 100; j++) {
+ y += 5;
+ long sub = j - 3;
+ long div = (sub / divisorLong);
+
+ if (flag) {
+ a = lFld2;
+ } else {
+ a = 2;
+ }
+
+ lFld = sub;
+
+ if (a < 3) {
+ lFld3 = div;
+ }
+ }
+ }
+
+
+ // Same as testIntDiv() but with ModL
+ static void testLongMod() {
+ long a;
+
+ for (long j = 0; j < 100; j++) {
+ lFld2 += 5;
+ long sub = j - 3;
+ long mod = (sub % divisorLong);
+
+ if (flag) {
+ a = lFld2;
+ } else {
+ a = 2;
+ }
+
+ lFld = sub;
+
+ if (a < 3) {
+ lFld3 = mod; // Only StoreI visited first but not mod since it's an input
+ }
+ }
+ }
+
+ // Original fuzzer crash
+ static void testFuzzer() {
+ int i19, i21 = 4928, i23 = 14;
+ for (int i = 5; i < 100; i++) {
+ i19 = i23;
+ int j = 1;
+ while (true) {
+ try {
+ i21 = (iArr[0] / 34);
+ i23 = (j % i21);
+ } catch (ArithmeticException a_e) {
+ }
+ iArr = iArr;
+ iFld = i21;
+ iArr[1] += 5;
+ if (j == 1000) {
+ break;
+ }
+ j++;
+ }
+ }
+ }
+}
diff --git a/test/hotspot/jtreg/containers/docker/TestContainerInfo.java b/test/hotspot/jtreg/containers/docker/TestContainerInfo.java
new file mode 100644
index 000000000..dadc262cd
--- /dev/null
+++ b/test/hotspot/jtreg/containers/docker/TestContainerInfo.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2024, Red Hat, Inc.
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @summary Test container info for cgroup v2
+ * @requires docker.support
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ * jdk.jartool/sun.tools.jar
+ * @build CheckContainerized jdk.test.whitebox.WhiteBox PrintContainerInfo
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar jdk.test.whitebox.WhiteBox
+ * @run driver TestContainerInfo
+ */
+import jtreg.SkippedException;
+import jdk.test.lib.containers.docker.Common;
+import jdk.test.lib.containers.docker.DockerTestUtils;
+import jdk.test.lib.containers.docker.DockerRunOptions;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+
+public class TestContainerInfo {
+ private static final String imageName = Common.imageName("container-info");
+
+ public static void main(String[] args) throws Exception {
+ if (!DockerTestUtils.canTestDocker()) {
+ return;
+ }
+
+ Common.prepareWhiteBox();
+ DockerTestUtils.buildJdkContainerImage(imageName);
+
+ try {
+ testPrintContainerInfoWithoutSwap();
+ } finally {
+ DockerTestUtils.removeDockerImage(imageName);
+ }
+ }
+
+ private static void testPrintContainerInfoWithoutSwap() throws Exception {
+ Common.logNewTestCase("Test print_container_info() - without swap");
+
+ DockerRunOptions opts = Common.newOpts(imageName, "PrintContainerInfo")
+ .addDockerOpts("--memory=500m")
+ .addDockerOpts("--memory-swap=500m"); // no swap
+ Common.addWhiteBoxOpts(opts);
+
+ OutputAnalyzer out = Common.run(opts);
+ checkContainerInfo(out);
+ }
+
+ private static void shouldMatchWithValue(OutputAnalyzer output, String match, String value) {
+ output.shouldContain(match);
+ String str = output.getOutput();
+ for (String s : str.split(System.lineSeparator())) {
+ if (s.contains(match)) {
+ if (!s.contains(value)) {
+ throw new RuntimeException("memory_swap_current_in_bytes NOT " + value + "! Line was : " + s);
+ }
+ }
+ }
+ }
+
+ private static void checkContainerInfo(OutputAnalyzer out) throws Exception {
+ String str = out.getOutput();
+ if (str.contains("cgroupv2")) {
+ shouldMatchWithValue(out, "memory_swap_max_limit_in_bytes", "0");
+ shouldMatchWithValue(out, "memory_swap_current_in_bytes", "0");
+ } else {
+ throw new SkippedException("This test is cgroups v2 specific, skipped on cgroups v1");
+ }
+ }
+}
diff --git a/test/jdk/java/awt/image/BufferedImage/SetData.java b/test/jdk/java/awt/image/BufferedImage/SetData.java
new file mode 100644
index 000000000..5085df5ea
--- /dev/null
+++ b/test/jdk/java/awt/image/BufferedImage/SetData.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+import java.awt.Point;
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.awt.image.BandedSampleModel;
+import java.awt.image.BufferedImage;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.DataBufferFloat;
+import java.awt.image.DataBufferInt;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.util.Arrays;
+
+/**
+ * @test
+ * @author Martin Desruisseaux
+ */
+public final class SetData {
+ private static final int WIDTH = 3, HEIGHT = 2;
+
+ private static final int TRANSLATE_X = -2, TRANSLATE_Y = -3;
+
+ public static void main(final String[] args) {
+ testWithIntegers();
+ testWithFloats();
+ testTranslatedSource();
+ }
+
+ private static void testWithIntegers() {
+ var data = new int[] {4, 8, 2, 7, 9, 1};
+ var empty = new DataBufferInt(WIDTH*HEIGHT);
+ var buffer = new DataBufferInt(data, WIDTH*HEIGHT);
+ buffer = (DataBufferInt) writeAndRead(buffer, empty);
+ if (!Arrays.equals(data, buffer.getData())) {
+ throw new AssertionError("Pixel values are not equal.");
+ }
+ }
+
+ private static void testWithFloats() {
+ var data = new float[] {0.4f, 0.8f, 0.2f, 0.7f, 0.9f, 0.1f};
+ var empty = new DataBufferFloat(WIDTH*HEIGHT);
+ var buffer = new DataBufferFloat(data, WIDTH*HEIGHT);
+ buffer = (DataBufferFloat) writeAndRead(buffer, empty);
+ if (!Arrays.equals(data, buffer.getData())) {
+ throw new AssertionError("Pixel values are not equal.");
+ }
+ }
+
+ private static DataBuffer writeAndRead(DataBuffer buffer, DataBuffer empty) {
+ /*
+ * Prepare an image with all pixels initialized to zero.
+ */
+ var dt = buffer.getDataType();
+ var cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
+ var cm = new ComponentColorModel(cs, false, false, Transparency.OPAQUE, dt);
+ var sm = new BandedSampleModel(dt, WIDTH, HEIGHT, 1);
+ var wr = Raster.createWritableRaster(sm, empty, null);
+ var im = new BufferedImage(cm, wr, false, null);
+ /*
+ * Write data provided by the data buffer.
+ */
+ wr = Raster.createWritableRaster(sm, buffer, null);
+ im.setData(wr);
+ return im.getRaster().getDataBuffer();
+ }
+
+ private static void testTranslatedSource() {
+ var source = WritableRaster.createBandedRaster(
+ DataBuffer.TYPE_BYTE,
+ WIDTH - TRANSLATE_X + 2,
+ HEIGHT - TRANSLATE_Y + 1, 1,
+ new Point(TRANSLATE_X, TRANSLATE_Y));
+
+ for (int y=0; y<HEIGHT; y++) {
+ for (int x=0; x<WIDTH; x++) {
+ source.setSample(x, y, 0, (y+1)*10 + (x+1));
+ }
+ }
+ var expected = new byte[] {
+ 11, 12, 13,
+ 21, 22, 23
+ };
+ var im = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_BYTE_GRAY);
+ im.setData(source);
+ var actual = ((DataBufferByte) im.getRaster().getDataBuffer()).getData();
+ if (!Arrays.equals(expected, actual)) {
+ throw new AssertionError("Pixel values are not equal.");
+ }
+ }
+}
diff --git a/test/jdk/java/net/httpclient/HttpClientBuilderTest.java b/test/jdk/java/net/httpclient/HttpClientBuilderTest.java
index 121793014..ef43ec8b9 100644
--- a/test/jdk/java/net/httpclient/HttpClientBuilderTest.java
+++ b/test/jdk/java/net/httpclient/HttpClientBuilderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,7 @@ import static org.testng.Assert.*;
/*
* @test
+ * @bug 8326233
* @summary HttpClient[.Builder] API and behaviour checks
* @library /test/lib
* @build jdk.test.lib.net.SimpleSSLContext
@@ -205,6 +206,22 @@ public class HttpClientBuilderTest {
builder.sslParameters(c);
c.setProtocols(new String[] { "D" });
assertTrue(builder.build().sslParameters().getProtocols()[0].equals("C"));
+ // test defaults for needClientAuth and wantClientAuth
+ builder.sslParameters(new SSLParameters());
+ assertFalse(builder.build().sslParameters().getNeedClientAuth(),"needClientAuth() was expected to be false");
+ assertFalse(builder.build().sslParameters().getWantClientAuth(),"wantClientAuth() was expected to be false");
+ // needClientAuth = true and thus wantClientAuth = false
+ SSLParameters needClientAuthParams = new SSLParameters();
+ needClientAuthParams.setNeedClientAuth(true);
+ builder.sslParameters(needClientAuthParams);
+ assertTrue(builder.build().sslParameters().getNeedClientAuth(),"needClientAuth() was expected to be true");
+ assertFalse(builder.build().sslParameters().getWantClientAuth(),"wantClientAuth() was expected to be false");
+ // wantClientAuth = true and thus needClientAuth = false
+ SSLParameters wantClientAuthParams = new SSLParameters();
+ wantClientAuthParams.setWantClientAuth(true);
+ builder.sslParameters(wantClientAuthParams);
+ assertTrue(builder.build().sslParameters().getWantClientAuth(),"wantClientAuth() was expected to be true");
+ assertFalse(builder.build().sslParameters().getNeedClientAuth(),"needClientAuth() was expected to be false");
}
@Test
diff --git a/test/jdk/java/nio/charset/Charset/AliasesCopy.java b/test/jdk/java/nio/charset/Charset/AliasesCopy.java
new file mode 100644
index 000000000..66ee830c5
--- /dev/null
+++ b/test/jdk/java/nio/charset/Charset/AliasesCopy.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+/* @test
+ * @bug 8319817
+ * @summary Check that aliases cannot be mutated
+ * @run junit AliasesCopy
+ */
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertIterableEquals;
+
+public class AliasesCopy {
+ private static final Set<String> ALIASES_SET = Set.of("foo-alias");
+ private static final String[] ALIASES_ARRAY = ALIASES_SET.toArray(String[]::new);
+
+ @Test
+ public void aliasesCopy() {
+ final FooCharset cs = new FooCharset(ALIASES_ARRAY);
+ ALIASES_ARRAY[0] = "bar-alias";
+ assertIterableEquals(ALIASES_SET, cs.aliases());
+ }
+
+ private static final class FooCharset extends Charset {
+ private FooCharset(String[] aliases) {
+ super("foo", aliases);
+ }
+
+ @Override
+ public CharsetEncoder newEncoder() {
+ throw new RuntimeException("not implemented");
+ }
+
+ @Override
+ public CharsetDecoder newDecoder() {
+ throw new RuntimeException("not implemented");
+ }
+
+ @Override
+ public boolean contains(Charset cs) {
+ throw new RuntimeException("not implemented");
+ }
+ }
+}
diff --git a/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java b/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
new file mode 100644
index 000000000..1b82e2f73
--- /dev/null
+++ b/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+import java.io.ByteArrayInputStream;
+
+import javax.sound.midi.MidiSystem;
+import javax.sound.midi.Sequence;
+import javax.sound.midi.Track;
+
+/**
+ * @test
+ * @bug 8319598
+ * @summary SMFParser bug with running status, interrupted by Meta or SysEx messages
+ */
+public class SMFInterruptedRunningStatus {
+
+ public static void main(String[] args) throws Exception {
+
+ byte[][] files = new byte[][] {SMF_1, SMF_2, SMF_3};
+ for (int i = 0; i < files.length; i++) {
+ Sequence seq = MidiSystem.getSequence(
+ new ByteArrayInputStream(files[i]));
+ testSequence(seq, i + 1);
+ }
+
+ // no exception thrown, all files have been parsed correctly
+ System.out.println("Test passed");
+ }
+
+ private static void testSequence(Sequence seq, int fileNumber) {
+
+ // check number of tracks and number of events
+ Track[] tracks = seq.getTracks();
+ if (1 != tracks.length) {
+ throw new RuntimeException("file number "
+ + fileNumber + " fails (incorrect number of tracks: "
+ + tracks.length + ")");
+ }
+ Track track = tracks[0];
+ if (7 != track.size()) {
+ throw new RuntimeException("file number " + fileNumber
+ + " fails (incorrect number of events: "
+ + track.size() + ")");
+ }
+
+ // check status byte of each message
+ int[] expectedStatusBytes = new int[] {
+ 0x90, 0xFF, 0x90, 0x90, 0x90, 0xFF, 0xFF};
+ for (int i = 0; i < expectedStatusBytes.length; i++) {
+ int expected = expectedStatusBytes[i];
+ if (expected != track.get(i).getMessage().getStatus()) {
+ throw new RuntimeException("file number " + fileNumber
+ + " fails (wrong status byte in event " + i + ")");
+ }
+ }
+ }
+
+ // MIDI file without running status - should work equally before
+ // and after the bugfix
+ private static final byte[] SMF_1 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x24, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x20, // delta time
+ (byte) 0x90, 0x3C, 0x00, // Note-OFF (C)
+ 0x20, // delta time
+ (byte) 0x90, 0x3E, 0x7F, // Note-ON (D)
+ 0x60, // delta time
+ (byte) 0x90, 0x3E, 0x00, // Note-OFF (D)
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+
+ // MIDI file with running status, interrupted by a META message
+ // - failed before the bugfix
+ private static final byte[] SMF_2 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x21, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (interruptor)
+ 0x20, // delta time
+ 0x3C, 0x00, // Note-OFF (C) - running status
+ 0x20, // delta time
+ 0x3E, 0x7F, // Note-ON (D) - running status
+ 0x60, // delta time
+ 0x3E, 0x00, // Note-OFF (D) - running status
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+
+ // MIDI file with running status, interrupted by a META message
+ // - succeeded before the bugfix but with wrong interpretation of the data
+ private static final byte[] SMF_3 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x21, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (interruptor)
+ 0x20, // delta time
+ 0x3C, 0x00, // Note-OFF (C) - running status
+ 0x0D, // delta time
+ 0x3E, 0x7F, // Note-ON (D) - running status
+ 0x60, // delta time
+ 0x3E, 0x00, // Note-OFF (D) - running status
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+}
diff --git a/test/jdk/javax/swing/JComboBox/ComboPopupBug.java b/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
new file mode 100644
index 000000000..830216f0d
--- /dev/null
+++ b/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+/*
+ * @test
+ * @bug 8322754
+ * @summary Verifies clicking JComboBox during frame closure causes Exception
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual ComboPopupBug
+ */
+
+public class ComboPopupBug {
+ private static final String instructionsText = """
+ This test is used to verify that clicking on JComboBox
+ when frame containing it is about to close should not
+ cause IllegalStateException.
+ A JComboBox is shown with Close button at the bottom.
+ Click on Close and then click on JComboBox arrow button
+ to try to show combobox popup.
+ If IllegalStateException is thrown, test will automatically Fail
+ otherwise click Pass. """;
+
+ public static void main(String[] args) throws Exception {
+ PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ .title("ComboPopup Instructions")
+ .instructions(instructionsText)
+ .testTimeOut(5)
+ .rows(10)
+ .columns(35)
+ .build();
+
+ SwingUtilities.invokeAndWait(() -> {
+ JFrame frame = new JFrame("ComboPopup");
+
+ JComboBox cb = new JComboBox();
+ cb.setEditable(true);
+ cb.addItem("test");
+ cb.addItem("test2");
+ cb.addItem("test3");
+ frame.getContentPane().add(cb, "North");
+
+ JButton b = new JButton("Close");
+ b.addActionListener(
+ (e)->{
+ try {
+ Thread.sleep(3000);
+ }
+ catch (Exception ex) {
+ }
+ frame.setVisible(false);
+
+ });
+ frame.getContentPane().add(b, "South");
+ frame.setSize(200, 200);
+
+ PassFailJFrame.addTestWindow(frame);
+ PassFailJFrame.positionTestWindow(frame,
+ PassFailJFrame.Position.HORIZONTAL);
+
+ frame.setVisible(true);
+ });
+
+ passFailJFrame.awaitAndCheck();
+ }
+}
diff --git a/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java b/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
new file mode 100644
index 000000000..a6049f6a0
--- /dev/null
+++ b/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.VmIdentifier;
+
+/*
+ * @test
+ * @bug 8320687
+ * @summary verify that sun.jvmstat.monitor.MonitoredHost.getMonitoredHost() doesn't
+ * unexpectedly throw an exception when invoked by concurrent threads
+ *
+ * @run main/othervm ConcurrentGetMonitoredHost
+ */
+public class ConcurrentGetMonitoredHost {
+
+ /*
+ * Launches multiple concurrent threads and invokes MonitoredHost.getMonitoredHost()
+ * in each of these threads and expects the call to return successfully without any
+ * exceptions.
+ */
+ public static void main(final String[] args) throws Exception {
+ final String pidStr = "12345";
+ final VmIdentifier vmid = new VmIdentifier(pidStr);
+ final int numTasks = 100;
+ final List<Task> tasks = new ArrayList<>();
+ for (int i = 0; i < numTasks; i++) {
+ tasks.add(new Task(vmid));
+ }
+ System.out.println("Submitting " + numTasks + " concurrent tasks to" +
+ " get MonitoredHost for " + vmid);
+ ExecutorService executor = Executors.newCachedThreadPool();
+ // wait for all tasks to complete
+ final List<Future<MonitoredHost>> results = executor.invokeAll(tasks);
+ // verify each one successfully completed and each of
+ // the returned MonitoredHost is not null
+ for (final Future<MonitoredHost> result : results) {
+ final MonitoredHost mh = result.get();
+ if (mh == null) {
+ throw new AssertionError("MonitoredHost.getMonitoredHost() returned" +
+ " null for vmid " + vmid);
+ }
+ }
+
+ System.out.println("All " + numTasks + " completed successfully");
+ }
+
+ // a task which just calls MonitoredHost.getMonitoredHost(VmIdentifier) and
+ // returns the resultant MonitoredHost
+ private static final class Task implements Callable<MonitoredHost> {
+ private final VmIdentifier vmid;
+
+ private Task(final VmIdentifier vmid) {
+ this.vmid = Objects.requireNonNull(vmid);
+ }
+
+ @Override
+ public MonitoredHost call() throws Exception {
+ return MonitoredHost.getMonitoredHost(this.vmid);
+ }
+ }
+}
diff --git a/test/jdk/sun/security/jca/NullPreferredList.java b/test/jdk/sun/security/jca/NullPreferredList.java
new file mode 100644
index 000000000..0a8cf7344
--- /dev/null
+++ b/test/jdk/sun/security/jca/NullPreferredList.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+import java.security.*;
+
+/**
+ * @test
+ * @bug 8328864
+ * @summary Test that ProviderList.getService checks configs when
+ * ProviderList.getProvider fails for preferred providers.
+ * @run main/othervm
+ * -Djava.security.properties=${test.src}/app-security.properties NullPreferredList
+ */
+
+public class NullPreferredList {
+
+ public static void main(final String[] args) throws Exception {
+ final KeyStore ks = KeyStore.getInstance("PKCS12");
+ System.out.println("Got keystore " + ks);
+ }
+}
diff --git a/test/jdk/sun/security/jca/app-security.properties b/test/jdk/sun/security/jca/app-security.properties
new file mode 100644
index 000000000..1f15a7797
--- /dev/null
+++ b/test/jdk/sun/security/jca/app-security.properties
@@ -0,0 +1 @@
+jdk.security.provider.preferred=KeyStore.PKCS12:NonExistingProvider
diff --git a/test/langtools/tools/javac/T8320144.java b/test/langtools/tools/javac/T8320144.java
new file mode 100644
index 000000000..6bd3c4ab6
--- /dev/null
+++ b/test/langtools/tools/javac/T8320144.java
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8320144
+ * @summary Compilation crashes when a custom annotation with invalid default value is used
+ * @compile/fail/ref=T8320144.out -XDrawDiagnostics T8320144.java
+ */
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+public class T8320144 {
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE})
+ public @interface TestAnnotation {
+ public String[] excludeModules() default new String[0];
+ public String[] value() default new String[] { 3 };
+ }
+}
diff --git a/test/langtools/tools/javac/T8320144.out b/test/langtools/tools/javac/T8320144.out
new file mode 100644
index 000000000..cb09e379c
--- /dev/null
+++ b/test/langtools/tools/javac/T8320144.out
@@ -0,0 +1,4 @@
+T8320144.java:16:54: compiler.err.new.not.allowed.in.annotation
+T8320144.java:17:45: compiler.err.new.not.allowed.in.annotation
+T8320144.java:17:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
+3 errors
diff --git a/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java
new file mode 100644
index 000000000..4520a01f7
--- /dev/null
+++ b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java
@@ -0,0 +1,29 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 8320948
+ * @summary NPE due to unreported compiler error
+ * @compile/fail/ref=CrashDueToUnreportedError.out -XDrawDiagnostics CrashDueToUnreportedError.java
+ */
+
+import java.util.List;
+
+public class CrashDueToUnreportedError {
+ class Builder {
+ private Builder(Person person, String unused) {}
+ public Builder withTypes(Entity<String> entities) {
+ return new Builder(Person.make(Entity.combineAll(entities)));
+ }
+ }
+
+ interface Person {
+ static <E> Person make(List<? extends Entity<E>> eventSubtypes) {
+ return null;
+ }
+ }
+
+ class Entity<E> {
+ public static <Root> List<? extends Entity<Root>> combineAll(Entity<Root> subtypes) {
+ return null;
+ }
+ }
+}
diff --git a/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out
new file mode 100644
index 000000000..83655eb07
--- /dev/null
+++ b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out
@@ -0,0 +1,2 @@
+CrashDueToUnreportedError.java:14:43: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: E,compiler.misc.type.captureof: 1, ? extends CrashDueToUnreportedError.Entity<Root>,Root, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 2, ? extends CrashDueToUnreportedError.Entity<Root>>, java.util.List<? extends CrashDueToUnreportedError.Entity<java.lang.Object>>))
+1 error
--
2.19.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。