From c53ee9d3bcc1c6b5f509f268e1d1f827643044ed Mon Sep 17 00:00:00 2001 From: wuyafang <791828096@qq.com> Date: Mon, 14 Oct 2024 11:38:28 +0800 Subject: [PATCH] sync bishengjdk21 patches --- ...-exponent-32-is-too-large-for-32-bit.patch | 22 + ...sert-h_array_list.not_null-failed-in.patch | 25 + ...icFramework-CmdLine-is_executable-co.patch | 22 + 8337982-Remove-dead-undef-assrt0n.patch | 21 + ...h_event_writer-return-value-type-mis.patch | 22 + ...uplicate-line-in-FileMapHeader-print.patch | 21 + ...4580-SIGFPE-on-THP-initialization-on.patch | 106 ++++ ...6346-Fix--Wzero-as-null-pointer-cons.patch | 31 + ...7908-JMXStatusTest.java-fails-assert.patch | 73 +++ ...4484-CDS-dynamic-dumping-incorrectly.patch | 22 + ...3909-JVMCI-assert-cp-tag_at-index-.i.patch | 24 + ...0308-C2-compilation-crashes-in-Libra.patch | 161 +++++ ...0682-[AArch64]-C1-compilation-fails-.patch | 109 ++++ ...2812-Manpage-for-jcmd-is-missing-JFR.patch | 84 +++ ...3699-MessageFormat.toPattern-generat.patch | 566 +++++++++++++++++ ...5022-Incorrect-error-message-on-clie.patch | 47 ++ ...5730-StringBuilder.toString-allocati.patch | 119 ++++ ...5994-JFR-Examples-in-JFR.start-help-.patch | 32 + ...6957-Implement-JEP-474-ZGC-Generatio.patch | 214 +++++++ ...7538-The-SSLExtension-class-specifie.patch | 38 ++ ...8107-Shenandoah-C2-TestVerifyLoopOpt.patch | 120 ++++ ...8553-Get-rid-of-JApplet-in-test-jdk-.patch | 54 ++ ...9174-update-CodeBuffer-layout-in-com.patch | 57 ++ ...9754-The-ThreadSafe-attribute-is-ign.patch | 143 +++++ ...1391-Enhance-the-keytool-code-by-inv.patch | 36 ++ ...2297-annotation-processor-that-gener.patch | 183 ++++++ ...332524-Instead-of-printing-TLSv1.3,-.patch | 31 + ...2818-ubsan-archiveHeapLoader.cpp:70:.patch | 23 + ...2866-Crash-in-ImageIO-JPEG-decoding-.patch | 38 ++ ...2920-C2-Partial-Peeling-is-wrongly-a.patch | 590 ++++++++++++++++++ ...3149-ubsan-memset-on-nullptr-target-.patch | 28 + ...3354-ubsan-frame.inline.hpp:91:25:-a.patch | 370 +++++++++++ ...3462-Performance-regression-of-new-D.patch | 38 ++ ...3599-Improve-description-of-b-matche.patch | 41 ++ ...3622-ubsan-relocInfo_x86.cpp:101:56:.patch | 26 + ...3639-ubsan-cppVtables.cpp:81:55-runt.patch | 39 ++ ...3805-Replaying-compilation-with-null.patch | 242 +++++++ ...3887-ubsan-unsafe.cpp:247:13:-runtim.patch | 25 + ...4123-log-the-opening-of-Type-1-fonts.patch | 41 ++ ...4239-Introduce-macro-for-ubsan-metho.patch | 130 ++++ ...4758-Incorrect-note-in-Javadoc-for-a.patch | 97 +++ ...5638-Calling-VarHandle.-access-mode-.patch | 162 +++++ ...6012-Fix-usages-of-jtreg-reserved-pr.patch | 29 + ...6080-Fix--Wzero-as-null-pointer-cons.patch | 33 + ...6152-Remove-unused-forward-declarati.patch | 29 + ...6855-Duplicate-protected-declaration.patch | 40 ++ ...6879-Always-true-condition-img-null-.patch | 34 + ...7334-Test-tools-javac-7142086-T71420.patch | 54 ++ ...7679-Memset-warning-in-src-hotspot-s.patch | 29 + ...8010-WB_IsFrameDeoptimized-miss-Reso.patch | 28 + ...8938-The-result-of-the-combine-metho.patch | 82 +++ ...9460-CDS-error-when-module-is-locate.patch | 486 +++++++++++++++ ...0186-Shenandoah-Missing-load_referen.patch | 30 + ...K-8340273-Remove-CounterHalfLifeTime.patch | 23 + ...0623-Remove-outdated-PROCESSOR_ARCHI.patch | 30 + ...-8330191-Fix-typo-in-precompiled.hpp.patch | 29 + ...088-ubsan-shenandoahAdaptiveHeuristi.patch | 22 + ...067-Test-runtime-classFileParserBug-.patch | 28 + ...245-Fix-wrong-comment-of-StringConca.patch | 49 ++ Backport-of-8337274-Remove-repeated-the.patch | 40 ++ ...712-Wrong-javadoc-in-java.util.Date-.patch | 29 + ...787-Fix-Wzero-as-null-pointer-consta.patch | 33 + ...8316895-SeenThread::print_action_que.patch | 40 ++ ...8328723-IP-Address-error-when-client.patch | 40 ++ ...8332720-ubsan-instanceKlass.cpp:3550.patch | 32 + ...8336343-Add-more-known-sysroot-libra.patch | 39 ++ ...298-Remove-unused-function-declarati.patch | 36 ++ openjdk-21.spec | 206 +++++- ...1340845-support_system_crypto_policy.patch | 87 --- 69 files changed, 5822 insertions(+), 88 deletions(-) create mode 100644 8300800-UB-Shift-exponent-32-is-too-large-for-32-bit.patch create mode 100644 8334780-Crash-assert-h_array_list.not_null-failed-in.patch create mode 100644 8335610-DiagnosticFramework-CmdLine-is_executable-co.patch create mode 100644 8337982-Remove-dead-undef-assrt0n.patch create mode 100644 8339149-jfr_flush_event_writer-return-value-type-mis.patch create mode 100644 8339351-Remove-duplicate-line-in-FileMapHeader-print.patch create mode 100644 BackPort-JDK-8324580-SIGFPE-on-THP-initialization-on.patch create mode 100644 BackPort-JDK-8336346-Fix--Wzero-as-null-pointer-cons.patch create mode 100644 Backport-JDK-8207908-JMXStatusTest.java-fails-assert.patch create mode 100644 Backport-JDK-8304484-CDS-dynamic-dumping-incorrectly.patch create mode 100644 Backport-JDK-8313909-JVMCI-assert-cp-tag_at-index-.i.patch create mode 100644 Backport-JDK-8320308-C2-compilation-crashes-in-Libra.patch create mode 100644 Backport-JDK-8320682-[AArch64]-C1-compilation-fails-.patch create mode 100644 Backport-JDK-8322812-Manpage-for-jcmd-is-missing-JFR.patch create mode 100644 Backport-JDK-8323699-MessageFormat.toPattern-generat.patch create mode 100644 Backport-JDK-8325022-Incorrect-error-message-on-clie.patch create mode 100644 Backport-JDK-8325730-StringBuilder.toString-allocati.patch create mode 100644 Backport-JDK-8325994-JFR-Examples-in-JFR.start-help-.patch create mode 100644 Backport-JDK-8326957-Implement-JEP-474-ZGC-Generatio.patch create mode 100644 Backport-JDK-8327538-The-SSLExtension-class-specifie.patch create mode 100644 Backport-JDK-8328107-Shenandoah-C2-TestVerifyLoopOpt.patch create mode 100644 Backport-JDK-8328553-Get-rid-of-JApplet-in-test-jdk-.patch create mode 100644 Backport-JDK-8329174-update-CodeBuffer-layout-in-com.patch create mode 100644 Backport-JDK-8329754-The-ThreadSafe-attribute-is-ign.patch create mode 100644 Backport-JDK-8331391-Enhance-the-keytool-code-by-inv.patch create mode 100644 Backport-JDK-8332297-annotation-processor-that-gener.patch create mode 100644 Backport-JDK-8332524-Instead-of-printing-TLSv1.3,-.patch create mode 100644 Backport-JDK-8332818-ubsan-archiveHeapLoader.cpp:70:.patch create mode 100644 Backport-JDK-8332866-Crash-in-ImageIO-JPEG-decoding-.patch create mode 100644 Backport-JDK-8332920-C2-Partial-Peeling-is-wrongly-a.patch create mode 100644 Backport-JDK-8333149-ubsan-memset-on-nullptr-target-.patch create mode 100644 Backport-JDK-8333354-ubsan-frame.inline.hpp:91:25:-a.patch create mode 100644 Backport-JDK-8333462-Performance-regression-of-new-D.patch create mode 100644 Backport-JDK-8333599-Improve-description-of-b-matche.patch create mode 100644 Backport-JDK-8333622-ubsan-relocInfo_x86.cpp:101:56:.patch create mode 100644 Backport-JDK-8333639-ubsan-cppVtables.cpp:81:55-runt.patch create mode 100644 Backport-JDK-8333805-Replaying-compilation-with-null.patch create mode 100644 Backport-JDK-8333887-ubsan-unsafe.cpp:247:13:-runtim.patch create mode 100644 Backport-JDK-8334123-log-the-opening-of-Type-1-fonts.patch create mode 100644 Backport-JDK-8334239-Introduce-macro-for-ubsan-metho.patch create mode 100644 Backport-JDK-8334758-Incorrect-note-in-Javadoc-for-a.patch create mode 100644 Backport-JDK-8335638-Calling-VarHandle.-access-mode-.patch create mode 100644 Backport-JDK-8336012-Fix-usages-of-jtreg-reserved-pr.patch create mode 100644 Backport-JDK-8336080-Fix--Wzero-as-null-pointer-cons.patch create mode 100644 Backport-JDK-8336152-Remove-unused-forward-declarati.patch create mode 100644 Backport-JDK-8336855-Duplicate-protected-declaration.patch create mode 100644 Backport-JDK-8336879-Always-true-condition-img-null-.patch create mode 100644 Backport-JDK-8337334-Test-tools-javac-7142086-T71420.patch create mode 100644 Backport-JDK-8337679-Memset-warning-in-src-hotspot-s.patch create mode 100644 Backport-JDK-8338010-WB_IsFrameDeoptimized-miss-Reso.patch create mode 100644 Backport-JDK-8338938-The-result-of-the-combine-metho.patch create mode 100644 Backport-JDK-8339460-CDS-error-when-module-is-locate.patch create mode 100644 Backport-JDK-8340186-Shenandoah-Missing-load_referen.patch create mode 100644 Backport-JDK-8340273-Remove-CounterHalfLifeTime.patch create mode 100644 Backport-JDK-8340623-Remove-outdated-PROCESSOR_ARCHI.patch create mode 100644 Backport-of-8330191-Fix-typo-in-precompiled.hpp.patch create mode 100644 Backport-of-8333088-ubsan-shenandoahAdaptiveHeuristi.patch create mode 100644 Backport-of-8337067-Test-runtime-classFileParserBug-.patch create mode 100644 Backport-of-8337245-Fix-wrong-comment-of-StringConca.patch create mode 100644 Backport-of-8337274-Remove-repeated-the.patch create mode 100644 Backport-of-8337712-Wrong-javadoc-in-java.util.Date-.patch create mode 100644 Backport-of-8337787-Fix-Wzero-as-null-pointer-consta.patch create mode 100644 Backport-of-JDK-8316895-SeenThread::print_action_que.patch create mode 100644 Backport-of-JDK-8328723-IP-Address-error-when-client.patch create mode 100644 Backport-of-JDK-8332720-ubsan-instanceKlass.cpp:3550.patch create mode 100644 Backport-of-JDK-8336343-Add-more-known-sysroot-libra.patch create mode 100644 backport-of-8339298-Remove-unused-function-declarati.patch delete mode 100644 pr3183-rh1340845-support_system_crypto_policy.patch diff --git a/8300800-UB-Shift-exponent-32-is-too-large-for-32-bit.patch b/8300800-UB-Shift-exponent-32-is-too-large-for-32-bit.patch new file mode 100644 index 0000000..9468f58 --- /dev/null +++ b/8300800-UB-Shift-exponent-32-is-too-large-for-32-bit.patch @@ -0,0 +1,22 @@ +Subject: 8300800: UB: Shift exponent 32 is too large for 32-bit type 'int' + +--- + src/hotspot/cpu/aarch64/immediate_aarch64.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/hotspot/cpu/aarch64/immediate_aarch64.cpp b/src/hotspot/cpu/aarch64/immediate_aarch64.cpp +index 3d87fde2b..961f93ed7 100644 +--- a/src/hotspot/cpu/aarch64/immediate_aarch64.cpp ++++ b/src/hotspot/cpu/aarch64/immediate_aarch64.cpp +@@ -295,7 +295,7 @@ int expandLogicalImmediate(uint32_t immN, uint32_t immr, + uint64_t and_bits_sub = replicate(and_bit, 1, nbits); + uint64_t or_bits_sub = replicate(or_bit, 1, nbits); + uint64_t and_bits_top = (and_bits_sub << nbits) | ones(nbits); +- uint64_t or_bits_top = (0 << nbits) | or_bits_sub; ++ uint64_t or_bits_top = (UCONST64(0) << nbits) | or_bits_sub; + + tmask = ((tmask + & (replicate(and_bits_top, 2 * nbits, 32 / nbits))) +-- +2.33.0 + diff --git a/8334780-Crash-assert-h_array_list.not_null-failed-in.patch b/8334780-Crash-assert-h_array_list.not_null-failed-in.patch new file mode 100644 index 0000000..52dde77 --- /dev/null +++ b/8334780-Crash-assert-h_array_list.not_null-failed-in.patch @@ -0,0 +1,25 @@ +Subject: 8334780: Crash: assert(h_array_list.not_null()) failed: invariant + +--- + src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp b/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp +index 5388349c3..1f594a19e 100644 +--- a/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp ++++ b/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp +@@ -136,8 +136,9 @@ jobject JdkJfrEvent::get_all_klasses(TRAPS) { + transform_klasses_to_local_jni_handles(event_subklasses, THREAD); + + Handle h_array_list(THREAD, new_java_util_arraylist(THREAD)); +- assert(h_array_list.not_null(), "invariant"); +- ++ if (h_array_list.is_null()) { ++ return empty_java_util_arraylist; ++ } + static const char add_method_name[] = "add"; + static const char add_method_signature[] = "(Ljava/lang/Object;)Z"; + const Klass* const array_list_klass = JfrJavaSupport::klass(empty_java_util_arraylist); +-- +2.33.0 + diff --git a/8335610-DiagnosticFramework-CmdLine-is_executable-co.patch b/8335610-DiagnosticFramework-CmdLine-is_executable-co.patch new file mode 100644 index 0000000..cb055a5 --- /dev/null +++ b/8335610-DiagnosticFramework-CmdLine-is_executable-co.patch @@ -0,0 +1,22 @@ +Subject: 8335610: DiagnosticFramework: CmdLine::is_executable() correction + +--- + src/hotspot/share/services/diagnosticFramework.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/hotspot/share/services/diagnosticFramework.hpp b/src/hotspot/share/services/diagnosticFramework.hpp +index 8313954aa..3f5087fd1 100644 +--- a/src/hotspot/share/services/diagnosticFramework.hpp ++++ b/src/hotspot/share/services/diagnosticFramework.hpp +@@ -67,7 +67,7 @@ public: + const char* cmd_addr() const { return _cmd; } + size_t cmd_len() const { return _cmd_len; } + bool is_empty() const { return _cmd_len == 0; } +- bool is_executable() const { return is_empty() || _cmd[0] != '#'; } ++ bool is_executable() const { return !is_empty() && _cmd[0] != '#'; } + bool is_stop() const { return !is_empty() && strncmp("stop", _cmd, _cmd_len) == 0; } + }; + +-- +2.33.0 + diff --git a/8337982-Remove-dead-undef-assrt0n.patch b/8337982-Remove-dead-undef-assrt0n.patch new file mode 100644 index 0000000..144f271 --- /dev/null +++ b/8337982-Remove-dead-undef-assrt0n.patch @@ -0,0 +1,21 @@ +Subject: 8337982: Remove dead undef assrt0n + +--- + src/hotspot/share/memory/metaspace/blockTree.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/hotspot/share/memory/metaspace/blockTree.cpp b/src/hotspot/share/memory/metaspace/blockTree.cpp +index 934f25d84..883f7792e 100644 +--- a/src/hotspot/share/memory/metaspace/blockTree.cpp ++++ b/src/hotspot/share/memory/metaspace/blockTree.cpp +@@ -179,7 +179,6 @@ void BlockTree::verify() const { + // as many nodes as are in this tree) + _counter.check(counter); + +- #undef assrt0n + } + + void BlockTree::zap_range(MetaWord* p, size_t word_size) { +-- +2.33.0 + diff --git a/8339149-jfr_flush_event_writer-return-value-type-mis.patch b/8339149-jfr_flush_event_writer-return-value-type-mis.patch new file mode 100644 index 0000000..e5969be --- /dev/null +++ b/8339149-jfr_flush_event_writer-return-value-type-mis.patch @@ -0,0 +1,22 @@ +Subject: 8339149: jfr_flush_event_writer - return value type mismatch + +--- + src/hotspot/share/jfr/jni/jfrJniMethod.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp +index c7efe1c6a..90d74d59e 100644 +--- a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp ++++ b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp +@@ -119,7 +119,7 @@ jobject JNICALL jfr_get_event_writer(JNIEnv* env, jclass cls); + + jobject JNICALL jfr_new_event_writer(JNIEnv* env, jclass cls); + +-jboolean JNICALL jfr_event_writer_flush(JNIEnv* env, jclass cls, jobject writer, jint used_size, jint requested_size); ++void JNICALL jfr_event_writer_flush(JNIEnv* env, jclass cls, jobject writer, jint used_size, jint requested_size); + + jlong JNICALL jfr_commit(JNIEnv* env, jclass cls, jlong next_position); + +-- +2.33.0 + diff --git a/8339351-Remove-duplicate-line-in-FileMapHeader-print.patch b/8339351-Remove-duplicate-line-in-FileMapHeader-print.patch new file mode 100644 index 0000000..42026d1 --- /dev/null +++ b/8339351-Remove-duplicate-line-in-FileMapHeader-print.patch @@ -0,0 +1,21 @@ +Subject: 8339351: Remove duplicate line in FileMapHeader::print + +--- + src/hotspot/share/cds/filemap.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp +index 7d12e1aca..023c0762a 100644 +--- a/src/hotspot/share/cds/filemap.cpp ++++ b/src/hotspot/share/cds/filemap.cpp +@@ -278,7 +278,6 @@ void FileMapHeader::print(outputStream* st) { + st->print_cr("- core_region_alignment: " SIZE_FORMAT, _core_region_alignment); + st->print_cr("- obj_alignment: %d", _obj_alignment); + st->print_cr("- narrow_oop_base: " INTPTR_FORMAT, p2i(_narrow_oop_base)); +- st->print_cr("- narrow_oop_base: " INTPTR_FORMAT, p2i(_narrow_oop_base)); + st->print_cr("- narrow_oop_shift %d", _narrow_oop_shift); + st->print_cr("- compact_strings: %d", _compact_strings); + st->print_cr("- max_heap_size: " UINTX_FORMAT, _max_heap_size); +-- +2.33.0 + diff --git a/BackPort-JDK-8324580-SIGFPE-on-THP-initialization-on.patch b/BackPort-JDK-8324580-SIGFPE-on-THP-initialization-on.patch new file mode 100644 index 0000000..3d3f47e --- /dev/null +++ b/BackPort-JDK-8324580-SIGFPE-on-THP-initialization-on.patch @@ -0,0 +1,106 @@ +Subject: BackPort of JDK-8324580: SIGFPE on THP initialization on kernels < 4.10 + +--- + src/hotspot/os/linux/hugepages.cpp | 13 +++++++++++++ + src/hotspot/os/linux/hugepages.hpp | 1 + + src/hotspot/os/linux/os_linux.cpp | 6 +++++- + .../jtreg/runtime/os/HugePageConfiguration.java | 14 ++++++++++++++ + .../os/TestHugePageDecisionsAtVMStartup.java | 3 ++- + 5 files changed, 35 insertions(+), 2 deletions(-) + +diff --git a/src/hotspot/os/linux/hugepages.cpp b/src/hotspot/os/linux/hugepages.cpp +index f9f9dd497..715bfc165 100644 +--- a/src/hotspot/os/linux/hugepages.cpp ++++ b/src/hotspot/os/linux/hugepages.cpp +@@ -230,6 +230,19 @@ void THPSupport::print_on(outputStream* os) { + StaticHugePageSupport HugePages::_static_hugepage_support; + THPSupport HugePages::_thp_support; + ++size_t HugePages::thp_pagesize_fallback() { ++ // Older kernels won't publish the THP page size. Fall back to default static huge page size, ++ // since that is likely to be the THP page size as well. Don't do it if the page size is considered ++ // too large to avoid large alignment waste. If static huge page size is unknown, use educated guess. ++ if (thp_pagesize() != 0) { ++ return thp_pagesize(); ++ } ++ if (supports_static_hugepages()) { ++ return MIN2(default_static_hugepage_size(), 16 * M); ++ } ++ return 2 * M; ++} ++ + void HugePages::initialize() { + _static_hugepage_support.scan_os(); + _thp_support.scan_os(); +diff --git a/src/hotspot/os/linux/hugepages.hpp b/src/hotspot/os/linux/hugepages.hpp +index cb7c992d7..5d196504c 100644 +--- a/src/hotspot/os/linux/hugepages.hpp ++++ b/src/hotspot/os/linux/hugepages.hpp +@@ -107,6 +107,7 @@ public: + static THPMode thp_mode() { return _thp_support.mode(); } + static bool supports_thp() { return thp_mode() == THPMode::madvise || thp_mode() == THPMode::always; } + static size_t thp_pagesize() { return _thp_support.pagesize(); } ++ static size_t thp_pagesize_fallback(); + + static void initialize(); + static void print_on(outputStream* os); +diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp +index 4da04ebc7..4ece9f471 100644 +--- a/src/hotspot/os/linux/os_linux.cpp ++++ b/src/hotspot/os/linux/os_linux.cpp +@@ -3843,8 +3843,12 @@ void os::large_page_init() { + // In THP mode: + // - os::large_page_size() is the *THP page size* + // - os::pagesizes() has two members, the THP page size and the system page size +- assert(HugePages::supports_thp() && HugePages::thp_pagesize() > 0, "Missing OS info"); + _large_page_size = HugePages::thp_pagesize(); ++ if (_large_page_size == 0) { ++ log_info(pagesize) ("Cannot determine THP page size (kernel < 4.10 ?)"); ++ _large_page_size = HugePages::thp_pagesize_fallback(); ++ log_info(pagesize) ("Assuming THP page size to be: " EXACTFMT " (heuristics)", EXACTFMTARGS(_large_page_size)); ++ } + _page_sizes.add(_large_page_size); + _page_sizes.add(os::vm_page_size()); + +diff --git a/test/hotspot/jtreg/runtime/os/HugePageConfiguration.java b/test/hotspot/jtreg/runtime/os/HugePageConfiguration.java +index f475af4c2..14cb88fb6 100644 +--- a/test/hotspot/jtreg/runtime/os/HugePageConfiguration.java ++++ b/test/hotspot/jtreg/runtime/os/HugePageConfiguration.java +@@ -84,6 +84,20 @@ class HugePageConfiguration { + return _thpPageSize; + } + ++ // Returns the THP page size (if exposed by the kernel) or a guessed THP page size. ++ // Mimics HugePages::thp_pagesize_fallback() method in hotspot (must be kept in sync with it). ++ public long getThpPageSizeOrFallback() { ++ long pageSize = getThpPageSize(); ++ if (pageSize != 0) { ++ return pageSize; ++ } ++ pageSize = getStaticDefaultHugePageSize(); ++ if (pageSize != 0) { ++ return Math.min(pageSize, 16 * 1024 * 1024); ++ } ++ return 2 * 1024 * 1024; ++ } ++ + // Returns true if the THP support is enabled + public boolean supportsTHP() { + return _thpMode == THPMode.always || _thpMode == THPMode.madvise; +diff --git a/test/hotspot/jtreg/runtime/os/TestHugePageDecisionsAtVMStartup.java b/test/hotspot/jtreg/runtime/os/TestHugePageDecisionsAtVMStartup.java +index 340c13707..18242578d 100644 +--- a/test/hotspot/jtreg/runtime/os/TestHugePageDecisionsAtVMStartup.java ++++ b/test/hotspot/jtreg/runtime/os/TestHugePageDecisionsAtVMStartup.java +@@ -125,7 +125,8 @@ public class TestHugePageDecisionsAtVMStartup { + out.shouldContain("[info][pagesize] UseLargePages=1, UseTransparentHugePages=0"); + out.shouldContain("[info][pagesize] Large page support enabled"); + } else if (useLP && useTHP && configuration.supportsTHP()) { +- String thpPageSizeString = buildSizeString(configuration.getThpPageSize()); ++ long thpPageSize = configuration.getThpPageSizeOrFallback(); ++ String thpPageSizeString = buildSizeString(thpPageSize); + // We expect to see exactly two "Usable page sizes" : the system page size and the THP page size. The system + // page size differs, but its always in KB). + out.shouldContain("[info][pagesize] UseLargePages=1, UseTransparentHugePages=1"); +-- +2.33.0 + diff --git a/BackPort-JDK-8336346-Fix--Wzero-as-null-pointer-cons.patch b/BackPort-JDK-8336346-Fix--Wzero-as-null-pointer-cons.patch new file mode 100644 index 0000000..3115d0c --- /dev/null +++ b/BackPort-JDK-8336346-Fix--Wzero-as-null-pointer-cons.patch @@ -0,0 +1,31 @@ +Subject: BackPort of JDK-8336346: Fix -Wzero-as-null-pointer-constant warnings in jvmciJavaClasses.cpp + +--- + src/hotspot/share/jvmci/jvmciJavaClasses.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/hotspot/share/jvmci/jvmciJavaClasses.cpp b/src/hotspot/share/jvmci/jvmciJavaClasses.cpp +index 4346c4050..94229dcb3 100644 +--- a/src/hotspot/share/jvmci/jvmciJavaClasses.cpp ++++ b/src/hotspot/share/jvmci/jvmciJavaClasses.cpp +@@ -581,7 +581,7 @@ void JNIJVMCI::register_natives(JNIEnv* env) { + #define EMPTY2(x,y) + #define FIELD3(className, name, sig) FIELD2(className, name) + #define FIELD2(className, name) \ +- jfieldID JNIJVMCI::className::_##name##_field_id = 0; \ ++ jfieldID JNIJVMCI::className::_##name##_field_id = nullptr; \ + int HotSpotJVMCI::className::_##name##_offset = 0; + #define METHOD(jniCallType, jniGetMethod, hsCallType, returnType, className, methodName, signatureSymbolName, args) + #define CONSTRUCTOR(className, signature) +@@ -623,7 +623,7 @@ JVMCI_CLASSES_DO(EMPTY2, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, + void JNIJVMCI::className::check(JVMCIEnv* jvmciEnv, JVMCIObject obj, const char* field_name, jfieldID offset) { \ + assert(obj.is_non_null(), "null field access of %s.%s", #className, field_name); \ + assert(jvmciEnv->isa_##className(obj), "wrong class, " #className " expected, found %s", jvmciEnv->klass_name(obj)); \ +- assert(offset != 0, "must be valid offset"); \ ++ assert(offset != nullptr, "must be valid offset"); \ + } \ + jclass JNIJVMCI::className::_class = nullptr; + +-- +2.33.0 + diff --git a/Backport-JDK-8207908-JMXStatusTest.java-fails-assert.patch b/Backport-JDK-8207908-JMXStatusTest.java-fails-assert.patch new file mode 100644 index 0000000..cf8de80 --- /dev/null +++ b/Backport-JDK-8207908-JMXStatusTest.java-fails-assert.patch @@ -0,0 +1,73 @@ +Subject: Backport JDK-8207908 JMXStatusTest.java fails assertion intermittently + +--- + .../management/jmxremote/startstop/JMXStatusTest.java | 5 ++--- + .../jmxremote/startstop/ManagementAgentJcmd.java | 10 +++++----- + 2 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java b/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java +index 1e6259ef0..fc1b48832 100644 +--- a/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java ++++ b/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2015, 2023, 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 +@@ -88,8 +88,6 @@ abstract public class JMXStatusTest { + args.addAll(getCustomVmArgs()); + args.add(TEST_APP_NAME); + testAppPb = ProcessTools.createTestJavaProcessBuilder(args); +- +- jcmd = new ManagementAgentJcmd(TEST_APP_NAME, false); + } + + @BeforeMethod +@@ -98,6 +96,7 @@ abstract public class JMXStatusTest { + TEST_APP_NAME, testAppPb, + (Predicate)l->l.trim().equals("main enter") + ); ++ jcmd = new ManagementAgentJcmd(testApp, false); + } + + @AfterMethod +diff --git a/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java b/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java +index 0781bc941..7135f6ea2 100644 +--- a/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java ++++ b/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2015, 2018, 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 +@@ -47,11 +47,11 @@ final class ManagementAgentJcmd { + private static final String CMD_STATUS = "ManagementAgent.status"; + private static final String CMD_PRINTPERF = "PerfCounter.print"; + +- private final String id; ++ private final long pid; + private final boolean verbose; + +- public ManagementAgentJcmd(String targetApp, boolean verbose) { +- this.id = targetApp; ++ public ManagementAgentJcmd(Process targetApp, boolean verbose) { ++ this.pid = targetApp.pid(); + this.verbose = verbose; + } + +@@ -174,7 +174,7 @@ final class ManagementAgentJcmd { + * @throws InterruptedException + */ + private String jcmd(Consumer c, String ... command) throws IOException, InterruptedException { +- return jcmd(id, c, command); ++ return jcmd(Long.toString(pid), c, command); + } + + /** +-- +2.33.0 + diff --git a/Backport-JDK-8304484-CDS-dynamic-dumping-incorrectly.patch b/Backport-JDK-8304484-CDS-dynamic-dumping-incorrectly.patch new file mode 100644 index 0000000..4ebe262 --- /dev/null +++ b/Backport-JDK-8304484-CDS-dynamic-dumping-incorrectly.patch @@ -0,0 +1,22 @@ +Subject: Backport JDK-8304484 CDS dynamic dumping incorrectly leads to "Error occurred during initialization of VM" + +--- + src/hotspot/share/classfile/classLoader.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp +index 5e89673a5..e4a14d560 100644 +--- a/src/hotspot/share/classfile/classLoader.cpp ++++ b/src/hotspot/share/classfile/classLoader.cpp +@@ -445,7 +445,7 @@ bool ClassPathImageEntry::is_modules_image() const { + void ClassLoader::exit_with_path_failure(const char* error, const char* message) { + Arguments::assert_is_dumping_archive(); + tty->print_cr("Hint: enable -Xlog:class+path=info to diagnose the failure"); +- vm_exit_during_initialization(error, message); ++ vm_exit_during_cds_dumping(error, message); + } + #endif + +-- +2.33.0 + diff --git a/Backport-JDK-8313909-JVMCI-assert-cp-tag_at-index-.i.patch b/Backport-JDK-8313909-JVMCI-assert-cp-tag_at-index-.i.patch new file mode 100644 index 0000000..52ecc85 --- /dev/null +++ b/Backport-JDK-8313909-JVMCI-assert-cp-tag_at-index-.i.patch @@ -0,0 +1,24 @@ +Subject: Backport JDK-8313909 [JVMCI] assert(cp->tag_at(index).is_unresolved_klass()) in lookupKlassInPool + +--- + src/hotspot/share/jvmci/jvmciCompilerToVM.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +index 5b45499f9..df9f866b9 100644 +--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp ++++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +@@ -879,7 +879,9 @@ C2V_VMENTRY_NULL(jobject, lookupKlassInPool, (JNIEnv* env, jobject, ARGUMENT_PAI + } else if (tag.is_symbol()) { + symbol = cp->symbol_at(index); + } else { +- assert(cp->tag_at(index).is_unresolved_klass(), "wrong tag"); ++ if (!tag.is_unresolved_klass()) { ++ JVMCI_THROW_MSG_NULL(InternalError, err_msg("Expected %d at index %d, got %d", JVM_CONSTANT_UnresolvedClassInError, index, tag.value())); ++ } + symbol = cp->klass_name_at(index); + } + } +-- +2.33.0 + diff --git a/Backport-JDK-8320308-C2-compilation-crashes-in-Libra.patch b/Backport-JDK-8320308-C2-compilation-crashes-in-Libra.patch new file mode 100644 index 0000000..88203a9 --- /dev/null +++ b/Backport-JDK-8320308-C2-compilation-crashes-in-Libra.patch @@ -0,0 +1,161 @@ +Subject: Backport JDK-8320308 C2 compilation crashes in LibraryCallKit::inline_unsafe_access + +--- + src/hotspot/share/opto/library_call.cpp | 7 +- + .../TestUnsafeArrayAccessWithNullBase.java | 113 ++++++++++++++++++ + 2 files changed, 117 insertions(+), 3 deletions(-) + create mode 100644 test/hotspot/jtreg/compiler/parsing/TestUnsafeArrayAccessWithNullBase.java + +diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp +index af2ea6095..3ef0098c4 100644 +--- a/src/hotspot/share/opto/library_call.cpp ++++ b/src/hotspot/share/opto/library_call.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1999, 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 +@@ -2004,7 +2004,7 @@ LibraryCallKit::classify_unsafe_addr(Node* &base, Node* &offset, BasicType type) + if (base_type == nullptr) { + // Unknown type. + return Type::AnyPtr; +- } else if (base_type == TypePtr::NULL_PTR) { ++ } else if (_gvn.type(base->uncast()) == TypePtr::NULL_PTR) { + // Since this is a null+long form, we have to switch to a rawptr. + base = _gvn.transform(new CastX2PNode(offset)); + offset = MakeConX(0); +@@ -2322,8 +2322,9 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c + SafePointNode* old_map = clone_map(); + + Node* adr = make_unsafe_address(base, offset, type, kind == Relaxed); ++ assert(!stopped(), "Inlining of unsafe access failed: address construction stopped unexpectedly"); + +- if (_gvn.type(base)->isa_ptr() == TypePtr::NULL_PTR) { ++ if (_gvn.type(base->uncast())->isa_ptr() == TypePtr::NULL_PTR) { + if (type != T_OBJECT) { + decorators |= IN_NATIVE; // off-heap primitive access + } else { +diff --git a/test/hotspot/jtreg/compiler/parsing/TestUnsafeArrayAccessWithNullBase.java b/test/hotspot/jtreg/compiler/parsing/TestUnsafeArrayAccessWithNullBase.java +new file mode 100644 +index 000000000..28eb4f3c1 +--- /dev/null ++++ b/test/hotspot/jtreg/compiler/parsing/TestUnsafeArrayAccessWithNullBase.java +@@ -0,0 +1,113 @@ ++/* ++ * 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 8320308 ++ * @summary Unsafe::getShortUnaligned with base null hidden behind CheckCastPP nodes ++ * @library /test/lib ++ * @modules java.base/jdk.internal.misc ++ * @run main/othervm -Xbatch -XX:CompileCommand=quiet -XX:TypeProfileLevel=222 ++ * -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline ++ * -XX:CompileCommand=compileonly,compiler.parsing.TestUnsafeArrayAccessWithNullBase::test* ++ * -XX:-TieredCompilation compiler.parsing.TestUnsafeArrayAccessWithNullBase ++ * @run main compiler.parsing.TestUnsafeArrayAccessWithNullBase ++ */ ++ ++package compiler.parsing; ++ ++import java.lang.reflect.*; ++import jdk.internal.misc.Unsafe; ++ ++public class TestUnsafeArrayAccessWithNullBase { ++ ++ /* ++ Trigger bug when handling Unsafe.getShortUnaligned with null checks and inlined methods. ++ The bug appears when the method is incrementally inlined and optimized based on the argument profile information. ++ ++ Warmup Phase: By warming up with non-null values, the argument profile for the helper methods records non-null types. ++ - insert CheckCastPP: speculative=byte[int:>=0] for return of getSmall/getLarge ++ - insert CheckCastPP: speculative=byte[int:>=0] for argument `Object array` in helperSmall/helperLarge ++ Trigger Phase: Calling test causes LibraryCallKit::inline_unsafe_access(..) for Unsafe::getShortUnaligned to fail: ++ Reason: UNSAFE.getShortUnaligned(array, offset) is called with array=null, ++ but ConP null is now hidden by two CheckCastPP with speculative=byte[int:>=0] in the graph ++ */ ++ ++ private static final Unsafe UNSAFE = Unsafe.getUnsafe(); ++ ++ private static final Object byteArray = new byte[1_050_000]; ++ ++ public static Object getLarge(boolean useNull) { ++ return useNull ? null : byteArray; ++ } ++ ++ public static Object getSmall(boolean useNull) { ++ return useNull ? null : new byte[10]; ++ } ++ ++ // use a helper to delay inlining of UNSAFE.getShortUnaligned ++ public static int helperLarge(Object array, boolean run) { ++ // offset >= os::vm_page_size(): LibraryCallKit::classify_unsafe_addr returns Type::AnyPtr ++ return run ? UNSAFE.getShortUnaligned(array, 1_049_000) : 0; // after warmup CheckCastPP: speculative=byte[int:>=0] ++ } ++ ++ public static int accessLargeArray(boolean useNull, boolean run) { ++ Object array = getLarge(useNull); // after warmup CheckCastPP: speculative=byte[int:>=0] ++ // getLarge() ensures null is only visible after helperLarge was (incrementally) inlined ++ return helperLarge(array, run); ++ } ++ ++ // use a helper to delay inlining of UNSAFE.getShortUnaligned ++ // warmup adds argument profile information for array: CheckCastPP with type non null ++ public static int helperSmall(Object array, boolean run) { ++ // 0 <= offset < os::vm_page_size(): LibraryCallKit::classify_unsafe_addr returns Type::OopPtr ++ return run ? UNSAFE.getShortUnaligned(array, 1) : 0; // after warmup CheckCastPP: speculative=byte[int:>=0] ++ } ++ ++ public static int accessSmallArray(boolean useNull, boolean run) { ++ Object array = getSmall(useNull); // after warmup CheckCastPP: speculative=byte[int:>=0] ++ return helperSmall(array, run); ++ } ++ ++ public static int test1(boolean run) { ++ return accessLargeArray(true, run); ++ } ++ ++ public static int test2(boolean run) { ++ return accessSmallArray(true, run); ++ } ++ ++ public static void main(String[] args) { ++ // Warmup to collect speculative types ++ for (int i = 0; i < 10_000; i++) { ++ accessLargeArray(false, true); ++ accessSmallArray(false, true); ++ } ++ ++ // Trigger Compilation ++ for (int i = 0; i < 10_000; ++i) { ++ test1(false); ++ test2(false); ++ } ++ } ++} +-- +2.33.0 + diff --git a/Backport-JDK-8320682-[AArch64]-C1-compilation-fails-.patch b/Backport-JDK-8320682-[AArch64]-C1-compilation-fails-.patch new file mode 100644 index 0000000..b19427f --- /dev/null +++ b/Backport-JDK-8320682-[AArch64]-C1-compilation-fails-.patch @@ -0,0 +1,109 @@ +Subject: Backport of JDK-8320682:[AArch64] C1 compilation fails with "Field too big for insn" + +--- + src/hotspot/share/c1/c1_globals.hpp | 6 +- + .../compiler/arguments/TestC1Globals.java | 67 +++++++++++++++++++ + 2 files changed, 71 insertions(+), 2 deletions(-) + create mode 100644 test/hotspot/jtreg/compiler/arguments/TestC1Globals.java + +diff --git a/src/hotspot/share/c1/c1_globals.hpp b/src/hotspot/share/c1/c1_globals.hpp +index 1c22cf16c..3ef4bbc2d 100644 +--- a/src/hotspot/share/c1/c1_globals.hpp ++++ b/src/hotspot/share/c1/c1_globals.hpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2022, 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 +@@ -275,9 +275,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/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java +new file mode 100644 +index 000000000..fbb4951d9 +--- /dev/null ++++ b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java +@@ -0,0 +1,67 @@ ++/* ++ * 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 8316653 ++ * @requires vm.debug ++ * @summary Test flag with max value. ++ * ++ * @run main/othervm -XX:NMethodSizeLimit=1M ++ * compiler.arguments.TestC1Globals ++ */ ++ ++/** ++ * @test ++ * @bug 8318817 ++ * @requires vm.debug ++ * @requires os.family == "linux" ++ * @summary Test flag with max value combined with transparent huge pages on ++ * Linux. ++ * ++ * @run main/othervm -XX:NMethodSizeLimit=1M ++ * -XX:+UseTransparentHugePages ++ * compiler.arguments.TestC1Globals ++ */ ++ ++/** ++ * @test ++ * @bug 8320682 ++ * @requires vm.debug ++ * @summary Test flag with max value and specific compilation. ++ * ++ * @run main/othervm -XX:NMethodSizeLimit=1M ++ * -XX:CompileOnly=java.util.HashMap::putMapEntries ++ * -Xcomp ++ * compiler.arguments.TestC1Globals ++ * ++ */ ++ ++ package compiler.arguments; ++ ++ public class TestC1Globals { ++ ++ public static void main(String args[]) { ++ System.out.println("Passed"); ++ } ++ } +\ No newline at end of file +-- +2.33.0 + diff --git a/Backport-JDK-8322812-Manpage-for-jcmd-is-missing-JFR.patch b/Backport-JDK-8322812-Manpage-for-jcmd-is-missing-JFR.patch new file mode 100644 index 0000000..544e826 --- /dev/null +++ b/Backport-JDK-8322812-Manpage-for-jcmd-is-missing-JFR.patch @@ -0,0 +1,84 @@ +Subject: Backport JDK-8322812 Manpage for jcmd is missing JFR.view command + +--- + src/jdk.jcmd/share/man/jcmd.1 | 53 +++++++++++++++++++++++++++++++++-- + 1 file changed, 51 insertions(+), 2 deletions(-) + +diff --git a/src/jdk.jcmd/share/man/jcmd.1 b/src/jdk.jcmd/share/man/jcmd.1 +index 27f5ee5eb..f3e254be9 100644 +--- a/src/jdk.jcmd/share/man/jcmd.1 ++++ b/src/jdk.jcmd/share/man/jcmd.1 +@@ -1,4 +1,4 @@ +-.\" 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 +@@ -35,7 +35,7 @@ + . ftr VB CB + . ftr VBI CBI + .\} +-.TH "JCMD" "1" "2023" "JDK 21" "JDK Commands" ++.TH "JCMD" "1" "2025" "JDK 24-ea" "JDK Commands" + .hy + .SH NAME + .PP +@@ -625,6 +625,55 @@ If no path is provided, the data from the recording is discarded. + value) + .RE + .TP ++\f[V]JFR.view\f[R] [\f[I]options\f[R]] ++Display event data in predefined views. ++.RS ++.PP ++Impact: Medium ++.PP ++\f[B]Note:\f[R] ++.PP ++The \f[I]options\f[R] must be specified using either \f[I]key\f[R] or ++\f[I]key\f[R]\f[V]=\f[R]\f[I]value\f[R] syntax. ++If no parameters are entered, then a list of available views are ++displayed. ++.PP ++\f[I]options\f[R]: ++.IP \[bu] 2 ++\f[V]cell-height\f[R]: (Optional) Maximum number of rows in a table ++cell. ++(INT, default value depends on the view) ++.IP \[bu] 2 ++\f[V]maxage\f[R]: (Optional) Length of time for the view to span. ++(INT followed by \[aq]s\[aq] for seconds \[aq]m\[aq] for minutes or ++\[aq]h\[aq] for hours, default value is 10m) ++.IP \[bu] 2 ++\f[V]maxsize\f[R]: (Optional) Maximum size for the view to span in bytes ++if one of the following suffixes is not used: \[aq]m\[aq] or \[aq]M\[aq] ++for megabytes OR \[aq]g\[aq] or \[aq]G\[aq] for gigabytes. ++(STRING, default value is 32MB) ++.IP \[bu] 2 ++\f[V]truncate\f[R]: (Optional) Maximum number of rows in a table cell. ++(INT, default value depends on the view) ++.IP \[bu] 2 ++\f[V]verbose\f[R]: (Optional) Displays the query that makes up the view. ++(BOOLEAN, default value is false) ++.IP \[bu] 2 ++\f[V]width\f[R]: (Optional) The width of the view in characters. ++(INT, default value depends on the view) ++.PP ++\f[I]arguments\f[R]: ++.IP \[bu] 2 ++\f[V]view\f[R]: Name of the view or event type to display. ++Use \f[V]help JFR.view\f[R] to see a list of available views. ++(STRING, no default value) ++.PP ++The view parameter can be an event type name. ++Use \f[V]JFR.view types\f[R] to see a list. ++To display all views, use \f[V]JFR.view all-views\f[R]. ++To display all events, use \f[V]JFR.view all-events\f[R]. ++.RE ++.TP + \f[V]JVMTI.agent_load\f[R] [\f[I]arguments\f[R]] + Loads JVMTI native agent. + .RS +-- +2.33.0 + diff --git a/Backport-JDK-8323699-MessageFormat.toPattern-generat.patch b/Backport-JDK-8323699-MessageFormat.toPattern-generat.patch new file mode 100644 index 0000000..174cac2 --- /dev/null +++ b/Backport-JDK-8323699-MessageFormat.toPattern-generat.patch @@ -0,0 +1,566 @@ +Subject: Backport JDK-8323699: MessageFormat.toPattern() generates non-equivalent MessageFormat pattern + +--- + .../classes/java/text/MessageFormat.java | 76 +++- + .../MessageFormatToPatternTest.java | 364 ++++++++++++++++++ + .../MessageFormatsByArgumentIndex.java | 8 +- + .../MessageFormat/MessageRegression.java | 6 +- + 4 files changed, 442 insertions(+), 12 deletions(-) + create mode 100644 test/jdk/java/text/Format/MessageFormat/MessageFormatToPatternTest.java + +diff --git a/src/java.base/share/classes/java/text/MessageFormat.java b/src/java.base/share/classes/java/text/MessageFormat.java +index 28d1474ad..659838c8a 100644 +--- a/src/java.base/share/classes/java/text/MessageFormat.java ++++ b/src/java.base/share/classes/java/text/MessageFormat.java +@@ -548,6 +548,11 @@ public class MessageFormat extends Format { + * The string is constructed from internal information and therefore + * does not necessarily equal the previously applied pattern. + * ++ * @implSpec The implementation in {@link MessageFormat} returns a ++ * string that, when passed to a {@code MessageFormat()} constructor ++ * or {@link #applyPattern applyPattern()}, produces an instance that ++ * is semantically equivalent to this instance. ++ * + * @return a pattern representing the current state of the message format + */ + public String toPattern() { +@@ -559,6 +564,7 @@ public class MessageFormat extends Format { + lastOffset = offsets[i]; + result.append('{').append(argumentNumbers[i]); + Format fmt = formats[i]; ++ String subformatPattern = null; + if (fmt == null) { + // do nothing, string format + } else if (fmt instanceof NumberFormat) { +@@ -571,10 +577,12 @@ public class MessageFormat extends Format { + } else if (fmt.equals(NumberFormat.getIntegerInstance(locale))) { + result.append(",number,integer"); + } else { +- if (fmt instanceof DecimalFormat) { +- result.append(",number,").append(((DecimalFormat)fmt).toPattern()); +- } else if (fmt instanceof ChoiceFormat) { +- result.append(",choice,").append(((ChoiceFormat)fmt).toPattern()); ++ if (fmt instanceof DecimalFormat dfmt) { ++ result.append(",number"); ++ subformatPattern = dfmt.toPattern(); ++ } else if (fmt instanceof ChoiceFormat cfmt) { ++ result.append(",choice"); ++ subformatPattern = cfmt.toPattern(); + } else { + // UNKNOWN + } +@@ -596,8 +604,9 @@ public class MessageFormat extends Format { + } + } + if (index >= DATE_TIME_MODIFIERS.length) { +- if (fmt instanceof SimpleDateFormat) { +- result.append(",date,").append(((SimpleDateFormat)fmt).toPattern()); ++ if (fmt instanceof SimpleDateFormat sdfmt) { ++ result.append(",date"); ++ subformatPattern = sdfmt.toPattern(); + } else { + // UNKNOWN + } +@@ -607,6 +616,14 @@ public class MessageFormat extends Format { + } else { + //result.append(", unknown"); + } ++ if (subformatPattern != null) { ++ result.append(','); ++ ++ // The subformat pattern comes already quoted, but only for those characters that are ++ // special to the subformat. Therefore, we may need to quote additional characters. ++ // The ones we care about at the MessageFormat level are '{' and '}'. ++ copyAndQuoteBraces(subformatPattern, result); ++ } + result.append('}'); + } + copyAndFixQuotes(pattern, lastOffset, pattern.length(), result); +@@ -1624,6 +1641,53 @@ public class MessageFormat extends Format { + } + } + ++ // Copy the text, but add quotes around any quotables that aren't already quoted ++ private static void copyAndQuoteBraces(String source, StringBuilder target) { ++ ++ // Analyze existing string for already quoted and newly quotable characters ++ record Qchar(char ch, boolean quoted) { }; ++ ArrayList qchars = new ArrayList<>(); ++ boolean quoted = false; ++ boolean anyChangeNeeded = false; ++ for (int i = 0; i < source.length(); i++) { ++ char ch = source.charAt(i); ++ if (ch == '\'') { ++ if (i + 1 < source.length() && source.charAt(i + 1) == '\'') { ++ qchars.add(new Qchar('\'', quoted)); ++ i++; ++ } else { ++ quoted = !quoted; ++ } ++ } else { ++ boolean quotable = ch == '{' || ch == '}'; ++ anyChangeNeeded |= quotable && !quoted; ++ qchars.add(new Qchar(ch, quoted || quotable)); ++ } ++ } ++ ++ // Was any change needed? ++ if (!anyChangeNeeded) { ++ target.append(source); ++ return; ++ } ++ ++ // Build new string, automatically consolidating adjacent runs of quoted chars ++ quoted = false; ++ for (Qchar qchar : qchars) { ++ char ch = qchar.ch; ++ if (ch == '\'') { ++ target.append(ch); // doubling works whether quoted or not ++ } else if (qchar.quoted() != quoted) { ++ target.append('\''); ++ quoted = qchar.quoted(); ++ } ++ target.append(ch); ++ } ++ if (quoted) { ++ target.append('\''); ++ } ++ } ++ + /** + * After reading an object from the input stream, do a simple verification + * to maintain class invariants. +diff --git a/test/jdk/java/text/Format/MessageFormat/MessageFormatToPatternTest.java b/test/jdk/java/text/Format/MessageFormat/MessageFormatToPatternTest.java +new file mode 100644 +index 000000000..020bc8033 +--- /dev/null ++++ b/test/jdk/java/text/Format/MessageFormat/MessageFormatToPatternTest.java +@@ -0,0 +1,364 @@ ++/* ++ * 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 ++ * @summary Verify that MessageFormat.toPattern() properly escapes special curly braces ++ * @bug 8323699 ++ * @run junit MessageFormatToPatternTest ++ */ ++ ++import java.text.ChoiceFormat; ++import java.text.DateFormat; ++import java.text.DecimalFormat; ++import java.text.Format; ++import java.text.MessageFormat; ++import java.text.NumberFormat; ++import java.text.SimpleDateFormat; ++import java.util.ArrayList; ++import java.util.Date; ++import java.util.Locale; ++import java.util.Random; ++import java.util.stream.Stream; ++ ++import org.junit.jupiter.api.AfterAll; ++import org.junit.jupiter.api.BeforeAll; ++import org.junit.jupiter.api.Test; ++import org.junit.jupiter.params.ParameterizedTest; ++import org.junit.jupiter.params.provider.Arguments; ++import org.junit.jupiter.params.provider.MethodSource; ++ ++import static org.junit.jupiter.api.Assertions.assertEquals; ++ ++public class MessageFormatToPatternTest { ++ ++ private static final int NUM_RANDOM_TEST_CASES = 1000; ++ ++ // Max levels of nesting of ChoiceFormats inside MessageFormats ++ private static final int MAX_FORMAT_NESTING = 3; ++ ++ private static Locale savedLocale; ++ private static long randomSeed; // set this to a non-zero value for reproducibility ++ private static Random random; ++ private static boolean spitSeed; ++ private static int textCount; ++ ++// Setup & Teardown ++ ++ @BeforeAll ++ public static void setup() { ++ savedLocale = Locale.getDefault(); ++ Locale.setDefault(Locale.US); ++ if (randomSeed == 0) ++ randomSeed = new Random().nextLong(); ++ random = new Random(randomSeed); ++ } ++ ++ @AfterAll ++ public static void teardown() { ++ Locale.setDefault(savedLocale); ++ } ++ ++// Tests ++ ++ // Test expected output when given a MessageFormat pattern string and value 1.23 ++ @ParameterizedTest ++ @MethodSource("generateOutputTestCases") ++ public void testOutput(String pattern, String expected) { ++ ++ // Test we get the expected output ++ MessageFormat format = new MessageFormat(pattern); ++ String actual = format.format(new Object[] { 1.23 }); ++ assertEquals(expected, actual); ++ ++ // Test round trip as well ++ testRoundTrip(format); ++ } ++ ++ public static Stream generateOutputTestCases() { ++ return Stream.of( ++ ++ // This is the test case from JDK-8323699 ++ Arguments.of("{0,choice,0.0#option A: {0}|1.0#option B: {0}'}'}", "option B: 1.23}"), ++ Arguments.of("{0,choice,0.0#option A: {0}|2.0#option B: {0}'}'}", "option A: 1.23"), ++ ++ // A few more test cases from the PR#17416 discussion ++ Arguments.of("Test: {0,number,foo'{'#.00}", "Test: foo{1.23"), ++ Arguments.of("Test: {0,number,foo'}'#.00}", "Test: foo}1.23"), ++ Arguments.of("{0,number,' abc }'' ' 0.00}", " abc }' 1.23"), ++ Arguments.of("Wayne ''The Great One'' Gretsky", "Wayne 'The Great One' Gretsky"), ++ Arguments.of("'Wayne ''The Great One'' Gretsky'", "Wayne 'The Great One' Gretsky"), ++ Arguments.of("{0,choice,0.0#'''{''curly''}'' braces'}", "{curly} braces"), ++ Arguments.of("{0,choice,0.0#''{''curly''}'' braces}", "{curly} braces"), ++ Arguments.of("{0,choice,0.0#'{0,choice,0.0#''{0,choice,0.0#''''{0,choice,0.0#foo}''''}''}'}", "foo"), ++ ++ // Absurd double quote examples ++ Arguments.of("Foo '}''''''''}' {0,number,bar'}' '}' } baz ", "Foo }''''} bar} } 1 baz "), ++ Arguments.of("'''}''{'''}''''}'", "'}'{'}''}"), ++ ++ // An absurdly complicated example ++ Arguments.of("{0,choice,0.0#text2887 [] '{'1,date,YYYY-MM-DD'}' text2888 [''*'']|1.0#found|2.0#'text2901 [oog'')!''] {2,choice,0.0#''text2897 ['''']''''wq1Q] {2,choice,0.0#''''text2891 [s''''''''&''''''''] {0,number,#0.##} text2892 [8''''''''|$'''''''''''''''''''''''']''''|1.0#''''text2893 [] {0,number,#0.##} text2894 [S'''''''']'''''''']''''|2.0#text2895 [''''''''.''''''''eB] {1,date,YYYY-MM-DD} text2896 [9Y]} text2898 []''|1.0#''text2899 [xk7] {0,number,#0.##} text2900 []''} text2902 [7'':$)''O]'}{0,choice,0.0#'text2903 [] {0,number,#0.##} text2904 [S'':'']'|1.0#'me'}", "foundme") ++ ); ++ } ++ ++ // Go roundrip from MessageFormat -> pattern string -> MessageFormat and verify equivalence ++ @ParameterizedTest ++ @MethodSource("generateRoundTripTestCases") ++ public void testRoundTrip(MessageFormat format1) { ++ ++ // Prepare MessageFormat argument ++ Object[] args = new Object[] { ++ 8.5, // argument for DecimalFormat ++ new Date(1705502102677L), // argument for SimpleDateFormat ++ random.nextInt(6) // argument for ChoiceFormat ++ }; ++ ++ String pattern1 = null; ++ String result1 = null; ++ String pattern2 = null; ++ String result2 = null; ++ try { ++ ++ // Format using the given MessageFormat ++ pattern1 = format1.toPattern(); ++ result1 = format1.format(args); ++ ++ // Round-trip via toPattern() and repeat ++ MessageFormat format2 = new MessageFormat(pattern1); ++ pattern2 = format2.toPattern(); ++ result2 = format2.format(args); ++ ++ // Check equivalence ++ assertEquals(result1, result2); ++ assertEquals(pattern1, pattern2); ++ ++ // Debug ++ //showRoundTrip(format1, pattern1, result1, pattern2, result2); ++ } catch (RuntimeException | Error e) { ++ System.out.println(String.format("%n********** FAILURE **********%n")); ++ System.out.println(String.format("%s%n", e)); ++ if (!spitSeed) { ++ System.out.println(String.format("*** Random seed was 0x%016xL%n", randomSeed)); ++ spitSeed = true; ++ } ++ showRoundTrip(format1, pattern1, result1, pattern2, result2); ++ throw e; ++ } ++ } ++ ++ public static Stream generateRoundTripTestCases() { ++ final ArrayList argList = new ArrayList<>(); ++ for (int i = 0; i < NUM_RANDOM_TEST_CASES; i++) ++ argList.add(Arguments.of(randomFormat())); ++ return argList.stream(); ++ } ++ ++ // Generate a "random" MessageFormat. We do this by creating a MessageFormat with "{0}" placeholders ++ // and then substituting in random DecimalFormat, DateFormat, and ChoiceFormat subformats. The goal here ++ // is to avoid using pattern strings to construct formats, because they're what we're trying to check. ++ private static MessageFormat randomFormat() { ++ ++ // Create a temporary MessageFormat containing "{0}" placeholders and random text ++ StringBuilder tempPattern = new StringBuilder(); ++ int numParts = random.nextInt(3) + 1; ++ for (int i = 0; i < numParts; i++) { ++ if (random.nextBoolean()) ++ tempPattern.append("{0}"); // temporary placeholder for a subformat ++ else ++ tempPattern.append(quoteText(randomText())); ++ } ++ ++ // Replace all the "{0}" placeholders with random subformats ++ MessageFormat format = new MessageFormat(tempPattern.toString()); ++ Format[] formats = format.getFormats(); ++ for (int i = 0; i < formats.length; i++) ++ formats[i] = randomSubFormat(0); ++ format.setFormats(formats); ++ ++ // Done ++ return format; ++ } ++ ++ // Generate some random text ++ private static String randomText() { ++ StringBuilder buf = new StringBuilder(); ++ int length = random.nextInt(6); ++ for (int i = 0; i < length; i++) { ++ char ch = (char)(0x20 + random.nextInt(0x5f)); ++ buf.append(ch); ++ } ++ return buf.toString(); ++ } ++ ++ // Quote non-alphanumeric characters in the given plain text ++ private static String quoteText(String string) { ++ StringBuilder buf = new StringBuilder(); ++ boolean quoted = false; ++ for (int i = 0; i < string.length(); i++) { ++ char ch = string.charAt(i); ++ if (ch == '\'') ++ buf.append("''"); ++ else if (!(ch == ' ' || Character.isLetter(ch) || Character.isDigit(ch))) { ++ if (!quoted) { ++ buf.append('\''); ++ quoted = true; ++ } ++ buf.append(ch); ++ } else { ++ if (quoted) { ++ buf.append('\''); ++ quoted = false; ++ } ++ buf.append(ch); ++ } ++ } ++ if (quoted) ++ buf.append('\''); ++ return buf.toString(); ++ } ++ ++ // Create a random subformat for a MessageFormat ++ private static Format randomSubFormat(int nesting) { ++ int which; ++ if (nesting >= MAX_FORMAT_NESTING) ++ which = random.nextInt(2); // no more recursion ++ else ++ which = random.nextInt(3); ++ switch (which) { ++ case 0: ++ return new DecimalFormat("#.##"); ++ case 1: ++ return new SimpleDateFormat("YYYY-MM-DD"); ++ default: ++ int numChoices = random.nextInt(3) + 1; ++ assert numChoices > 0; ++ final double[] limits = new double[numChoices]; ++ final String[] formats = new String[numChoices]; ++ for (int i = 0; i < limits.length; i++) { ++ limits[i] = (double)i; ++ formats[i] = randomMessageFormatContaining(randomSubFormat(nesting + 1)); ++ } ++ return new ChoiceFormat(limits, formats); ++ } ++ } ++ ++ // Create a MessageFormat pattern string that includes the given Format as a subformat. ++ // The result will be one option in a ChoiceFormat which is nested in an outer MessageFormat. ++ // A ChoiceFormat option string is just a plain string; it's only when that plain string ++ // bubbles up to a containing MessageFormat that it gets interpreted as a MessageFormat string, ++ // and that only happens if the option string contains a '{' character. That will always ++ // be the case for the strings returned by this method of course. ++ private static String randomMessageFormatContaining(Format format) { ++ String beforeText = quoteText(randomText().replaceAll("\\{", "")); // avoid invalid MessageFormat syntax ++ String afterText = quoteText(randomText().replaceAll("\\{", "")); // avoid invalid MessageFormat syntax ++ String middleText; ++ if (format instanceof DecimalFormat dfmt) ++ middleText = String.format("{0,number,%s}", dfmt.toPattern()); ++ else if (format instanceof SimpleDateFormat sdfmt) ++ middleText = String.format("{1,date,%s}", sdfmt.toPattern()); ++ else if (format instanceof ChoiceFormat cfmt) ++ middleText = String.format("{2,choice,%s}", cfmt.toPattern()); ++ else ++ throw new RuntimeException("internal error"); ++ return String.format("text%d [%s] %s text%d [%s]", ++textCount, beforeText, middleText, ++textCount, afterText); ++ } ++ ++// Debug printing ++ ++ private void showRoundTrip(MessageFormat format1, String pattern1, String result1, String pattern2, String result2) { ++ print(0, format1); ++ System.out.println(); ++ if (pattern1 != null) ++ System.out.println(String.format(" pattern1 = %s", javaLiteral(pattern1))); ++ if (result1 != null) ++ System.out.println(String.format(" result1 = %s", javaLiteral(result1))); ++ if (pattern2 != null) ++ System.out.println(String.format(" pattern2 = %s", javaLiteral(pattern2))); ++ if (result2 != null) ++ System.out.println(String.format(" result2 = %s", javaLiteral(result2))); ++ System.out.println(); ++ } ++ ++ private static void print(int depth, Object format) { ++ if (format == null) ++ return; ++ if (format instanceof String) ++ System.out.println(String.format("%s- %s", indent(depth), javaLiteral((String)format))); ++ else if (format instanceof MessageFormat) ++ print(depth, (MessageFormat)format); ++ else if (format instanceof DecimalFormat) ++ print(depth, (DecimalFormat)format); ++ else if (format instanceof SimpleDateFormat) ++ print(depth, (SimpleDateFormat)format); ++ else if (format instanceof ChoiceFormat) ++ print(depth, (ChoiceFormat)format); ++ else ++ throw new RuntimeException("internal error: " + format.getClass()); ++ } ++ ++ private static void print(int depth, MessageFormat format) { ++ System.out.println(String.format("%s- %s: %s", indent(depth), "MessageFormat", javaLiteral(format.toPattern()))); ++ for (Format subformat : format.getFormats()) ++ print(depth + 1, subformat); ++ } ++ ++ private static void print(int depth, DecimalFormat format) { ++ System.out.println(String.format("%s- %s: %s", indent(depth), "DecimalFormat", javaLiteral(format.toPattern()))); ++ } ++ ++ private static void print(int depth, SimpleDateFormat format) { ++ System.out.println(String.format("%s- %s: %s", indent(depth), "SimpleDateFormat", javaLiteral(format.toPattern()))); ++ } ++ ++ private static void print(int depth, ChoiceFormat format) { ++ System.out.println(String.format("%s- %s: %s", indent(depth), "ChoiceFormat", javaLiteral(format.toPattern()))); ++ for (Object subformat : format.getFormats()) ++ print(depth + 1, subformat); ++ } ++ ++ private static String indent(int depth) { ++ StringBuilder buf = new StringBuilder(); ++ for (int i = 0; i < depth; i++) ++ buf.append(" "); ++ return buf.toString(); ++ } ++ ++ // Print a Java string in double quotes so it looks like a String literal (for easy pasting into jshell) ++ private static String javaLiteral(String string) { ++ StringBuilder buf = new StringBuilder(); ++ buf.append('"'); ++ for (int i = 0; i < string.length(); i++) { ++ char ch = string.charAt(i); ++ switch (ch) { ++ case '"': ++ case '\\': ++ buf.append('\\'); ++ // FALLTHROUGH ++ default: ++ buf.append(ch); ++ break; ++ } ++ } ++ return buf.append('"').toString(); ++ } ++} +diff --git a/test/jdk/java/text/Format/MessageFormat/MessageFormatsByArgumentIndex.java b/test/jdk/java/text/Format/MessageFormat/MessageFormatsByArgumentIndex.java +index 1d69258f6..b82d566d3 100644 +--- a/test/jdk/java/text/Format/MessageFormat/MessageFormatsByArgumentIndex.java ++++ b/test/jdk/java/text/Format/MessageFormat/MessageFormatsByArgumentIndex.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 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 +@@ -35,6 +35,7 @@ import java.text.NumberFormat; + public class MessageFormatsByArgumentIndex { + + private static String choicePattern = "0.0#are no files|1.0#is one file|1.0 JFR.start filename=dump.jfr + $ jcmd JFR.start filename=%s + $ jcmd JFR.start dumponexit=true +- $ jcmd JFR.start maxage=1h,maxsize=1000M ++ $ jcmd JFR.start maxage=1h maxsize=1000M + $ jcmd JFR.start settings=profile +- $ jcmd JFR.start delay=5m,settings=my.jfc ++ $ jcmd JFR.start delay=5m settings=my.jfc + $ jcmd JFR.start gc=high method-profiling=high + $ jcmd JFR.start jdk.JavaMonitorEnter#threshold=1ms + $ jcmd JFR.start +HelloWorld#enabled=true +HelloWorld#stackTrace=true +-- +2.33.0 + diff --git a/Backport-JDK-8326957-Implement-JEP-474-ZGC-Generatio.patch b/Backport-JDK-8326957-Implement-JEP-474-ZGC-Generatio.patch new file mode 100644 index 0000000..2e6333f --- /dev/null +++ b/Backport-JDK-8326957-Implement-JEP-474-ZGC-Generatio.patch @@ -0,0 +1,214 @@ +Subject: Backport JDK-8326957 Implement JEP 474: ZGC: Generational Mode by Default + +--- + src/hotspot/share/gc/shared/gc_globals.hpp | 4 +- + src/hotspot/share/gc/x/xArguments.cpp | 2 + + src/hotspot/share/gc/x/xInitialize.cpp | 2 +- + src/hotspot/share/runtime/arguments.cpp | 3 +- + test/hotspot/jtreg/gc/x/TestDeprecated.java | 50 ++++++++++++++++++ + test/hotspot/jtreg/gc/z/TestDefault.java | 51 +++++++++++++++++++ + .../CommandLine/VMDeprecatedOptions.java | 3 +- + 7 files changed, 110 insertions(+), 5 deletions(-) + create mode 100644 test/hotspot/jtreg/gc/x/TestDeprecated.java + create mode 100644 test/hotspot/jtreg/gc/z/TestDefault.java + +diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp +index 5d7202685..8e51632bd 100644 +--- a/src/hotspot/share/gc/shared/gc_globals.hpp ++++ b/src/hotspot/share/gc/shared/gc_globals.hpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2023, 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 +@@ -125,7 +125,7 @@ + product(bool, UseZGC, false, \ + "Use the Z garbage collector") \ + \ +- product(bool, ZGenerational, false, \ ++ product(bool, ZGenerational, true, \ + "Use the generational version of ZGC") \ + \ + product(bool, UseShenandoahGC, false, \ +diff --git a/src/hotspot/share/gc/x/xArguments.cpp b/src/hotspot/share/gc/x/xArguments.cpp +index 60e78d2c7..13cb302d1 100644 +--- a/src/hotspot/share/gc/x/xArguments.cpp ++++ b/src/hotspot/share/gc/x/xArguments.cpp +@@ -42,6 +42,8 @@ void XArguments::initialize_heap_flags_and_sizes() { + } + + void XArguments::initialize() { ++ warning("Non-generational ZGC is deprecated."); ++ + // Check mark stack size + const size_t mark_stack_space_limit = XAddressSpaceLimit::mark_stack(); + if (ZMarkStackSpaceLimit > mark_stack_space_limit) { +diff --git a/src/hotspot/share/gc/x/xInitialize.cpp b/src/hotspot/share/gc/x/xInitialize.cpp +index 01b79f3ff..156be1797 100644 +--- a/src/hotspot/share/gc/x/xInitialize.cpp ++++ b/src/hotspot/share/gc/x/xInitialize.cpp +@@ -41,7 +41,7 @@ XInitialize::XInitialize(XBarrierSet* barrier_set) { + log_info(gc, init)("Version: %s (%s)", + VM_Version::vm_release(), + VM_Version::jdk_debug_level()); +- log_info(gc, init)("Using legacy single-generation mode"); ++ log_info(gc, init)("Using deprecated non-generational mode"); + + // Early initialization + XAddress::initialize(); +diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp +index 720a0e9ba..9b8e5aa87 100644 +--- a/src/hotspot/share/runtime/arguments.cpp ++++ b/src/hotspot/share/runtime/arguments.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2023, 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 +@@ -500,6 +500,7 @@ static SpecialFlag const special_jvm_flags[] = { + { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, + { "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() }, + { "FlightRecorder", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() }, ++ { "ZGenerational", JDK_Version::jdk(21), JDK_Version::undefined(), JDK_Version::undefined() }, + { "DumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() }, + { "DynamicDumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() }, + { "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() }, +diff --git a/test/hotspot/jtreg/gc/x/TestDeprecated.java b/test/hotspot/jtreg/gc/x/TestDeprecated.java +new file mode 100644 +index 000000000..17e2e70f4 +--- /dev/null ++++ b/test/hotspot/jtreg/gc/x/TestDeprecated.java +@@ -0,0 +1,50 @@ ++/* ++ * 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. ++ */ ++ ++package gc.x; ++ ++/* ++ * @test TestDeprecated ++ * @requires vm.gc.ZSinglegen ++ * @summary Test ZGenerational Deprecated ++ * @library /test/lib ++ * @run driver gc.x.TestDeprecated ++ */ ++ ++import java.util.LinkedList; ++import jdk.test.lib.process.ProcessTools; ++ ++public class TestDeprecated { ++ static class Test { ++ public static void main(String[] args) throws Exception {} ++ } ++ public static void main(String[] args) throws Exception { ++ ProcessTools.executeLimitedTestJava("-XX:+UseZGC", ++ "-XX:-ZGenerational", ++ "-Xlog:gc+init", ++ Test.class.getName()) ++ .shouldContain("Option ZGenerational was deprecated") ++ .shouldContain("Using deprecated non-generational mode") ++ .shouldHaveExitValue(0); ++ } ++} +diff --git a/test/hotspot/jtreg/gc/z/TestDefault.java b/test/hotspot/jtreg/gc/z/TestDefault.java +new file mode 100644 +index 000000000..c693e8745 +--- /dev/null ++++ b/test/hotspot/jtreg/gc/z/TestDefault.java +@@ -0,0 +1,51 @@ ++/* ++ * 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. ++ */ ++ ++package gc.z; ++ ++/* ++ * @test TestDefault ++ * @requires vm.gc.ZGenerational ++ * @summary Test that ZGC Generational Mode is Default ++ * @library /test/lib ++ * @run driver gc.z.TestDefault ++ */ ++ ++import java.util.LinkedList; ++import jdk.test.lib.process.ProcessTools; ++ ++public class TestDefault { ++ static class Test { ++ public static void main(String[] args) throws Exception {} ++ } ++ public static void main(String[] args) throws Exception { ++ ProcessTools.executeLimitedTestJava("-XX:+UseZGC", ++ "-Xlog:gc+init", ++ Test.class.getName()) ++ .shouldNotContain("Option ZGenerational was deprecated") ++ .shouldNotContain("Using deprecated non-generational mode") ++ .shouldContain("GC Workers for Old Generation") ++ .shouldContain("GC Workers for Young Generation") ++ .shouldHaveExitValue(0); ++ } ++} +diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java +index 95dd88c72..0c9c2d6ea 100644 +--- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java ++++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2015, 2023, 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 +@@ -62,6 +62,7 @@ public class VMDeprecatedOptions { + {"InitialRAMFraction", "64"}, + {"TLABStats", "false"}, + {"AllowRedefinitionToAddDeleteMethods", "true"}, ++ {"ZGenerational", "false"}, + + // deprecated alias flags (see also aliased_jvm_flags): + {"DefaultMaxRAMFraction", "4"}, +-- +2.33.0 + diff --git a/Backport-JDK-8327538-The-SSLExtension-class-specifie.patch b/Backport-JDK-8327538-The-SSLExtension-class-specifie.patch new file mode 100644 index 0000000..2013062 --- /dev/null +++ b/Backport-JDK-8327538-The-SSLExtension-class-specifie.patch @@ -0,0 +1,38 @@ +Subject: Backport JDK-8327538 The SSLExtension class specifies incorrect values for heartbeat per RFC 6520 and post_handshake_auth per RFC 8446 + +--- + .../share/classes/sun/security/ssl/SSLExtension.java | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java +index 2a9239fac..2cb74fb10 100644 +--- a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java ++++ b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2018, 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 +@@ -181,7 +181,7 @@ enum SSLExtension implements SSLStringizer { + USE_SRTP (0x000E, "use_srtp"), + + // Extensions defined in RFC 6520 (TLS and DTLS Heartbeat Extension) +- HEARTBEAT (0x000E, "heartbeat"), ++ HEARTBEAT (0x000F, "heartbeat"), + + // Extensions defined in RFC 7301 (TLS Application-Layer Protocol Negotiation Extension) + CH_ALPN (0x0010, "application_layer_protocol_negotiation", +@@ -406,7 +406,7 @@ enum SSLExtension implements SSLStringizer { + CertificateAuthoritiesExtension.ssStringizer), + + OID_FILTERS (0x0030, "oid_filters"), +- POST_HANDSHAKE_AUTH (0x0030, "post_handshake_auth"), ++ POST_HANDSHAKE_AUTH (0x0031, "post_handshake_auth"), + + CH_SIGNATURE_ALGORITHMS_CERT (0x0032, "signature_algorithms_cert", + SSLHandshake.CLIENT_HELLO, +-- +2.33.0 + diff --git a/Backport-JDK-8328107-Shenandoah-C2-TestVerifyLoopOpt.patch b/Backport-JDK-8328107-Shenandoah-C2-TestVerifyLoopOpt.patch new file mode 100644 index 0000000..b6a4729 --- /dev/null +++ b/Backport-JDK-8328107-Shenandoah-C2-TestVerifyLoopOpt.patch @@ -0,0 +1,120 @@ +Subject: Backport JDK-8328107 Shenandoah/C2: TestVerifyLoopOptimizations test failure + +--- + .../gc/shenandoah/c2/shenandoahSupport.cpp | 8 ++ + .../compiler/TestBarrierOnLoopBackedge.java | 84 +++++++++++++++++++ + 2 files changed, 92 insertions(+) + create mode 100644 test/hotspot/jtreg/gc/shenandoah/compiler/TestBarrierOnLoopBackedge.java + +diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +index acf4b8f08..ce6403cb4 100644 +--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp ++++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +@@ -1321,6 +1321,14 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) { + OuterStripMinedLoopNode* outer = head->as_OuterStripMinedLoop(); + hide_strip_mined_loop(outer, outer->unique_ctrl_out()->as_CountedLoop(), phase); + } ++ if (head->is_BaseCountedLoop() && ctrl->is_IfProj() && ctrl->in(0)->is_BaseCountedLoopEnd() && ++ head->as_BaseCountedLoop()->loopexit() == ctrl->in(0)) { ++ Node* entry = head->in(LoopNode::EntryControl); ++ Node* backedge = head->in(LoopNode::LoopBackControl); ++ Node* new_head = new LoopNode(entry, backedge); ++ phase->register_control(new_head, phase->get_loop(entry), entry); ++ phase->lazy_replace(head, new_head); ++ } + } + + // Expand load-reference-barriers +diff --git a/test/hotspot/jtreg/gc/shenandoah/compiler/TestBarrierOnLoopBackedge.java b/test/hotspot/jtreg/gc/shenandoah/compiler/TestBarrierOnLoopBackedge.java +new file mode 100644 +index 000000000..a72c7d69d +--- /dev/null ++++ b/test/hotspot/jtreg/gc/shenandoah/compiler/TestBarrierOnLoopBackedge.java +@@ -0,0 +1,84 @@ ++/* ++ * 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 8328107 ++ * @summary Barrier expanded on backedge break loop verification code ++ * @requires vm.gc.Shenandoah ++ * ++ * @run main/othervm -XX:+UseShenandoahGC -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestBarrierOnLoopBackedge::notInlined ++ * -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyLoopOptimizations TestBarrierOnLoopBackedge ++ * @run main/othervm -XX:+UseShenandoahGC -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestBarrierOnLoopBackedge::notInlined ++ * -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyLoopOptimizations -XX:-UseCountedLoopSafepoints TestBarrierOnLoopBackedge ++ */ ++ ++public class TestBarrierOnLoopBackedge { ++ private static A field = new A(); ++ private static final A finalField = new A(); ++ private static float floatField; ++ ++ public static void main(String[] args) { ++ A[] array = new A[1]; ++ array[0] = finalField; ++ for (int i = 0; i < 20_000; i++) { ++ test1(); ++ test2(); ++ } ++ } ++ ++ private static void test1() { ++ floatField = field.f; ++ for (int i = 0; i < 1000; i++) { ++ notInlined(field); // load barrier split thru phi and ends up on back edge ++ if (i % 2 == 0) { ++ field = finalField; ++ } ++ } ++ } ++ ++ private static void test2() { ++ A[] array = new A[1]; ++ notInlined(array); ++ int i = 0; ++ A a = array[0]; ++ for (;;) { ++ synchronized (new Object()) { ++ } ++ notInlined(a); ++ i++; ++ if (i >= 1000) { ++ break; ++ } ++ a = array[0]; // load barrier pinned on backedge ++ } ++ } ++ ++ private static void notInlined(Object a) { ++ ++ } ++ ++ private static class A { ++ float f; ++ } ++} +-- +2.33.0 + diff --git a/Backport-JDK-8328553-Get-rid-of-JApplet-in-test-jdk-.patch b/Backport-JDK-8328553-Get-rid-of-JApplet-in-test-jdk-.patch new file mode 100644 index 0000000..009f689 --- /dev/null +++ b/Backport-JDK-8328553-Get-rid-of-JApplet-in-test-jdk-.patch @@ -0,0 +1,54 @@ +Subject: Backport JDK-8328553 Get rid of JApplet in test/jdk/sanity/client/lib/SwingSet2/src/DemoModule.java + +--- + .../client/lib/SwingSet2/src/DemoModule.java | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +diff --git a/test/jdk/sanity/client/lib/SwingSet2/src/DemoModule.java b/test/jdk/sanity/client/lib/SwingSet2/src/DemoModule.java +index 3511583e9..0e7c71083 100644 +--- a/test/jdk/sanity/client/lib/SwingSet2/src/DemoModule.java ++++ b/test/jdk/sanity/client/lib/SwingSet2/src/DemoModule.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2018, 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 +@@ -31,7 +31,6 @@ import java.net.URL; + import javax.swing.BoxLayout; + import javax.swing.Icon; + import javax.swing.ImageIcon; +-import javax.swing.JApplet; + import javax.swing.JFrame; + import javax.swing.JPanel; + import javax.swing.UIManager; +@@ -42,10 +41,8 @@ import javax.swing.border.SoftBevelBorder; + + /** + * A generic SwingSet2 demo module +- * +- * @author Jeff Dinkins + */ +-public class DemoModule extends JApplet { ++public class DemoModule extends JPanel { + + // The preferred size of the demo + private int PREFERRED_WIDTH = 680; +@@ -214,10 +211,6 @@ public class DemoModule extends JApplet { + demo.mainImpl(); + } + +- public void init() { +- getContentPane().setLayout(new BorderLayout()); +- getContentPane().add(getDemoPanel(), BorderLayout.CENTER); +- } +- + void updateDragEnabled(boolean dragEnabled) {} +-} +\ No newline at end of file ++} ++ +-- +2.33.0 + diff --git a/Backport-JDK-8329174-update-CodeBuffer-layout-in-com.patch b/Backport-JDK-8329174-update-CodeBuffer-layout-in-com.patch new file mode 100644 index 0000000..93822b8 --- /dev/null +++ b/Backport-JDK-8329174-update-CodeBuffer-layout-in-com.patch @@ -0,0 +1,57 @@ +Subject: Backport JDK-8329174 update CodeBuffer layout in comment after constants section moved + +--- + src/hotspot/share/asm/codeBuffer.cpp | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +diff --git a/src/hotspot/share/asm/codeBuffer.cpp b/src/hotspot/share/asm/codeBuffer.cpp +index ab8aed1cb..4bc33cc89 100644 +--- a/src/hotspot/share/asm/codeBuffer.cpp ++++ b/src/hotspot/share/asm/codeBuffer.cpp +@@ -24,6 +24,7 @@ + + #include "precompiled.hpp" + #include "asm/codeBuffer.hpp" ++#include "code/compiledIC.hpp" + #include "code/oopRecorder.inline.hpp" + #include "compiler/disassembler.hpp" + #include "logging/log.hpp" +@@ -65,7 +66,11 @@ + // The structure of the CodeBuffer while code is being accumulated: + // + // _total_start -> \ +-// _insts._start -> +----------------+ ++// _consts._start -> +----------------+ ++// | | ++// | Constants | ++// | | ++// _insts._start -> |----------------| + // | | + // | Code | + // | | +@@ -73,10 +78,6 @@ + // | | + // | Stubs | (also handlers for deopt/exception) + // | | +-// _consts._start -> |----------------| +-// | | +-// | Constants | +-// | | + // +----------------+ + // + _total_size -> | | + // +@@ -1061,11 +1062,6 @@ void CodeSection::print(const char* name) { + } + + void CodeBuffer::print() { +- if (this == nullptr) { +- tty->print_cr("null CodeBuffer pointer"); +- return; +- } +- + tty->print_cr("CodeBuffer:"); + for (int n = 0; n < (int)SECT_LIMIT; n++) { + // print each section +-- +2.33.0 + diff --git a/Backport-JDK-8329754-The-ThreadSafe-attribute-is-ign.patch b/Backport-JDK-8329754-The-ThreadSafe-attribute-is-ign.patch new file mode 100644 index 0000000..7cf8f2a --- /dev/null +++ b/Backport-JDK-8329754-The-ThreadSafe-attribute-is-ign.patch @@ -0,0 +1,143 @@ +Subject: Backport JDK-8329754 The ThreadSafe attribute is ignored for SecureRandom algorithm aliases + +--- + .../classes/java/security/SecureRandom.java | 6 +- + .../security/SecureRandom/ThreadSafe.java | 55 +++++++++++++------ + 2 files changed, 41 insertions(+), 20 deletions(-) + +diff --git a/src/java.base/share/classes/java/security/SecureRandom.java b/src/java.base/share/classes/java/security/SecureRandom.java +index 6a1683e99..36e71cf54 100644 +--- a/src/java.base/share/classes/java/security/SecureRandom.java ++++ b/src/java.base/share/classes/java/security/SecureRandom.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 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 +@@ -230,8 +230,8 @@ public class SecureRandom extends java.util.Random { + if (provider == null || algorithm == null) { + return false; + } else { +- return Boolean.parseBoolean(provider.getProperty( +- "SecureRandom." + algorithm + " ThreadSafe", "false")); ++ Service service = provider.getService("SecureRandom", algorithm); ++ return Boolean.parseBoolean(service.getAttribute("ThreadSafe")); + } + } + +diff --git a/test/jdk/java/security/SecureRandom/ThreadSafe.java b/test/jdk/java/security/SecureRandom/ThreadSafe.java +index 174f3253c..b0975678e 100644 +--- a/test/jdk/java/security/SecureRandom/ThreadSafe.java ++++ b/test/jdk/java/security/SecureRandom/ThreadSafe.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -21,33 +21,46 @@ + * questions. + */ + ++import static jdk.test.lib.Utils.runAndCheckException; ++ ++import java.lang.Override; + import java.security.Provider; + import java.security.SecureRandom; + import java.security.SecureRandomSpi; ++import java.util.List; + import java.util.Map; + + /* + * @test +- * @bug 7004967 ++ * @library /test/lib ++ * @bug 7004967 8329754 + * @summary SecureRandom should be more explicit about threading + */ ++ + public class ThreadSafe { + public static void main(String[] args) throws Exception { + Provider p = new P(); + NoSync.test(SecureRandom.getInstance("S1", p), 5, 5); +- try { +- NoSync.test(SecureRandom.getInstance("S2", p), 5, 5); +- throw new Exception("Failed"); +- } catch (RuntimeException re) { +- // Good +- } ++ NoSync.test(SecureRandom.getInstance("AliasS1", p), 5, 5); ++ ++ runAndCheckException( ++ () -> NoSync.test(SecureRandom.getInstance("S2", p), 5, 5), ++ RuntimeException.class); ++ ++ runAndCheckException( ++ () -> NoSync.test(SecureRandom.getInstance("AliasS2", p), 5, 5), ++ RuntimeException.class); ++ + NoSync.test(SecureRandom.getInstance("S3", p), 5, 5); +- try { +- NoSync.test(SecureRandom.getInstance("S4", p), 5, 5); +- throw new Exception("Failed"); +- } catch (RuntimeException re) { +- // Good +- } ++ NoSync.test(SecureRandom.getInstance("AliasS3", p), 5, 5); ++ ++ runAndCheckException( ++ () -> NoSync.test(SecureRandom.getInstance("S4", p), 5, 5), ++ RuntimeException.class); ++ ++ runAndCheckException( ++ () -> NoSync.test(SecureRandom.getInstance("AliasS4", p), 5, 5), ++ RuntimeException.class); + } + + public static class P extends Provider { +@@ -58,28 +71,36 @@ public class ThreadSafe { + // Good. No attribute. + put("SecureRandom.S1", S.class.getName()); + ++ // Good. Alias of S1, should pass because S1 is not marked as ThreadSafe ++ put("Alg.alias.SecureRandom.AliasS1", "S1"); ++ + // Bad. Boasting ThreadSafe but isn't + put("SecureRandom.S2", S.class.getName()); + put("SecureRandom.S2 ThreadSafe", "true"); + ++ //Bad. Alias of S2, should fail because S2 is marked as ThreadSafe ++ put("alg.Alias.SecureRandom.AliasS2", "S2"); ++ + // Good. No attribute. + putService(new Service(this, "SecureRandom", "S3", +- S.class.getName(), null, null)); ++ S.class.getName(), List.of("AliasS3"), null)); + + // Bad. Boasting ThreadSafe but isn't + putService(new Service(this, "SecureRandom", "S4", +- S.class.getName(), null, Map.of("ThreadSafe", "true"))); ++ S.class.getName(), List.of("AliasS4"), Map.of("ThreadSafe", "true"))); + } + } + + // This implementation is not itself thread safe. + public static class S extends SecureRandomSpi { +- @java.lang.Override ++ ++ @Override + protected void engineSetSeed(byte[] seed) { + return; + } + + private volatile boolean inCall = false; ++ + @Override + protected void engineNextBytes(byte[] bytes) { + if (inCall) { +-- +2.33.0 + diff --git a/Backport-JDK-8331391-Enhance-the-keytool-code-by-inv.patch b/Backport-JDK-8331391-Enhance-the-keytool-code-by-inv.patch new file mode 100644 index 0000000..de4396b --- /dev/null +++ b/Backport-JDK-8331391-Enhance-the-keytool-code-by-inv.patch @@ -0,0 +1,36 @@ +Subject: Backport JDK-8331391 Enhance the keytool code by invoking the buildTrustedCerts method for essential options + +--- + .../share/classes/sun/security/tools/keytool/Main.java | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/src/java.base/share/classes/sun/security/tools/keytool/Main.java +index edb0b4195..3e2e5dec2 100644 +--- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java ++++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2023, 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 +@@ -1119,7 +1119,6 @@ public final class Main { + } + } + +- KeyStore cakstore = buildTrustedCerts(); + // -trustcacerts can be specified on -importcert, -printcert or -printcrl. + // Reset it so that warnings on CA cert will remain for other command. + if (command != IMPORTCERT && command != PRINTCERT +@@ -1128,6 +1127,7 @@ public final class Main { + } + + if (trustcacerts) { ++ KeyStore cakstore = buildTrustedCerts(); + if (cakstore != null) { + caks = cakstore; + } else { +-- +2.33.0 + diff --git a/Backport-JDK-8332297-annotation-processor-that-gener.patch b/Backport-JDK-8332297-annotation-processor-that-gener.patch new file mode 100644 index 0000000..e49784c --- /dev/null +++ b/Backport-JDK-8332297-annotation-processor-that-gener.patch @@ -0,0 +1,183 @@ +Subject: Backport JDK-8332297 annotation processor that generates records sometimes fails due to NPE in javac + +--- + .../com/sun/tools/javac/code/Symbol.java | 6 +- + .../processing/RecordGenerationTest.java | 148 ++++++++++++++++++ + 2 files changed, 152 insertions(+), 2 deletions(-) + create mode 100644 test/langtools/tools/javac/processing/RecordGenerationTest.java + +diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java +index 7a939abb3..3438756be 100644 +--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java ++++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java +@@ -1549,9 +1549,11 @@ public abstract class Symbol extends AnnoConstruct implements PoolConstant, Elem + RecordComponent toRemove = null; + for (RecordComponent rc : recordComponents) { + /* it could be that a record erroneously declares two record components with the same name, in that +- * case we need to use the position to disambiguate ++ * case we need to use the position to disambiguate, but if we loaded the record from a class file ++ * all positions will be -1, in that case we have to ignore the position and match only based on the ++ * name + */ +- if (rc.name == var.name && var.pos == rc.pos) { ++ if (rc.name == var.name && (var.pos == rc.pos || rc.pos == -1)) { + toRemove = rc; + } + } +diff --git a/test/langtools/tools/javac/processing/RecordGenerationTest.java b/test/langtools/tools/javac/processing/RecordGenerationTest.java +new file mode 100644 +index 000000000..9ee28d264 +--- /dev/null ++++ b/test/langtools/tools/javac/processing/RecordGenerationTest.java +@@ -0,0 +1,148 @@ ++/* ++ * 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 8332297 ++ * @summary annotation processor that generates records sometimes fails due to NPE in javac ++ * @library /tools/lib /tools/javac/lib ++ * @modules jdk.compiler/com.sun.tools.javac.api ++ * jdk.compiler/com.sun.tools.javac.main ++ * @build toolbox.ToolBox toolbox.JavacTask toolbox.Task ++ * @build RecordGenerationTest JavacTestingAbstractProcessor ++ * @run main RecordGenerationTest ++ */ ++ ++import java.io.IOException; ++import java.io.OutputStream; ++import java.io.Writer; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.nio.file.Paths; ++import java.util.Set; ++ ++import javax.annotation.processing.FilerException; ++import javax.annotation.processing.RoundEnvironment; ++import javax.annotation.processing.SupportedOptions; ++import javax.annotation.processing.SupportedAnnotationTypes; ++ ++import javax.lang.model.element.TypeElement; ++import javax.tools.StandardLocation; ++ ++import toolbox.JavacTask; ++import toolbox.Task; ++import toolbox.ToolBox; ++ ++public class RecordGenerationTest { ++ public static void main(String... args) throws Exception { ++ new RecordGenerationTest().run(); ++ } ++ ++ Path[] findJavaFiles(Path... paths) throws Exception { ++ return tb.findJavaFiles(paths); ++ } ++ ++ ToolBox tb = new ToolBox(); ++ ++ void run() throws Exception { ++ Path allInOne = Paths.get("allInOne"); ++ if (Files.isDirectory(allInOne)) { ++ tb.cleanDirectory(allInOne); ++ } ++ Files.deleteIfExists(allInOne); ++ tb.createDirectories(allInOne); ++ ++ tb.writeJavaFiles(allInOne, ++ """ ++ import java.io.IOException; ++ import java.io.OutputStream; ++ import java.io.Writer; ++ import java.nio.file.Files; ++ import java.nio.file.Path; ++ import java.nio.file.Paths; ++ import java.util.Set; ++ ++ import javax.annotation.processing.AbstractProcessor; ++ import javax.annotation.processing.FilerException; ++ import javax.annotation.processing.RoundEnvironment; ++ import javax.annotation.processing.SupportedOptions; ++ import javax.annotation.processing.SupportedAnnotationTypes; ++ ++ import javax.lang.model.element.TypeElement; ++ import javax.tools.StandardLocation; ++ ++ @SupportedAnnotationTypes("*") ++ public class AP extends AbstractProcessor { ++ @Override ++ public boolean process(Set annotations, RoundEnvironment roundEnv) { ++ if (roundEnv.processingOver()) { ++ try (Writer w = processingEnv.getFiler().createSourceFile("ConfRecord").openWriter()) { ++ w.append("@RecordBuilder public record ConfRecord(int maxConcurrency) implements Conf {}"); ++ } catch (IOException ex) { ++ throw new IllegalStateException(ex); ++ } ++ } ++ return true; ++ } ++ } ++ """ ++ ); ++ ++ new JavacTask(tb).options("-d", allInOne.toString()) ++ .files(findJavaFiles(allInOne)) ++ .run() ++ .writeAll(); ++ ++ tb.writeJavaFiles(allInOne, ++ """ ++ interface Conf { ++ int maxConcurrency( ); ++ } ++ """, ++ """ ++ import java.lang.annotation.*; ++ public @interface RecordBuilder { ++ } ++ """ ++ ); ++ ++ Path confSource = Paths.get(allInOne.toString(), "Conf.java"); ++ new JavacTask(tb).options("-processor", "AP", ++ "-cp", allInOne.toString(), ++ "-d", allInOne.toString()) ++ .files(confSource) ++ .run() ++ .writeAll(); ++ ++ /* the bug reported at JDK-8332297 was reproducible only every other time this is why we reproduce ++ * the same compilation command as above basically the second time the compiler is completing the ++ * record symbol from the class file produced during the first compilation ++ */ ++ new JavacTask(tb).options("-processor", "AP", ++ "-cp", allInOne.toString(), ++ "-d", allInOne.toString()) ++ .files(confSource) ++ .run() ++ .writeAll(); ++ } ++} +-- +2.33.0 + diff --git a/Backport-JDK-8332524-Instead-of-printing-TLSv1.3,-.patch b/Backport-JDK-8332524-Instead-of-printing-TLSv1.3,-.patch new file mode 100644 index 0000000..a031562 --- /dev/null +++ b/Backport-JDK-8332524-Instead-of-printing-TLSv1.3,-.patch @@ -0,0 +1,31 @@ +Subject: Backport of JDK-8332524: Instead of printing "TLSv1.3," it is showing "TLS13" + +--- + .../share/classes/sun/security/ssl/ClientHello.java | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/java.base/share/classes/sun/security/ssl/ClientHello.java b/src/java.base/share/classes/sun/security/ssl/ClientHello.java +index 091bfa898..fa9bf0440 100644 +--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java ++++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.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 +@@ -903,8 +903,8 @@ final class ClientHello { + throw context.conContext.fatal(Alert.PROTOCOL_VERSION, + "The client supported protocol versions " + Arrays.toString( + ProtocolVersion.toStringArray(clientSupportedVersions)) + +- " are not accepted by server preferences " + +- context.activeProtocols); ++ " are not accepted by server preferences " + Arrays.toString( ++ ProtocolVersion.toStringArray(context.activeProtocols))); + } + } + +-- +2.33.0 + diff --git a/Backport-JDK-8332818-ubsan-archiveHeapLoader.cpp:70:.patch b/Backport-JDK-8332818-ubsan-archiveHeapLoader.cpp:70:.patch new file mode 100644 index 0000000..950de5e --- /dev/null +++ b/Backport-JDK-8332818-ubsan-archiveHeapLoader.cpp:70:.patch @@ -0,0 +1,23 @@ +Subject: Backport of JDK-8332818: ubsan: archiveHeapLoader.cpp:70:27: runtime error: applying non-zero offset 18446744073707454464 to null pointer + +--- + src/hotspot/share/cds/archiveHeapLoader.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/hotspot/share/cds/archiveHeapLoader.cpp b/src/hotspot/share/cds/archiveHeapLoader.cpp +index 28d2718b7..ecd65e952 100644 +--- a/src/hotspot/share/cds/archiveHeapLoader.cpp ++++ b/src/hotspot/share/cds/archiveHeapLoader.cpp +@@ -59,6 +59,9 @@ ptrdiff_t ArchiveHeapLoader::_mapped_heap_delta = 0; + + // Every mapped region is offset by _mapped_heap_delta from its requested address. + // See FileMapInfo::heap_region_requested_address(). ++#if defined(__clang__) || defined(__GNUC__) ++__attribute__((no_sanitize("undefined"))) ++#endif + void ArchiveHeapLoader::init_mapped_heap_relocation(ptrdiff_t delta, int dumptime_oop_shift) { + assert(!_mapped_heap_relocation_initialized, "only once"); + if (!UseCompressedOops) { +-- +2.33.0 + diff --git a/Backport-JDK-8332866-Crash-in-ImageIO-JPEG-decoding-.patch b/Backport-JDK-8332866-Crash-in-ImageIO-JPEG-decoding-.patch new file mode 100644 index 0000000..bea0d59 --- /dev/null +++ b/Backport-JDK-8332866-Crash-in-ImageIO-JPEG-decoding-.patch @@ -0,0 +1,38 @@ +Subject: Backport JDK-8332866 Crash in ImageIO JPEG decoding when MEM_STATS in enabled + +--- + src/java.desktop/share/native/libjavajpeg/imageioJPEG.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c b/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c +index c4c38dc0f..b4281458d 100644 +--- a/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c ++++ b/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 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 +@@ -666,8 +666,6 @@ static void imageio_reset(JNIEnv *env, + static void imageio_dispose(j_common_ptr info) { + + if (info != NULL) { +- free(info->err); +- info->err = NULL; + if (info->is_decompressor) { + j_decompress_ptr dinfo = (j_decompress_ptr) info; + free(dinfo->src); +@@ -678,6 +676,8 @@ static void imageio_dispose(j_common_ptr info) { + cinfo->dest = NULL; + } + jpeg_destroy(info); ++ free(info->err); ++ info->err = NULL; + free(info); + } + } +-- +2.33.0 + diff --git a/Backport-JDK-8332920-C2-Partial-Peeling-is-wrongly-a.patch b/Backport-JDK-8332920-C2-Partial-Peeling-is-wrongly-a.patch new file mode 100644 index 0000000..783d7ba --- /dev/null +++ b/Backport-JDK-8332920-C2-Partial-Peeling-is-wrongly-a.patch @@ -0,0 +1,590 @@ +Subject: Backport JDK-8332920 C2: Partial Peeling is wrongly applied for CmpU with negative limit + +--- + src/hotspot/share/opto/loopopts.cpp | 204 +++++++++-- + ...rtialPeelAtUnsignedTestsNegativeLimit.java | 327 ++++++++++++++++++ + 2 files changed, 493 insertions(+), 38 deletions(-) + create mode 100644 test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java + +diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp +index be9f5599d..2f32ca9bd 100644 +--- a/src/hotspot/share/opto/loopopts.cpp ++++ b/src/hotspot/share/opto/loopopts.cpp +@@ -2881,52 +2881,101 @@ RegionNode* PhaseIdealLoop::insert_region_before_proj(ProjNode* proj) { + return reg; + } + +-//------------------------------ insert_cmpi_loop_exit ------------------------------------- +-// Clone a signed compare loop exit from an unsigned compare and +-// insert it before the unsigned cmp on the stay-in-loop path. +-// All new nodes inserted in the dominator tree between the original +-// if and it's projections. The original if test is replaced with +-// a constant to force the stay-in-loop path. ++// Idea ++// ---- ++// Partial Peeling tries to rotate the loop in such a way that it can later be turned into a counted loop. Counted loops ++// require a signed loop exit test. When calling this method, we've only found a suitable unsigned test to partial peel ++// with. Therefore, we try to split off a signed loop exit test from the unsigned test such that it can be used as new ++// loop exit while keeping the unsigned test unchanged and preserving the same behavior as if we've used the unsigned ++// test alone instead: + // +-// This is done to make sure that the original if and it's projections +-// still dominate the same set of control nodes, that the ctrl() relation +-// from data nodes to them is preserved, and that their loop nesting is +-// preserved. ++// Before Partial Peeling: ++// Loop: ++// ++// Split off signed loop exit test ++// <-- CUT HERE --> ++// Unchanged unsigned loop exit test ++// ++// goto Loop + // +-// before +-// if(i ++// Cloned split off signed loop exit test ++// Loop: ++// Unchanged unsigned loop exit test ++// ++// ++// Split off signed loop exit test ++// goto Loop ++// ++// Details ++// ------- ++// Before: ++// if (i in(1)->as_Bool(); +- if (bol->_test._test != BoolTest::lt) return nullptr; ++ if (bol->_test._test != BoolTest::lt) { ++ return nullptr; ++ } + CmpNode* cmpu = bol->in(1)->as_Cmp(); +- if (cmpu->Opcode() != Op_CmpU) return nullptr; ++ assert(cmpu->Opcode() == Op_CmpU, "must be unsigned comparison"); ++ + int stride = stride_of_possible_iv(if_cmpu); +- if (stride == 0) return nullptr; ++ if (stride == 0) { ++ return nullptr; ++ } + + Node* lp_proj = stay_in_loop(if_cmpu, loop); + guarantee(lp_proj != nullptr, "null loop node"); +@@ -2938,14 +2987,93 @@ IfNode* PhaseIdealLoop::insert_cmpi_loop_exit(IfNode* if_cmpu, IdealLoopTree *lo + // We therefore can't add a single exit condition. + return nullptr; + } +- // The loop exit condition is !(i (i < 0 || i >= limit). +- // Split out the exit condition (i < 0) for stride < 0 or (i >= limit) for stride > 0. +- Node* limit = nullptr; ++ // The unsigned loop exit condition is ++ // !(i =u limit ++ // ++ // First, we note that for any x for which ++ // 0 <= x <= INT_MAX ++ // we can convert x to an unsigned int and still get the same guarantee: ++ // 0 <= (uint) x <= INT_MAX = (uint) INT_MAX ++ // 0 <=u (uint) x <=u INT_MAX = (uint) INT_MAX (LEMMA) ++ // ++ // With that in mind, if ++ // limit >= 0 (COND) ++ // then the unsigned loop exit condition ++ // i >=u limit (ULE) ++ // is equivalent to ++ // i < 0 || i >= limit (SLE-full) ++ // because either i is negative and therefore always greater than MAX_INT when converting to unsigned ++ // (uint) i >=u MAX_INT >= limit >= 0 ++ // or otherwise ++ // i >= limit >= 0 ++ // holds due to (LEMMA). ++ // ++ // For completeness, a counterexample with limit < 0: ++ // Assume i = -3 and limit = -2: ++ // i < 0 ++ // -2 < 0 ++ // is true and thus also "i < 0 || i >= limit". But ++ // i >=u limit ++ // -3 >=u -2 ++ // is false. ++ Node* limit = cmpu->in(2); ++ const TypeInt* type_limit = _igvn.type(limit)->is_int(); ++ if (type_limit->_lo < 0) { ++ return nullptr; ++ } ++ ++ // We prove below that we can extract a single signed loop exit condition from (SLE-full), depending on the stride: ++ // stride < 0: ++ // i < 0 (SLE = SLE-negative) ++ // stride > 0: ++ // i >= limit (SLE = SLE-positive) ++ // such that we have the following graph before Partial Peeling with stride > 0 (similar for stride < 0): ++ // ++ // Loop: ++ // ++ // i >= limit (SLE-positive) ++ // <-- CUT HERE --> ++ // i >=u limit (ULE) ++ // ++ // goto Loop ++ // ++ // We exit the loop if: ++ // (SLE) is true OR (ULE) is true ++ // However, if (SLE) is true then (ULE) also needs to be true to ensure the exact same behavior. Otherwise, we wrongly ++ // exit a loop that should not have been exited if we did not apply Partial Peeling. More formally, we need to ensure: ++ // (SLE) IMPLIES (ULE) ++ // This indeed holds when (COND) is given: ++ // - stride > 0: ++ // i >= limit // (SLE = SLE-positive) ++ // i >= limit >= 0 // (COND) ++ // i >=u limit >= 0 // (LEMMA) ++ // which is the unsigned loop exit condition (ULE). ++ // - stride < 0: ++ // i < 0 // (SLE = SLE-negative) ++ // (uint) i >u MAX_INT // (NEG) all negative values are greater than MAX_INT when converted to unsigned ++ // MAX_INT >= limit >= 0 // (COND) ++ // MAX_INT >=u limit >= 0 // (LEMMA) ++ // and thus from (NEG) and (LEMMA): ++ // i >=u limit ++ // which is the unsigned loop exit condition (ULE). ++ // ++ // ++ // After Partial Peeling, we have the following structure for stride > 0 (similar for stride < 0): ++ // ++ // i >= limit (SLE-positive) ++ // Loop: ++ // i >=u limit (ULE) ++ // ++ // ++ // i >= limit (SLE-positive) ++ // goto Loop ++ Node* rhs_cmpi; + if (stride > 0) { +- limit = cmpu->in(2); ++ rhs_cmpi = limit; // For i >= limit + } else { +- limit = _igvn.makecon(TypeInt::ZERO); +- set_ctrl(limit, C->root()); ++ rhs_cmpi = _igvn.makecon(TypeInt::ZERO); // For i < 0 ++ set_ctrl(rhs_cmpi, C->root()); + } + // Create a new region on the exit path + RegionNode* reg = insert_region_before_proj(lp_exit); +@@ -2953,7 +3081,7 @@ IfNode* PhaseIdealLoop::insert_cmpi_loop_exit(IfNode* if_cmpu, IdealLoopTree *lo + + // Clone the if-cmpu-true-false using a signed compare + BoolTest::mask rel_i = stride > 0 ? bol->_test._test : BoolTest::ge; +- ProjNode* cmpi_exit = insert_if_before_proj(cmpu->in(1), Signed, rel_i, limit, lp_continue); ++ ProjNode* cmpi_exit = insert_if_before_proj(cmpu->in(1), Signed, rel_i, rhs_cmpi, lp_continue); + reg->add_req(cmpi_exit); + + // Clone the if-cmpu-true-false +diff --git a/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java b/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java +new file mode 100644 +index 000000000..7809f79ce +--- /dev/null ++++ b/test/hotspot/jtreg/compiler/loopopts/TestPartialPeelAtUnsignedTestsNegativeLimit.java +@@ -0,0 +1,327 @@ ++/* ++ * 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=Xbatch ++ * @bug 8332920 ++ * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". ++ * @run main/othervm -Xbatch -XX:-TieredCompilation ++ * -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::test* ++ * compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit ++ */ ++ ++/* ++ * @test id=Xcomp-run-inline ++ * @bug 8332920 ++ * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". ++ * @run main/othervm -Xcomp -XX:-TieredCompilation ++ * -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::run*,*TestPartialPeel*::test* ++ * -XX:CompileCommand=inline,*TestPartialPeelAtUnsignedTestsNegativeLimit::test* ++ * -XX:CompileCommand=dontinline,*TestPartialPeelAtUnsignedTestsNegativeLimit::check ++ * compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit ++ */ ++ ++/* ++ * @test id=Xcomp-compile-test ++ * @bug 8332920 ++ * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". ++ * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=*TestPartialPeel*::original*,*TestPartialPeel*::test* ++ * compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit ++ */ ++ ++/* ++ * @test id=vanilla ++ * @bug 8332920 ++ * @requires vm.flavor == "server" & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 4) ++ * @summary Tests partial peeling at unsigned tests with limit being negative in exit tests "i >u limit". ++ * Only run this test with C2 since it is time-consuming and only tests a C2 issue. ++ * @run main compiler.loopopts.TestPartialPeelAtUnsignedTestsNegativeLimit ++ */ ++ ++package compiler.loopopts; ++ ++import java.util.Random; ++ ++import static java.lang.Integer.*; ++ ++public class TestPartialPeelAtUnsignedTestsNegativeLimit { ++ static int iFld = 10000; ++ static int iterations = 0; ++ static int iFld2; ++ static boolean flag; ++ final static Random RANDOM = new Random(); ++ ++ public static void main(String[] args) { ++ compareUnsigned(3, 3); // Load Integer class for -Xcomp ++ for (int i = 0; i < 2; i++) { ++ if (!originalTest()) { ++ throw new RuntimeException("originalTest() failed"); ++ } ++ } ++ ++ for (int i = 0; i < 2000; i++) { ++ // For profiling ++ iFld = -1; ++ originalTestVariation1(); ++ ++ // Actual run ++ iFld = MAX_VALUE - 100_000; ++ if (!originalTestVariation1()) { ++ throw new RuntimeException("originalTestVariation1() failed"); ++ } ++ } ++ ++ for (int i = 0; i < 2000; ++i) { ++ // For profiling ++ iFld = MAX_VALUE; ++ originalTestVariation2(); ++ ++ // Actual run ++ iFld = MIN_VALUE + 100000; ++ if (!originalTestVariation2()) { ++ throw new RuntimeException("originalTestVariation2() failed"); ++ } ++ } ++ ++ runWhileLTIncr(); ++ runWhileLTDecr(); ++ } ++ ++ // Originally reported simplified regression test with 2 variations (see below). ++ public static boolean originalTest() { ++ for (int i = MAX_VALUE - 50_000; compareUnsigned(i, -1) < 0; i++) { ++ if (compareUnsigned(MIN_VALUE, i) < 0) { ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ public static boolean originalTestVariation1() { ++ int a = 0; ++ for (int i = iFld; compareUnsigned(i, -1) < 0; ++i) { // i = Integer.MIN_VALUE + 1 && i <= 100) { // Transformed to unsigned test. ++ return true; ++ } ++ a *= 23; ++ } ++ return false; ++ } ++ ++ public static boolean originalTestVariation2() { ++ int a = 0; ++ for (int i = iFld; compareUnsigned(i, -1000) < 0; i--) { // i 0) { ++ return true; ++ } ++ a = i; ++ } ++ System.out.println(a); ++ return false; ++ } ++ ++ ++ public static void testWhileLTIncr(int init, int limit) { ++ int i = init; ++ while (true) { ++ // ++ ++ // Found as loop head in ciTypeFlow, but both paths inside loop -> head not cloned. ++ // As a result, this head has the safepoint as backedge instead of the loop exit test ++ // and we cannot create a counted loop (yet). We first need to partial peel. ++ if (flag) { ++ } ++ ++ iFld2++; ++ ++ // Loop exit test i >=u limit (i.e. "while (i = limit && i >=u limit ++ // where the signed condition can be used as proper loop exit condition for a counted loop ++ // (we cannot use an unsigned counted loop exit condition). ++ // ++ // After Partial Peeling, we have: ++ // if (i >= limit) goto Exit ++ // Loop: ++ // if (i >=u limit) goto Exit ++ // ... ++ // i++; ++ // if (i >= limit) goto Exit ++ // goto Loop ++ // Exit: ++ // ... ++ // ++ // If init = MAX_VALUE and limit = MIN_VALUE: ++ // i >= limit ++ // MAX_VALUE >= MIN_VALUE ++ // which is true where ++ // i >=u limit ++ // MAX_VALUE >=u MIN_VALUE ++ // MAX_VALUE >=u (uint)(MAX_INT + 1) ++ // is false and we wrongly never enter the loop even though we should have. ++ // This results in a wrong execution. ++ if (compareUnsigned(i, limit) >= 0) { ++ return; ++ } ++ // <-- Partial Peeling CUT --> ++ // Safepoint ++ // ++ iterations++; ++ i++; ++ } ++ } ++ ++ // Same as testWhileLTIncr() but with decrement instead. ++ public static void testWhileLTDecr(int init, int limit) { ++ int i = init; ++ while (true) { ++ if (flag) { ++ } ++ ++ // Loop exit test. ++ if (compareUnsigned(i, limit) >= 0) { // While (i 0) { + // we have contending and/or waiting threads +-- +2.33.0 + diff --git a/Backport-JDK-8333354-ubsan-frame.inline.hpp:91:25:-a.patch b/Backport-JDK-8333354-ubsan-frame.inline.hpp:91:25:-a.patch new file mode 100644 index 0000000..940d370 --- /dev/null +++ b/Backport-JDK-8333354-ubsan-frame.inline.hpp:91:25:-a.patch @@ -0,0 +1,370 @@ +Subject: Backport of JDK-8333354 ubsan: frame.inline.hpp:91:25: and src/hotspot/share/runtime/frame.inline.hpp:88:29: runtime error: member call on null pointer of type 'const struct SmallRegisterMap' + +--- + .../smallRegisterMap_aarch64.inline.hpp | 20 +++++++---------- + .../cpu/arm/smallRegisterMap_arm.inline.hpp | 15 +++++++------ + .../cpu/ppc/smallRegisterMap_ppc.inline.hpp | 22 +++++++------------ + .../riscv/smallRegisterMap_riscv.inline.hpp | 20 +++++++---------- + .../cpu/s390/smallRegisterMap_s390.inline.hpp | 15 +++++++------ + .../cpu/x86/smallRegisterMap_x86.inline.hpp | 19 ++++++---------- + .../cpu/zero/smallRegisterMap_zero.inline.hpp | 15 +++++++------ + src/hotspot/share/oops/stackChunkOop.cpp | 2 +- + .../share/oops/stackChunkOop.inline.hpp | 2 +- + .../share/runtime/continuationFreezeThaw.cpp | 14 ++++++------ + 10 files changed, 64 insertions(+), 80 deletions(-) + +diff --git a/src/hotspot/cpu/aarch64/smallRegisterMap_aarch64.inline.hpp b/src/hotspot/cpu/aarch64/smallRegisterMap_aarch64.inline.hpp +index db38b9cf5..dcba233c9 100644 +--- a/src/hotspot/cpu/aarch64/smallRegisterMap_aarch64.inline.hpp ++++ b/src/hotspot/cpu/aarch64/smallRegisterMap_aarch64.inline.hpp +@@ -30,8 +30,15 @@ + + // Java frames don't have callee saved registers (except for rfp), so we can use a smaller RegisterMap + class SmallRegisterMap { ++ constexpr SmallRegisterMap() = default; ++ ~SmallRegisterMap() = default; ++ NONCOPYABLE(SmallRegisterMap); ++ + public: +- static constexpr SmallRegisterMap* instance = nullptr; ++ static const SmallRegisterMap* instance() { ++ static constexpr SmallRegisterMap the_instance{}; ++ return &the_instance; ++ } + private: + static void assert_is_rfp(VMReg r) NOT_DEBUG_RETURN + DEBUG_ONLY({ assert (r == rfp->as_VMReg() || r == rfp->as_VMReg()->next(), "Reg: %s", r->name()); }) +@@ -48,17 +55,6 @@ public: + return map; + } + +- SmallRegisterMap() {} +- +- SmallRegisterMap(const RegisterMap* map) { +- #ifdef ASSERT +- for(int i = 0; i < RegisterMap::reg_count; i++) { +- VMReg r = VMRegImpl::as_VMReg(i); +- if (map->location(r, (intptr_t*)nullptr) != nullptr) assert_is_rfp(r); +- } +- #endif +- } +- + inline address location(VMReg reg, intptr_t* sp) const { + assert_is_rfp(reg); + return (address)(sp - frame::sender_sp_offset); +diff --git a/src/hotspot/cpu/arm/smallRegisterMap_arm.inline.hpp b/src/hotspot/cpu/arm/smallRegisterMap_arm.inline.hpp +index 4186eafd3..08adbbd89 100644 +--- a/src/hotspot/cpu/arm/smallRegisterMap_arm.inline.hpp ++++ b/src/hotspot/cpu/arm/smallRegisterMap_arm.inline.hpp +@@ -30,8 +30,15 @@ + + // Java frames don't have callee saved registers (except for rfp), so we can use a smaller RegisterMap + class SmallRegisterMap { ++ constexpr SmallRegisterMap() = default; ++ ~SmallRegisterMap() = default; ++ NONCOPYABLE(SmallRegisterMap); ++ + public: +- static constexpr SmallRegisterMap* instance = nullptr; ++ static const SmallRegisterMap* instance() { ++ static constexpr SmallRegisterMap the_instance{}; ++ return &the_instance; ++ } + private: + static void assert_is_rfp(VMReg r) NOT_DEBUG_RETURN + DEBUG_ONLY({ Unimplemented(); }) +@@ -46,12 +53,6 @@ public: + return map; + } + +- SmallRegisterMap() {} +- +- SmallRegisterMap(const RegisterMap* map) { +- Unimplemented(); +- } +- + inline address location(VMReg reg, intptr_t* sp) const { + Unimplemented(); + return nullptr; +diff --git a/src/hotspot/cpu/ppc/smallRegisterMap_ppc.inline.hpp b/src/hotspot/cpu/ppc/smallRegisterMap_ppc.inline.hpp +index 8c96f51fd..3b143839c 100644 +--- a/src/hotspot/cpu/ppc/smallRegisterMap_ppc.inline.hpp ++++ b/src/hotspot/cpu/ppc/smallRegisterMap_ppc.inline.hpp +@@ -30,8 +30,15 @@ + + // Java frames don't have callee saved registers, so we can use a smaller RegisterMap + class SmallRegisterMap { ++ constexpr SmallRegisterMap() = default; ++ ~SmallRegisterMap() = default; ++ NONCOPYABLE(SmallRegisterMap); ++ + public: +- static constexpr SmallRegisterMap* instance = nullptr; ++ static const SmallRegisterMap* instance() { ++ static constexpr SmallRegisterMap the_instance{}; ++ return &the_instance; ++ } + public: + // as_RegisterMap is used when we didn't want to templatize and abstract over RegisterMap type to support SmallRegisterMap + // Consider enhancing SmallRegisterMap to support those cases +@@ -44,19 +51,6 @@ public: + return map; + } + +- SmallRegisterMap() {} +- +- SmallRegisterMap(const RegisterMap* map) { +-#ifdef ASSERT +- for(int i = 0; i < RegisterMap::reg_count; i++) { +- VMReg r = VMRegImpl::as_VMReg(i); +- if (map->location(r, (intptr_t*)nullptr) != nullptr) { +- assert(false, "Reg: %s", r->name()); // Should not reach here +- } +- } +-#endif +- } +- + inline address location(VMReg reg, intptr_t* sp) const { + assert(false, "Reg: %s", reg->name()); + return nullptr; +diff --git a/src/hotspot/cpu/riscv/smallRegisterMap_riscv.inline.hpp b/src/hotspot/cpu/riscv/smallRegisterMap_riscv.inline.hpp +index 93adaadce..9fc4f1d7b 100644 +--- a/src/hotspot/cpu/riscv/smallRegisterMap_riscv.inline.hpp ++++ b/src/hotspot/cpu/riscv/smallRegisterMap_riscv.inline.hpp +@@ -30,8 +30,15 @@ + + // Java frames don't have callee saved registers (except for fp), so we can use a smaller RegisterMap + class SmallRegisterMap { ++ constexpr SmallRegisterMap() = default; ++ ~SmallRegisterMap() = default; ++ NONCOPYABLE(SmallRegisterMap); ++ + public: +- static constexpr SmallRegisterMap* instance = nullptr; ++ static const SmallRegisterMap* instance() { ++ static constexpr SmallRegisterMap the_instance{}; ++ return &the_instance; ++ } + private: + static void assert_is_fp(VMReg r) NOT_DEBUG_RETURN + DEBUG_ONLY({ assert (r == fp->as_VMReg() || r == fp->as_VMReg()->next(), "Reg: %s", r->name()); }) +@@ -48,17 +55,6 @@ public: + return map; + } + +- SmallRegisterMap() {} +- +- SmallRegisterMap(const RegisterMap* map) { +- #ifdef ASSERT +- for(int i = 0; i < RegisterMap::reg_count; i++) { +- VMReg r = VMRegImpl::as_VMReg(i); +- if (map->location(r, (intptr_t*)nullptr) != nullptr) assert_is_fp(r); +- } +- #endif +- } +- + inline address location(VMReg reg, intptr_t* sp) const { + assert_is_fp(reg); + return (address)(sp - 2); +diff --git a/src/hotspot/cpu/s390/smallRegisterMap_s390.inline.hpp b/src/hotspot/cpu/s390/smallRegisterMap_s390.inline.hpp +index 8c74eb7dd..625d17cf9 100644 +--- a/src/hotspot/cpu/s390/smallRegisterMap_s390.inline.hpp ++++ b/src/hotspot/cpu/s390/smallRegisterMap_s390.inline.hpp +@@ -30,8 +30,15 @@ + + // Java frames don't have callee saved registers (except for rfp), so we can use a smaller RegisterMap + class SmallRegisterMap { ++ constexpr SmallRegisterMap() = default; ++ ~SmallRegisterMap() = default; ++ NONCOPYABLE(SmallRegisterMap); ++ + public: +- static constexpr SmallRegisterMap* instance = nullptr; ++ static const SmallRegisterMap* instance() { ++ static constexpr SmallRegisterMap the_instance{}; ++ return &the_instance; ++ } + private: + static void assert_is_rfp(VMReg r) NOT_DEBUG_RETURN + DEBUG_ONLY({ Unimplemented(); }) +@@ -46,12 +53,6 @@ public: + return map; + } + +- SmallRegisterMap() {} +- +- SmallRegisterMap(const RegisterMap* map) { +- Unimplemented(); +- } +- + inline address location(VMReg reg, intptr_t* sp) const { + Unimplemented(); + return nullptr; +diff --git a/src/hotspot/cpu/x86/smallRegisterMap_x86.inline.hpp b/src/hotspot/cpu/x86/smallRegisterMap_x86.inline.hpp +index 5f21939a3..ca2f8ea1a 100644 +--- a/src/hotspot/cpu/x86/smallRegisterMap_x86.inline.hpp ++++ b/src/hotspot/cpu/x86/smallRegisterMap_x86.inline.hpp +@@ -30,8 +30,14 @@ + + // Java frames don't have callee saved registers (except for rbp), so we can use a smaller RegisterMap + class SmallRegisterMap { ++ constexpr SmallRegisterMap() = default; ++ ~SmallRegisterMap() = default; ++ NONCOPYABLE(SmallRegisterMap); + public: +- static constexpr SmallRegisterMap* instance = nullptr; ++ static const SmallRegisterMap* instance() { ++ static constexpr SmallRegisterMap the_instance{}; ++ return &the_instance; ++ } + private: + static void assert_is_rbp(VMReg r) NOT_DEBUG_RETURN + DEBUG_ONLY({ assert(r == rbp->as_VMReg() || r == rbp->as_VMReg()->next(), "Reg: %s", r->name()); }) +@@ -48,17 +54,6 @@ public: + return map; + } + +- SmallRegisterMap() {} +- +- SmallRegisterMap(const RegisterMap* map) { +- #ifdef ASSERT +- for(int i = 0; i < RegisterMap::reg_count; i++) { +- VMReg r = VMRegImpl::as_VMReg(i); +- if (map->location(r, (intptr_t*)nullptr) != nullptr) assert_is_rbp(r); +- } +- #endif +- } +- + inline address location(VMReg reg, intptr_t* sp) const { + assert_is_rbp(reg); + return (address)(sp - frame::sender_sp_offset); +diff --git a/src/hotspot/cpu/zero/smallRegisterMap_zero.inline.hpp b/src/hotspot/cpu/zero/smallRegisterMap_zero.inline.hpp +index b85ead32f..51fb114f5 100644 +--- a/src/hotspot/cpu/zero/smallRegisterMap_zero.inline.hpp ++++ b/src/hotspot/cpu/zero/smallRegisterMap_zero.inline.hpp +@@ -30,8 +30,15 @@ + + // Java frames don't have callee saved registers (except for rfp), so we can use a smaller RegisterMap + class SmallRegisterMap { ++ constexpr SmallRegisterMap() = default; ++ ~SmallRegisterMap() = default; ++ NONCOPYABLE(SmallRegisterMap); ++ + public: +- static constexpr SmallRegisterMap* instance = nullptr; ++ static const SmallRegisterMap* instance() { ++ static constexpr SmallRegisterMap the_instance{}; ++ return &the_instance; ++ } + private: + static void assert_is_rfp(VMReg r) NOT_DEBUG_RETURN + DEBUG_ONLY({ Unimplemented(); }) +@@ -46,12 +53,6 @@ public: + return map; + } + +- SmallRegisterMap() {} +- +- SmallRegisterMap(const RegisterMap* map) { +- Unimplemented(); +- } +- + inline address location(VMReg reg, intptr_t* sp) const { + Unimplemented(); + return nullptr; +diff --git a/src/hotspot/share/oops/stackChunkOop.cpp b/src/hotspot/share/oops/stackChunkOop.cpp +index 4e771939d..c1fea1d44 100644 +--- a/src/hotspot/share/oops/stackChunkOop.cpp ++++ b/src/hotspot/share/oops/stackChunkOop.cpp +@@ -125,7 +125,7 @@ static int num_java_frames(const StackChunkFrameStream& f) { + int stackChunkOopDesc::num_java_frames() const { + int n = 0; + for (StackChunkFrameStream f(const_cast(this)); !f.is_done(); +- f.next(SmallRegisterMap::instance)) { ++ f.next(SmallRegisterMap::instance())) { + if (!f.is_stub()) { + n += ::num_java_frames(f); + } +diff --git a/src/hotspot/share/oops/stackChunkOop.inline.hpp b/src/hotspot/share/oops/stackChunkOop.inline.hpp +index 9bde7e255..a7725f0b2 100644 +--- a/src/hotspot/share/oops/stackChunkOop.inline.hpp ++++ b/src/hotspot/share/oops/stackChunkOop.inline.hpp +@@ -200,7 +200,7 @@ inline void stackChunkOopDesc::iterate_stack(StackChunkFrameClosureType* closure + + template + inline void stackChunkOopDesc::iterate_stack(StackChunkFrameClosureType* closure) { +- const SmallRegisterMap* map = SmallRegisterMap::instance; ++ const SmallRegisterMap* map = SmallRegisterMap::instance(); + assert(!map->in_cont(), ""); + + StackChunkFrameStream f(this); +diff --git a/src/hotspot/share/runtime/continuationFreezeThaw.cpp b/src/hotspot/share/runtime/continuationFreezeThaw.cpp +index 0882bc933..832ff70fb 100644 +--- a/src/hotspot/share/runtime/continuationFreezeThaw.cpp ++++ b/src/hotspot/share/runtime/continuationFreezeThaw.cpp +@@ -1834,7 +1834,7 @@ inline void ThawBase::clear_chunk(stackChunkOop chunk) { + const int frame_size = f.cb()->frame_size(); + argsize = f.stack_argsize(); + +- f.next(SmallRegisterMap::instance, true /* stop */); ++ f.next(SmallRegisterMap::instance(), true /* stop */); + empty = f.is_done(); + assert(!empty || argsize == chunk->argsize(), ""); + +@@ -2034,7 +2034,7 @@ bool ThawBase::recurse_thaw_java_frame(frame& caller, int num_frames) { + + int argsize = _stream.stack_argsize(); + +- _stream.next(SmallRegisterMap::instance); ++ _stream.next(SmallRegisterMap::instance()); + assert(_stream.to_frame().is_empty() == _stream.is_done(), ""); + + // we never leave a compiled caller of an interpreted frame as the top frame in the chunk +@@ -2143,7 +2143,7 @@ NOINLINE void ThawBase::recurse_thaw_interpreted_frame(const frame& hf, frame& c + assert(hf.is_interpreted_frame(), ""); + + if (UNLIKELY(seen_by_gc())) { +- _cont.tail()->do_barriers(_stream, SmallRegisterMap::instance); ++ _cont.tail()->do_barriers(_stream, SmallRegisterMap::instance()); + } + + const bool is_bottom_frame = recurse_thaw_java_frame(caller, num_frames); +@@ -2186,7 +2186,7 @@ NOINLINE void ThawBase::recurse_thaw_interpreted_frame(const frame& hf, frame& c + + if (!is_bottom_frame) { + // can only fix caller once this frame is thawed (due to callee saved regs) +- _cont.tail()->fix_thawed_frame(caller, SmallRegisterMap::instance); ++ _cont.tail()->fix_thawed_frame(caller, SmallRegisterMap::instance()); + } else if (_cont.tail()->has_bitmap() && locals > 0) { + assert(hf.is_heap_frame(), "should be"); + address start = (address)(heap_frame_bottom - locals); +@@ -2203,7 +2203,7 @@ void ThawBase::recurse_thaw_compiled_frame(const frame& hf, frame& caller, int n + assert(_cont.is_preempted() || !stub_caller, "stub caller not at preemption"); + + if (!stub_caller && UNLIKELY(seen_by_gc())) { // recurse_thaw_stub_frame already invoked our barriers with a full regmap +- _cont.tail()->do_barriers(_stream, SmallRegisterMap::instance); ++ _cont.tail()->do_barriers(_stream, SmallRegisterMap::instance()); + } + + const bool is_bottom_frame = recurse_thaw_java_frame(caller, num_frames); +@@ -2262,7 +2262,7 @@ void ThawBase::recurse_thaw_compiled_frame(const frame& hf, frame& caller, int n + + if (!is_bottom_frame) { + // can only fix caller once this frame is thawed (due to callee saved regs); this happens on the stack +- _cont.tail()->fix_thawed_frame(caller, SmallRegisterMap::instance); ++ _cont.tail()->fix_thawed_frame(caller, SmallRegisterMap::instance()); + } else if (_cont.tail()->has_bitmap() && added_argsize > 0) { + address start = (address)(heap_frame_top + ContinuationHelper::CompiledFrame::size(hf) + frame::metadata_words_at_top); + int stack_args_slots = f.cb()->as_compiled_method()->method()->num_stack_arg_slots(false /* rounded */); +@@ -2345,7 +2345,7 @@ void ThawBase::finish_thaw(frame& f) { + f.set_sp(align_down(f.sp(), frame::frame_alignment)); + } + push_return_frame(f); +- chunk->fix_thawed_frame(f, SmallRegisterMap::instance); // can only fix caller after push_return_frame (due to callee saved regs) ++ chunk->fix_thawed_frame(f, SmallRegisterMap::instance()); // can only fix caller after push_return_frame (due to callee saved regs) + + assert(_cont.is_empty() == _cont.last_frame().is_empty(), ""); + +-- +2.33.0 + diff --git a/Backport-JDK-8333462-Performance-regression-of-new-D.patch b/Backport-JDK-8333462-Performance-regression-of-new-D.patch new file mode 100644 index 0000000..8e7cb6b --- /dev/null +++ b/Backport-JDK-8333462-Performance-regression-of-new-D.patch @@ -0,0 +1,38 @@ +Subject: Backport JDK-8333462 Performance regression of new DecimalFormat() when compare to jdk11 + +--- + .../classes/java/text/DecimalFormatSymbols.java | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/src/java.base/share/classes/java/text/DecimalFormatSymbols.java b/src/java.base/share/classes/java/text/DecimalFormatSymbols.java +index 795e087a3..72b273f6b 100644 +--- a/src/java.base/share/classes/java/text/DecimalFormatSymbols.java ++++ b/src/java.base/share/classes/java/text/DecimalFormatSymbols.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 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 +@@ -849,10 +849,13 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { + * Obtains non-format single character from String + */ + private char findNonFormatChar(String src, char defChar) { +- return (char)src.chars() +- .filter(c -> Character.getType(c) != Character.FORMAT) +- .findFirst() +- .orElse(defChar); ++ for (int i = 0; i < src.length(); i++) { ++ char c = src.charAt(i); ++ if (Character.getType(c) != Character.FORMAT) { ++ return c; ++ } ++ } ++ return defChar; + } + + /** +-- +2.33.0 + diff --git a/Backport-JDK-8333599-Improve-description-of-b-matche.patch b/Backport-JDK-8333599-Improve-description-of-b-matche.patch new file mode 100644 index 0000000..23ea213 --- /dev/null +++ b/Backport-JDK-8333599-Improve-description-of-b-matche.patch @@ -0,0 +1,41 @@ +Subject: Backport JDK-8333599 Improve description of \b matcher in j.u.r.Pattern + +--- + src/java.base/share/classes/java/util/regex/Pattern.java | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/java.base/share/classes/java/util/regex/Pattern.java b/src/java.base/share/classes/java/util/regex/Pattern.java +index 45c48ddab..84e5a140d 100644 +--- a/src/java.base/share/classes/java/util/regex/Pattern.java ++++ b/src/java.base/share/classes/java/util/regex/Pattern.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1999, 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 +@@ -160,7 +160,7 @@ import jdk.internal.util.regex.Grapheme; + * Any character (may or may not match line terminators) + * {@code \d} + * A digit: {@code [0-9]} if +- * * UNICODE_CHARACTER_CLASS is not set. See Unicode Support. ++ * UNICODE_CHARACTER_CLASS is not set. See Unicode Support. + * {@code \D} + * A non-digit: {@code [^0-9]} + * {@code \h} +@@ -251,8 +251,9 @@ import jdk.internal.util.regex.Grapheme; + * {@code $} + * The end of a line + * {@code \b} +- * A word boundary: {@code (?:(?<=\w)(?=\W)|(?<=\W)(?=\w))} (the location +- * where a non-word character abuts a word character) ++ * A word boundary: ++ * at the beginning or at the end of a line if a word character ({@code \w}) appears there; ++ * or between a word ({@code \w}) and a non-word character ({@code \W}), in either order. + * {@code \b{g}} + * A Unicode extended grapheme cluster boundary + * {@code \B} +-- +2.33.0 + diff --git a/Backport-JDK-8333622-ubsan-relocInfo_x86.cpp:101:56:.patch b/Backport-JDK-8333622-ubsan-relocInfo_x86.cpp:101:56:.patch new file mode 100644 index 0000000..557b03b --- /dev/null +++ b/Backport-JDK-8333622-ubsan-relocInfo_x86.cpp:101:56:.patch @@ -0,0 +1,26 @@ +Subject: Backport of JDK-8333622 ubsan: relocInfo_x86.cpp:101:56: runtime error: pointer index expression with base (-1) overflowed + +--- + src/hotspot/cpu/x86/relocInfo_x86.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/hotspot/cpu/x86/relocInfo_x86.cpp b/src/hotspot/cpu/x86/relocInfo_x86.cpp +index b382b0290..648c4d4b5 100644 +--- a/src/hotspot/cpu/x86/relocInfo_x86.cpp ++++ b/src/hotspot/cpu/x86/relocInfo_x86.cpp +@@ -97,7 +97,11 @@ address Relocation::pd_call_destination(address orig_addr) { + if (ni->is_call()) { + return nativeCall_at(addr())->destination() + adj; + } else if (ni->is_jump()) { +- return nativeJump_at(addr())->jump_destination() + adj; ++ address dest = nativeJump_at(addr())->jump_destination(); ++ if (dest == (address) -1) { ++ return addr(); // jump to self ++ } ++ return dest + adj; + } else if (ni->is_cond_jump()) { + return nativeGeneralJump_at(addr())->jump_destination() + adj; + } else if (ni->is_mov_literal64()) { +-- +2.33.0 + diff --git a/Backport-JDK-8333639-ubsan-cppVtables.cpp:81:55-runt.patch b/Backport-JDK-8333639-ubsan-cppVtables.cpp:81:55-runt.patch new file mode 100644 index 0000000..a6bbd54 --- /dev/null +++ b/Backport-JDK-8333639-ubsan-cppVtables.cpp:81:55-runt.patch @@ -0,0 +1,39 @@ +Subject: Backport of JDK-8333639 ubsan: cppVtables.cpp:81:55: runtime error: index 14 out of bounds for type 'long int [1]' + +--- + src/hotspot/share/cds/cppVtables.cpp | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/src/hotspot/share/cds/cppVtables.cpp b/src/hotspot/share/cds/cppVtables.cpp +index 94ec7cd9f..6586a586e 100644 +--- a/src/hotspot/share/cds/cppVtables.cpp ++++ b/src/hotspot/share/cds/cppVtables.cpp +@@ -65,19 +65,17 @@ + + class CppVtableInfo { + intptr_t _vtable_size; +- intptr_t _cloned_vtable[1]; ++ intptr_t _cloned_vtable[1]; // Pseudo flexible array member. ++ static size_t cloned_vtable_offset() { return offset_of(CppVtableInfo, _cloned_vtable); } + public: +- static int num_slots(int vtable_size) { +- return 1 + vtable_size; // Need to add the space occupied by _vtable_size; +- } + int vtable_size() { return int(uintx(_vtable_size)); } + void set_vtable_size(int n) { _vtable_size = intptr_t(n); } +- intptr_t* cloned_vtable() { return &_cloned_vtable[0]; } +- void zero() { memset(_cloned_vtable, 0, sizeof(intptr_t) * vtable_size()); } ++ // Using _cloned_vtable[i] for i > 0 causes undefined behavior. We use address calculation instead. ++ intptr_t* cloned_vtable() { return (intptr_t*)((char*)this + cloned_vtable_offset()); } ++ void zero() { memset(cloned_vtable(), 0, sizeof(intptr_t) * vtable_size()); } + // Returns the address of the next CppVtableInfo that can be placed immediately after this CppVtableInfo + static size_t byte_size(int vtable_size) { +- CppVtableInfo i; +- return pointer_delta(&i._cloned_vtable[vtable_size], &i, sizeof(u1)); ++ return cloned_vtable_offset() + (sizeof(intptr_t) * vtable_size); + } + }; + +-- +2.33.0 + diff --git a/Backport-JDK-8333805-Replaying-compilation-with-null.patch b/Backport-JDK-8333805-Replaying-compilation-with-null.patch new file mode 100644 index 0000000..df99142 --- /dev/null +++ b/Backport-JDK-8333805-Replaying-compilation-with-null.patch @@ -0,0 +1,242 @@ +Subject: Backport JDK-8333805 Replaying compilation with null static final fields results in a crash + +--- + src/hotspot/share/ci/ciInstanceKlass.cpp | 10 ++- + src/hotspot/share/ci/ciReplay.cpp | 89 ++++++++++--------- + .../ciReplay/TestNullStaticField.java | 82 +++++++++++++++++ + 3 files changed, 136 insertions(+), 45 deletions(-) + create mode 100644 test/hotspot/jtreg/compiler/ciReplay/TestNullStaticField.java + +diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp +index fa084e228..240bb25ae 100644 +--- a/src/hotspot/share/ci/ciInstanceKlass.cpp ++++ b/src/hotspot/share/ci/ciInstanceKlass.cpp +@@ -661,7 +661,8 @@ class StaticFinalFieldPrinter : public FieldClosure { + ResourceMark rm; + oop mirror = fd->field_holder()->java_mirror(); + _out->print("staticfield %s %s %s ", _holder, fd->name()->as_quoted_ascii(), fd->signature()->as_quoted_ascii()); +- switch (fd->field_type()) { ++ BasicType field_type = fd->field_type(); ++ switch (field_type) { + case T_BYTE: _out->print_cr("%d", mirror->byte_field(fd->offset())); break; + case T_BOOLEAN: _out->print_cr("%d", mirror->bool_field(fd->offset())); break; + case T_SHORT: _out->print_cr("%d", mirror->short_field(fd->offset())); break; +@@ -682,9 +683,12 @@ class StaticFinalFieldPrinter : public FieldClosure { + case T_OBJECT: { + oop value = mirror->obj_field_acquire(fd->offset()); + if (value == nullptr) { +- _out->print_cr("null"); ++ if (field_type == T_ARRAY) { ++ _out->print("%d", -1); ++ } ++ _out->cr(); + } else if (value->is_instance()) { +- assert(fd->field_type() == T_OBJECT, ""); ++ assert(field_type == T_OBJECT, ""); + if (value->is_a(vmClasses::String_klass())) { + const char* ascii_value = java_lang_String::as_quoted_ascii(value); + _out->print_cr("\"%s\"", (ascii_value != nullptr) ? ascii_value : ""); +diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp +index 68d4308a2..3171a5d51 100644 +--- a/src/hotspot/share/ci/ciReplay.cpp ++++ b/src/hotspot/share/ci/ciReplay.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2013, 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 +@@ -1065,46 +1065,48 @@ class CompileReplay : public StackObj { + int length = parse_int("array length"); + oop value = nullptr; + +- if (field_signature[1] == JVM_SIGNATURE_ARRAY) { +- // multi dimensional array +- ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK); +- if (kelem == nullptr) { +- return; +- } +- int rank = 0; +- while (field_signature[rank] == JVM_SIGNATURE_ARRAY) { +- rank++; +- } +- jint* dims = NEW_RESOURCE_ARRAY(jint, rank); +- dims[0] = length; +- for (int i = 1; i < rank; i++) { +- dims[i] = 1; // These aren't relevant to the compiler +- } +- value = kelem->multi_allocate(rank, dims, CHECK); +- } else { +- if (strcmp(field_signature, "[B") == 0) { +- value = oopFactory::new_byteArray(length, CHECK); +- } else if (strcmp(field_signature, "[Z") == 0) { +- value = oopFactory::new_boolArray(length, CHECK); +- } else if (strcmp(field_signature, "[C") == 0) { +- value = oopFactory::new_charArray(length, CHECK); +- } else if (strcmp(field_signature, "[S") == 0) { +- value = oopFactory::new_shortArray(length, CHECK); +- } else if (strcmp(field_signature, "[F") == 0) { +- value = oopFactory::new_floatArray(length, CHECK); +- } else if (strcmp(field_signature, "[D") == 0) { +- value = oopFactory::new_doubleArray(length, CHECK); +- } else if (strcmp(field_signature, "[I") == 0) { +- value = oopFactory::new_intArray(length, CHECK); +- } else if (strcmp(field_signature, "[J") == 0) { +- value = oopFactory::new_longArray(length, CHECK); +- } else if (field_signature[0] == JVM_SIGNATURE_ARRAY && +- field_signature[1] == JVM_SIGNATURE_CLASS) { +- parse_klass(CHECK); // eat up the array class name +- Klass* kelem = resolve_klass(field_signature + 1, CHECK); +- value = oopFactory::new_objArray(kelem, length, CHECK); ++ if (length != -1) { ++ if (field_signature[1] == JVM_SIGNATURE_ARRAY) { ++ // multi dimensional array ++ ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK); ++ if (kelem == nullptr) { ++ return; ++ } ++ int rank = 0; ++ while (field_signature[rank] == JVM_SIGNATURE_ARRAY) { ++ rank++; ++ } ++ jint* dims = NEW_RESOURCE_ARRAY(jint, rank); ++ dims[0] = length; ++ for (int i = 1; i < rank; i++) { ++ dims[i] = 1; // These aren't relevant to the compiler ++ } ++ value = kelem->multi_allocate(rank, dims, CHECK); + } else { +- report_error("unhandled array staticfield"); ++ if (strcmp(field_signature, "[B") == 0) { ++ value = oopFactory::new_byteArray(length, CHECK); ++ } else if (strcmp(field_signature, "[Z") == 0) { ++ value = oopFactory::new_boolArray(length, CHECK); ++ } else if (strcmp(field_signature, "[C") == 0) { ++ value = oopFactory::new_charArray(length, CHECK); ++ } else if (strcmp(field_signature, "[S") == 0) { ++ value = oopFactory::new_shortArray(length, CHECK); ++ } else if (strcmp(field_signature, "[F") == 0) { ++ value = oopFactory::new_floatArray(length, CHECK); ++ } else if (strcmp(field_signature, "[D") == 0) { ++ value = oopFactory::new_doubleArray(length, CHECK); ++ } else if (strcmp(field_signature, "[I") == 0) { ++ value = oopFactory::new_intArray(length, CHECK); ++ } else if (strcmp(field_signature, "[J") == 0) { ++ value = oopFactory::new_longArray(length, CHECK); ++ } else if (field_signature[0] == JVM_SIGNATURE_ARRAY && ++ field_signature[1] == JVM_SIGNATURE_CLASS) { ++ Klass* actual_array_klass = parse_klass(CHECK); ++ Klass* kelem = ObjArrayKlass::cast(actual_array_klass)->element_klass(); ++ value = oopFactory::new_objArray(kelem, length, CHECK); ++ } else { ++ report_error("unhandled array staticfield"); ++ } + } + } + java_mirror->obj_field_put(fd.offset(), value); +@@ -1142,8 +1144,11 @@ class CompileReplay : public StackObj { + Handle value = java_lang_String::create_from_str(string_value, CHECK); + java_mirror->obj_field_put(fd.offset(), value()); + } else if (field_signature[0] == JVM_SIGNATURE_CLASS) { +- Klass* k = resolve_klass(string_value, CHECK); +- oop value = InstanceKlass::cast(k)->allocate_instance(CHECK); ++ oop value = nullptr; ++ if (string_value != nullptr) { ++ Klass* k = resolve_klass(string_value, CHECK); ++ value = InstanceKlass::cast(k)->allocate_instance(CHECK); ++ } + java_mirror->obj_field_put(fd.offset(), value); + } else { + report_error("unhandled staticfield"); +diff --git a/test/hotspot/jtreg/compiler/ciReplay/TestNullStaticField.java b/test/hotspot/jtreg/compiler/ciReplay/TestNullStaticField.java +new file mode 100644 +index 000000000..47a78ad5e +--- /dev/null ++++ b/test/hotspot/jtreg/compiler/ciReplay/TestNullStaticField.java +@@ -0,0 +1,82 @@ ++/* ++ * 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 8333805 ++ * @library / /test/lib ++ * @summary Replaying compilation with null static final fields results in a crash ++ * @requires vm.flightRecorder != true & vm.compMode != "Xint" & vm.compMode != "Xcomp" & vm.debug == true & vm.compiler2.enabled ++ * @modules java.base/jdk.internal.misc ++ * @build jdk.test.whitebox.WhiteBox ++ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox ++ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ++ * compiler.ciReplay.TestNullStaticField ++ */ ++ ++package compiler.ciReplay; ++ ++public class TestNullStaticField extends DumpReplayBase { ++ ++ public static void main(String[] args) { ++ new TestNullStaticField().runTest(TIERED_DISABLED_VM_OPTION); ++ } ++ ++ @Override ++ public void testAction() { ++ positiveTest(TIERED_DISABLED_VM_OPTION, "-XX:+ReplayIgnoreInitErrors"); ++ } ++ ++ @Override ++ public String getTestClass() { ++ return TestClassNullStaticField.class.getName(); ++ } ++ ++} ++ ++class TestClassNullStaticField { ++ ++ static final Object[] staticNullArrayField = null; ++ static final Object[][] staticNullMultiArrayField = null; ++ static final Object staticNullObjectField = null; ++ static final String staticNullStringField = null; ++ static final int[] staticNullIntArrayField = null; ++ static final Object[] staticNotNullArrayField = new A[10]; ++ static final Object[][] staticNotNullMultiArrayField = new A[10][10]; ++ static final Object staticNotNullObjectField = new A(); ++ static final String staticNotNullStringField = "Not null"; ++ static final int[] staticNotNullIntArrayField = new int[10]; ++ ++ public static void main(String[] args) { ++ for (int i = 0; i < 20_000; i++) { ++ test(); ++ } ++ } ++ public static void test() { ++ ++ } ++ ++ private static class A { ++ } ++} ++ +-- +2.33.0 + diff --git a/Backport-JDK-8333887-ubsan-unsafe.cpp:247:13:-runtim.patch b/Backport-JDK-8333887-ubsan-unsafe.cpp:247:13:-runtim.patch new file mode 100644 index 0000000..93e4291 --- /dev/null +++ b/Backport-JDK-8333887-ubsan-unsafe.cpp:247:13:-runtim.patch @@ -0,0 +1,25 @@ +Subject: Backport of JDK-8333887 ubsan: unsafe.cpp:247:13: runtime error: store to null pointer of type 'volatile int' + +--- + src/hotspot/share/prims/unsafe.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/hotspot/share/prims/unsafe.cpp b/src/hotspot/share/prims/unsafe.cpp +index c6fd8449a..5c30182df 100644 +--- a/src/hotspot/share/prims/unsafe.cpp ++++ b/src/hotspot/share/prims/unsafe.cpp +@@ -223,6 +223,11 @@ public: + return normalize_for_read(*addr()); + } + ++ // we use this method at some places for writing to 0 e.g. to cause a crash; ++ // ubsan does not know that this is the desired behavior ++#if defined(__clang__) || defined(__GNUC__) ++__attribute__((no_sanitize("undefined"))) ++#endif + void put(T x) { + GuardUnsafeAccess guard(_thread); + *addr() = normalize_for_write(x); +-- +2.33.0 + diff --git a/Backport-JDK-8334123-log-the-opening-of-Type-1-fonts.patch b/Backport-JDK-8334123-log-the-opening-of-Type-1-fonts.patch new file mode 100644 index 0000000..95df512 --- /dev/null +++ b/Backport-JDK-8334123-log-the-opening-of-Type-1-fonts.patch @@ -0,0 +1,41 @@ +Subject: Backport JDK-8334123 log the opening of Type 1 fonts + +--- + src/java.desktop/share/classes/sun/font/Type1Font.java | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/java.desktop/share/classes/sun/font/Type1Font.java b/src/java.desktop/share/classes/sun/font/Type1Font.java +index 1cd046ead..cc36c193d 100644 +--- a/src/java.desktop/share/classes/sun/font/Type1Font.java ++++ b/src/java.desktop/share/classes/sun/font/Type1Font.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2022, 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 +@@ -187,7 +187,9 @@ public class Type1Font extends FileFont { + private synchronized ByteBuffer getBuffer() throws FontFormatException { + ByteBuffer bbuf = bufferRef.get(); + if (bbuf == null) { +- //System.out.println("open T1 " + platName); ++ if (FontUtilities.isLogging()) { ++ FontUtilities.logInfo("open Type 1 font: " + platName); ++ } + try { + @SuppressWarnings("removal") + RandomAccessFile raf = (RandomAccessFile) +@@ -229,6 +231,9 @@ public class Type1Font extends FileFont { + void readFile(ByteBuffer buffer) { + RandomAccessFile raf = null; + FileChannel fc; ++ if (FontUtilities.isLogging()) { ++ FontUtilities.logInfo("open Type 1 font: " + platName); ++ } + try { + raf = (RandomAccessFile) + java.security.AccessController.doPrivileged( +-- +2.33.0 + diff --git a/Backport-JDK-8334239-Introduce-macro-for-ubsan-metho.patch b/Backport-JDK-8334239-Introduce-macro-for-ubsan-metho.patch new file mode 100644 index 0000000..2c90844 --- /dev/null +++ b/Backport-JDK-8334239-Introduce-macro-for-ubsan-metho.patch @@ -0,0 +1,130 @@ +Subject: Backport of JDK-8334239 : Introduce macro for ubsan method/function exclusions + +--- + src/hotspot/share/cds/archiveHeapLoader.cpp | 5 +-- + src/hotspot/share/prims/unsafe.cpp | 5 +-- + src/hotspot/share/sanitizers/ub.hpp | 43 +++++++++++++++++++++ + src/hotspot/share/utilities/vmError.cpp | 3 ++ + 4 files changed, 50 insertions(+), 6 deletions(-) + create mode 100644 src/hotspot/share/sanitizers/ub.hpp + +diff --git a/src/hotspot/share/cds/archiveHeapLoader.cpp b/src/hotspot/share/cds/archiveHeapLoader.cpp +index ecd65e952..2d39ccef7 100644 +--- a/src/hotspot/share/cds/archiveHeapLoader.cpp ++++ b/src/hotspot/share/cds/archiveHeapLoader.cpp +@@ -33,6 +33,7 @@ + #include "memory/iterator.inline.hpp" + #include "memory/resourceArea.hpp" + #include "memory/universe.hpp" ++#include "sanitizers/ub.hpp" + #include "utilities/bitMap.inline.hpp" + #include "utilities/copy.hpp" + +@@ -59,9 +60,7 @@ ptrdiff_t ArchiveHeapLoader::_mapped_heap_delta = 0; + + // Every mapped region is offset by _mapped_heap_delta from its requested address. + // See FileMapInfo::heap_region_requested_address(). +-#if defined(__clang__) || defined(__GNUC__) +-__attribute__((no_sanitize("undefined"))) +-#endif ++ATTRIBUTE_NO_UBSAN + void ArchiveHeapLoader::init_mapped_heap_relocation(ptrdiff_t delta, int dumptime_oop_shift) { + assert(!_mapped_heap_relocation_initialized, "only once"); + if (!UseCompressedOops) { +diff --git a/src/hotspot/share/prims/unsafe.cpp b/src/hotspot/share/prims/unsafe.cpp +index 5c30182df..3fefb36ef 100644 +--- a/src/hotspot/share/prims/unsafe.cpp ++++ b/src/hotspot/share/prims/unsafe.cpp +@@ -55,6 +55,7 @@ + #include "runtime/threadSMR.hpp" + #include "runtime/vmOperations.hpp" + #include "runtime/vm_version.hpp" ++#include "sanitizers/ub.hpp" + #include "services/threadService.hpp" + #include "utilities/align.hpp" + #include "utilities/copy.hpp" +@@ -225,9 +226,7 @@ public: + + // we use this method at some places for writing to 0 e.g. to cause a crash; + // ubsan does not know that this is the desired behavior +-#if defined(__clang__) || defined(__GNUC__) +-__attribute__((no_sanitize("undefined"))) +-#endif ++ ATTRIBUTE_NO_UBSAN + void put(T x) { + GuardUnsafeAccess guard(_thread); + *addr() = normalize_for_write(x); +diff --git a/src/hotspot/share/sanitizers/ub.hpp b/src/hotspot/share/sanitizers/ub.hpp +new file mode 100644 +index 000000000..b62ffed0b +--- /dev/null ++++ b/src/hotspot/share/sanitizers/ub.hpp +@@ -0,0 +1,43 @@ ++/* ++ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2024 SAP SE. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef SHARE_SANITIZERS_UB_HPP ++#define SHARE_SANITIZERS_UB_HPP ++ ++// ATTRIBUTE_NO_UBSAN ++// ++// Function attribute which informs the compiler to disable UBSan checks in the ++// following function or method. ++// Useful if the function or method is known to do something special or even 'dangerous', for ++// example causing desired signals/crashes. ++#if defined(__clang__) || defined(__GNUC__) ++#define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined"))) ++#endif ++ ++#ifndef ATTRIBUTE_NO_UBSAN ++#define ATTRIBUTE_NO_UBSAN ++#endif ++ ++#endif // SHARE_SANITIZERS_UB_HPP +\ No newline at end of file +diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp +index 868c67a7d..e8962633c 100644 +--- a/src/hotspot/share/utilities/vmError.cpp ++++ b/src/hotspot/share/utilities/vmError.cpp +@@ -59,6 +59,7 @@ + #include "runtime/vmOperations.hpp" + #include "runtime/vm_version.hpp" + #include "services/memTracker.hpp" ++#include "sanitizers/ub.hpp" + #include "utilities/debug.hpp" + #include "utilities/decoder.hpp" + #include "utilities/defaultStream.hpp" +@@ -2060,6 +2061,8 @@ typedef void (*voidfun_t)(); + + // Crash with an authentic sigfpe + volatile int sigfpe_int = 0; ++ ++ATTRIBUTE_NO_UBSAN + static void ALWAYSINLINE crash_with_sigfpe() { + + // generate a native synchronous SIGFPE where possible; +-- +2.33.0 + diff --git a/Backport-JDK-8334758-Incorrect-note-in-Javadoc-for-a.patch b/Backport-JDK-8334758-Incorrect-note-in-Javadoc-for-a.patch new file mode 100644 index 0000000..4de6a24 --- /dev/null +++ b/Backport-JDK-8334758-Incorrect-note-in-Javadoc-for-a.patch @@ -0,0 +1,97 @@ +Subject: Backport JDK-8334758: Incorrect note in Javadoc for a few RandomGenerator methods + +--- + .../java/util/random/RandomGenerator.java | 51 +++++++++---------- + 1 file changed, 23 insertions(+), 28 deletions(-) + +diff --git a/src/java.base/share/classes/java/util/random/RandomGenerator.java b/src/java.base/share/classes/java/util/random/RandomGenerator.java +index a7c6bcec3..5c0d07fb1 100644 +--- a/src/java.base/share/classes/java/util/random/RandomGenerator.java ++++ b/src/java.base/share/classes/java/util/random/RandomGenerator.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2021, 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 +@@ -640,12 +640,11 @@ public interface RandomGenerator { + * + * @throws IllegalArgumentException if {@code bound} is not positive + * +- * @implSpec The default implementation checks that {@code bound} is a +- * positive {@code int}. Then invokes {@code nextInt()}, limiting the result +- * to be greater than or equal zero and less than {@code bound}. If {@code bound} +- * is a power of two then limiting is a simple masking operation. Otherwise, +- * the result is re-calculated by invoking {@code nextInt()} until the +- * result is greater than or equal zero and less than {@code bound}. ++ * @implSpec The default implementation checks that {@code bound} is positive. ++ * It then invokes {@link #nextInt()} one or more times to ensure a uniform ++ * distribution in the range 0 (inclusive) ++ * to {@code bound} (exclusive). ++ * It assumes the distribution of {@link #nextInt()} to be uniform. + */ + default int nextInt(int bound) { + RandomSupport.checkBound(bound); +@@ -666,13 +665,12 @@ public interface RandomGenerator { + * @throws IllegalArgumentException if {@code origin} is greater than + * or equal to {@code bound} + * +- * @implSpec The default implementation checks that {@code origin} and +- * {@code bound} are positive {@code ints}. Then invokes {@code nextInt()}, +- * limiting the result to be greater that or equal {@code origin} and less +- * than {@code bound}. If {@code bound} is a power of two then limiting is a +- * simple masking operation. Otherwise, the result is re-calculated by +- * invoking {@code nextInt()} until the result is greater than or equal +- * {@code origin} and less than {@code bound}. ++ * @implSpec The default implementation checks that {@code origin} ++ * is less than {@code bound}. ++ * It then invokes {@link #nextInt()} one or more times to ensure a uniform ++ * distribution in the range {@code origin} (inclusive) ++ * to {@code bound} (exclusive). ++ * It assumes the distribution of {@link #nextInt()} to be uniform. + */ + default int nextInt(int origin, int bound) { + RandomSupport.checkRange(origin, bound); +@@ -699,13 +697,11 @@ public interface RandomGenerator { + * + * @throws IllegalArgumentException if {@code bound} is not positive + * +- * @implSpec The default implementation checks that {@code bound} is a +- * positive {@code long}. Then invokes {@code nextLong()}, limiting the +- * result to be greater than or equal zero and less than {@code bound}. If +- * {@code bound} is a power of two then limiting is a simple masking +- * operation. Otherwise, the result is re-calculated by invoking +- * {@code nextLong()} until the result is greater than or equal zero and +- * less than {@code bound}. ++ * @implSpec The default implementation checks that {@code bound} is positive. ++ * It then invokes {@link #nextLong()} one or more times to ensure a uniform ++ * distribution in the range 0 (inclusive) ++ * to {@code bound} (exclusive). ++ * It assumes the distribution of {@link #nextLong()} to be uniform. + */ + default long nextLong(long bound) { + RandomSupport.checkBound(bound); +@@ -726,13 +722,12 @@ public interface RandomGenerator { + * @throws IllegalArgumentException if {@code origin} is greater than + * or equal to {@code bound} + * +- * @implSpec The default implementation checks that {@code origin} and +- * {@code bound} are positive {@code longs}. Then invokes {@code nextLong()}, +- * limiting the result to be greater than or equal {@code origin} and less +- * than {@code bound}. If {@code bound} is a power of two then limiting is a +- * simple masking operation. Otherwise, the result is re-calculated by +- * invoking {@code nextLong()} until the result is greater than or equal +- * {@code origin} and less than {@code bound}. ++ * @implSpec The default implementation checks that {@code origin} ++ * is less than {@code bound}. ++ * It then invokes {@link #nextLong()} one or more times to ensure a uniform ++ * distribution in the range {@code origin} (inclusive) ++ * to {@code bound} (exclusive). ++ * It assumes the distribution of {@link #nextLong()} to be uniform. + */ + default long nextLong(long origin, long bound) { + RandomSupport.checkRange(origin, bound); +-- +2.33.0 + diff --git a/Backport-JDK-8335638-Calling-VarHandle.-access-mode-.patch b/Backport-JDK-8335638-Calling-VarHandle.-access-mode-.patch new file mode 100644 index 0000000..15c74df --- /dev/null +++ b/Backport-JDK-8335638-Calling-VarHandle.-access-mode-.patch @@ -0,0 +1,162 @@ +Subject: Backport JDK-8335638 Calling VarHandle.{access-mode} methods reflectively throws wrong exception + +--- + src/hotspot/share/prims/methodHandles.cpp | 59 ++++++++++++++++++- + .../VarHandles/VarHandleTestReflection.java | 25 +++++++- + 2 files changed, 78 insertions(+), 6 deletions(-) + +diff --git a/src/hotspot/share/prims/methodHandles.cpp b/src/hotspot/share/prims/methodHandles.cpp +index f6412504a..55a6b3286 100644 +--- a/src/hotspot/share/prims/methodHandles.cpp ++++ b/src/hotspot/share/prims/methodHandles.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2008, 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 +@@ -1362,6 +1362,18 @@ JVM_ENTRY(jobject, MH_invokeExact_UOE(JNIEnv* env, jobject mh, jobjectArray args + } + JVM_END + ++/** ++ * Throws a java/lang/UnsupportedOperationException unconditionally. ++ * This is required by the specification of VarHandle.{access-mode} if ++ * invoked directly. ++ */ ++JVM_ENTRY(jobject, VH_UOE(JNIEnv* env, jobject vh, jobjectArray args)) { ++ THROW_MSG_NULL(vmSymbols::java_lang_UnsupportedOperationException(), "VarHandle access mode methods cannot be invoked reflectively"); ++ return nullptr; ++} ++JVM_END ++ ++ + /// JVM_RegisterMethodHandleMethods + + #define LANG "Ljava/lang/" +@@ -1401,6 +1413,40 @@ static JNINativeMethod MH_methods[] = { + {CC "invoke", CC "([" OBJ ")" OBJ, FN_PTR(MH_invoke_UOE)}, + {CC "invokeExact", CC "([" OBJ ")" OBJ, FN_PTR(MH_invokeExact_UOE)} + }; ++static JNINativeMethod VH_methods[] = { ++ // UnsupportedOperationException throwers ++ {CC "get", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "set", CC "([" OBJ ")V", FN_PTR(VH_UOE)}, ++ {CC "getVolatile", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "setVolatile", CC "([" OBJ ")V", FN_PTR(VH_UOE)}, ++ {CC "getAcquire", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "setRelease", CC "([" OBJ ")V", FN_PTR(VH_UOE)}, ++ {CC "getOpaque", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "setOpaque", CC "([" OBJ ")V", FN_PTR(VH_UOE)}, ++ {CC "compareAndSet", CC "([" OBJ ")Z", FN_PTR(VH_UOE)}, ++ {CC "compareAndExchange", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "compareAndExchangeAcquire", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "compareAndExchangeRelease", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "weakCompareAndSetPlain", CC "([" OBJ ")Z", FN_PTR(VH_UOE)}, ++ {CC "weakCompareAndSet", CC "([" OBJ ")Z", FN_PTR(VH_UOE)}, ++ {CC "weakCompareAndSetAcquire", CC "([" OBJ ")Z", FN_PTR(VH_UOE)}, ++ {CC "weakCompareAndSetRelease", CC "([" OBJ ")Z", FN_PTR(VH_UOE)}, ++ {CC "getAndSet", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndSetAcquire", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndSetRelease", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndAdd", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndAddAcquire", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndAddRelease", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseOr", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseOrAcquire", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseOrRelease", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseAnd", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseAndAcquire", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseAndRelease", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseXor", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseXorAcquire", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)}, ++ {CC "getAndBitwiseXorRelease", CC "([" OBJ ")" OBJ, FN_PTR(VH_UOE)} ++}; + + /** + * This one function is exported, used by NativeLookup. +@@ -1408,9 +1454,12 @@ static JNINativeMethod MH_methods[] = { + JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) { + assert(!MethodHandles::enabled(), "must not be enabled"); + assert(vmClasses::MethodHandle_klass() != nullptr, "should be present"); ++ assert(vmClasses::VarHandle_klass() != nullptr, "should be present"); + +- oop mirror = vmClasses::MethodHandle_klass()->java_mirror(); +- jclass MH_class = (jclass) JNIHandles::make_local(THREAD, mirror); ++ oop mh_mirror = vmClasses::MethodHandle_klass()->java_mirror(); ++ oop vh_mirror = vmClasses::VarHandle_klass()->java_mirror(); ++ jclass MH_class = (jclass) JNIHandles::make_local(THREAD, mh_mirror); ++ jclass VH_class = (jclass) JNIHandles::make_local(THREAD, vh_mirror); + + { + ThreadToNativeFromVM ttnfv(thread); +@@ -1422,6 +1471,10 @@ JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) + status = env->RegisterNatives(MH_class, MH_methods, sizeof(MH_methods)/sizeof(JNINativeMethod)); + guarantee(status == JNI_OK && !env->ExceptionOccurred(), + "register java.lang.invoke.MethodHandle natives"); ++ ++ status = env->RegisterNatives(VH_class, VH_methods, sizeof(VH_methods)/sizeof(JNINativeMethod)); ++ guarantee(status == JNI_OK && !env->ExceptionOccurred(), ++ "register java.lang.invoke.VarHandle natives"); + } + + log_debug(methodhandles, indy)("MethodHandle support loaded (using LambdaForms)"); +diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestReflection.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestReflection.java +index 652272ca8..b20e18d26 100644 +--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestReflection.java ++++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestReflection.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2014, 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 +@@ -33,6 +33,7 @@ import java.lang.invoke.MethodHandle; + import java.lang.invoke.MethodHandleInfo; + import java.lang.invoke.MethodHandles; + import java.lang.invoke.VarHandle; ++import java.lang.reflect.InvocationTargetException; + import java.lang.reflect.Method; + import java.util.stream.Stream; + +@@ -52,15 +53,33 @@ public class VarHandleTestReflection extends VarHandleBaseTest { + } + + @Test(dataProvider = "accessModesProvider", expectedExceptions = IllegalArgumentException.class) +- public void methodInvocation(VarHandle.AccessMode accessMode) throws Exception { ++ public void methodInvocationArgumentMismatch(VarHandle.AccessMode accessMode) throws Exception { + VarHandle v = handle(); + +- // Try a reflective invoke using a Method ++ // Try a reflective invoke using a Method, with no arguments + + Method vhm = VarHandle.class.getMethod(accessMode.methodName(), Object[].class); + vhm.invoke(v, new Object[]{}); + } + ++ @Test(dataProvider = "accessModesProvider") ++ public void methodInvocationMatchingArguments(VarHandle.AccessMode accessMode) throws Exception { ++ VarHandle v = handle(); ++ ++ // Try a reflective invoke using a Method, with the minimal required arguments ++ ++ Method vhm = VarHandle.class.getMethod(accessMode.methodName(), Object[].class); ++ Object arg = new Object[0]; ++ try { ++ vhm.invoke(v, arg); ++ } catch (InvocationTargetException e) { ++ if (!(e.getCause() instanceof UnsupportedOperationException)) { ++ throw new RuntimeException("expected UnsupportedOperationException but got: " ++ + e.getCause().getClass().getName(), e); ++ } ++ } ++ } ++ + @Test(dataProvider = "accessModesProvider", expectedExceptions = UnsupportedOperationException.class) + public void methodHandleInvoke(VarHandle.AccessMode accessMode) throws Throwable { + VarHandle v = handle(); +-- +2.33.0 + diff --git a/Backport-JDK-8336012-Fix-usages-of-jtreg-reserved-pr.patch b/Backport-JDK-8336012-Fix-usages-of-jtreg-reserved-pr.patch new file mode 100644 index 0000000..33b3f5e --- /dev/null +++ b/Backport-JDK-8336012-Fix-usages-of-jtreg-reserved-pr.patch @@ -0,0 +1,29 @@ +Subject: Backport JDK-8336012 Fix usages of jtreg-reserved properties + +--- + test/jdk/java/lang/invoke/PrivateInvokeTest.java | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/test/jdk/java/lang/invoke/PrivateInvokeTest.java b/test/jdk/java/lang/invoke/PrivateInvokeTest.java +index 12edf8e32..8ae78d967 100644 +--- a/test/jdk/java/lang/invoke/PrivateInvokeTest.java ++++ b/test/jdk/java/lang/invoke/PrivateInvokeTest.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2009, 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 +@@ -67,8 +67,6 @@ public class PrivateInvokeTest { + String vstr = System.getProperty(THIS_CLASS.getSimpleName()+".verbose"); + if (vstr == null) + vstr = System.getProperty(THIS_CLASS.getName()+".verbose"); +- if (vstr == null) +- vstr = System.getProperty("test.verbose"); + if (vstr != null) verbose = Integer.parseInt(vstr); + } + private static int referenceKind(Method m) { +-- +2.33.0 + diff --git a/Backport-JDK-8336080-Fix--Wzero-as-null-pointer-cons.patch b/Backport-JDK-8336080-Fix--Wzero-as-null-pointer-cons.patch new file mode 100644 index 0000000..7cae0ad --- /dev/null +++ b/Backport-JDK-8336080-Fix--Wzero-as-null-pointer-cons.patch @@ -0,0 +1,33 @@ +Subject: Backport of JDK-8336080 Fix -Wzero-as-null-pointer-constant warnings in ClassLoaderStats ctor + +--- + src/hotspot/share/classfile/classLoaderStats.hpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/hotspot/share/classfile/classLoaderStats.hpp b/src/hotspot/share/classfile/classLoaderStats.hpp +index 8296c6ee2..4818ddff6 100644 +--- a/src/hotspot/share/classfile/classLoaderStats.hpp ++++ b/src/hotspot/share/classfile/classLoaderStats.hpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2014, 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 +@@ -82,9 +82,9 @@ public: + uintx _hidden_classes_count; + + ClassLoaderStats() : +- _cld(0), +- _class_loader(0), +- _parent(0), ++ _cld(nullptr), ++ _class_loader(), ++ _parent(), + _chunk_sz(0), + _block_sz(0), + _classes_count(0), +-- +2.33.0 + diff --git a/Backport-JDK-8336152-Remove-unused-forward-declarati.patch b/Backport-JDK-8336152-Remove-unused-forward-declarati.patch new file mode 100644 index 0000000..b0792cc --- /dev/null +++ b/Backport-JDK-8336152-Remove-unused-forward-declarati.patch @@ -0,0 +1,29 @@ +Subject: Backport of JDK-8336152 Remove unused forward declaration in classLoadInfo.hpp + +--- + src/hotspot/share/classfile/classLoadInfo.hpp | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/hotspot/share/classfile/classLoadInfo.hpp b/src/hotspot/share/classfile/classLoadInfo.hpp +index b1257dc99..ab665c6b3 100644 +--- a/src/hotspot/share/classfile/classLoadInfo.hpp ++++ b/src/hotspot/share/classfile/classLoadInfo.hpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2020, 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 +@@ -29,8 +29,6 @@ + + class InstanceKlass; + +-template class GrowableArray; +- + class ClassInstanceInfo : public StackObj { + private: + InstanceKlass* _dynamic_nest_host; +-- +2.33.0 + diff --git a/Backport-JDK-8336855-Duplicate-protected-declaration.patch b/Backport-JDK-8336855-Duplicate-protected-declaration.patch new file mode 100644 index 0000000..dab65b0 --- /dev/null +++ b/Backport-JDK-8336855-Duplicate-protected-declaration.patch @@ -0,0 +1,40 @@ +Subject: Backport JDK-8336855 Duplicate protected declaration and comment in interp_masm_aarch64.hpp + +--- + src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp +index 019eb2355..6dd8ea70d 100644 +--- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp ++++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp +@@ -35,8 +35,6 @@ + typedef ByteSize (*OffsetFunction)(uint); + + class InterpreterMacroAssembler: public MacroAssembler { +- protected: +- + protected: + // Interpreter specific version of call_VM_base + using MacroAssembler::call_VM_leaf_base; +@@ -110,8 +108,6 @@ class InterpreterMacroAssembler: public MacroAssembler { + + void get_dispatch(); + +- // Helpers for runtime call arguments/results +- + // Helpers for runtime call arguments/results + void get_method(Register reg) { + ldr(reg, Address(rfp, frame::interpreter_frame_method_offset * wordSize)); +@@ -183,7 +179,7 @@ class InterpreterMacroAssembler: public MacroAssembler { + void load_ptr(int n, Register val); + void store_ptr(int n, Register val); + +-// Load float value from 'address'. The value is loaded onto the FPU register v0. ++ // Load float value from 'address'. The value is loaded onto the FPU register v0. + void load_float(Address src); + void load_double(Address src); + +-- +2.33.0 + diff --git a/Backport-JDK-8336879-Always-true-condition-img-null-.patch b/Backport-JDK-8336879-Always-true-condition-img-null-.patch new file mode 100644 index 0000000..7063e49 --- /dev/null +++ b/Backport-JDK-8336879-Always-true-condition-img-null-.patch @@ -0,0 +1,34 @@ +Subject: Backport JDK-8336879 Always true condition 'img != null' in GTKPainter.paintPopupMenuBackground + +--- + .../classes/com/sun/java/swing/plaf/gtk/GTKPainter.java | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java +index 1635ff66f..6231e11d6 100644 +--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java ++++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2002, 2022, 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 +@@ -610,10 +610,10 @@ class GTKPainter extends SynthPainter { + x + insets.left, y + insets.top, w - insets.left - insets.right, + h - insets.top - insets.bottom); + BufferedImage img = ENGINE.finishPainting(); +- if(!isHW) { ++ if (!isHW && img != null) { + int border = img.getRGB(0, h / 2); +- if (img != null && border == img.getRGB(w / 2, h / 2)) { +- // fix no menu borders in Adwaita theme ++ if (border == img.getRGB(w / 2, h / 2)) { ++ // fix no menu borders + Graphics g2 = img.getGraphics(); + Color c = new Color(border); + g2.setColor(new Color(Math.max((int) (c.getRed() * 0.8), 0), +-- +2.33.0 + diff --git a/Backport-JDK-8337334-Test-tools-javac-7142086-T71420.patch b/Backport-JDK-8337334-Test-tools-javac-7142086-T71420.patch new file mode 100644 index 0000000..7e8b386 --- /dev/null +++ b/Backport-JDK-8337334-Test-tools-javac-7142086-T71420.patch @@ -0,0 +1,54 @@ +Subject: Backport JDK-8337334 Test tools/javac/7142086/T7142086.java timeout with fastdebug binary + +--- + test/langtools/TEST.ROOT | 3 ++- + test/langtools/tools/javac/7142086/T7142086.java | 12 ++++++++++-- + 2 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/test/langtools/TEST.ROOT b/test/langtools/TEST.ROOT +index da884dee1..938c7674b 100644 +--- a/test/langtools/TEST.ROOT ++++ b/test/langtools/TEST.ROOT +@@ -42,4 +42,5 @@ requires.extraPropDefns.vmOpts = \ + -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI \ + --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED + requires.properties= \ +- vm.continuations ++ vm.continuations \ ++ vm.debug +diff --git a/test/langtools/tools/javac/7142086/T7142086.java b/test/langtools/tools/javac/7142086/T7142086.java +index bc8260bd4..b6521b7ff 100644 +--- a/test/langtools/tools/javac/7142086/T7142086.java ++++ b/test/langtools/tools/javac/7142086/T7142086.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2012, 2015, 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 +@@ -23,12 +23,20 @@ + + /* + * @test +- * @bug 7142086 ++ * @bug 7142086 8337334 ++ * @requires vm.debug == false + * @summary performance problem in Check.checkOverrideClashes(...) + * @modules jdk.compiler + * @run main/timeout=10 T7142086 + */ + ++/* ++ * @test ++ * @requires vm.debug == true ++ * @modules jdk.compiler ++ * @run main/timeout=20 T7142086 ++ */ ++ + import com.sun.source.util.JavacTask; + import java.net.URI; + import java.util.List; +-- +2.33.0 + diff --git a/Backport-JDK-8337679-Memset-warning-in-src-hotspot-s.patch b/Backport-JDK-8337679-Memset-warning-in-src-hotspot-s.patch new file mode 100644 index 0000000..ad77865 --- /dev/null +++ b/Backport-JDK-8337679-Memset-warning-in-src-hotspot-s.patch @@ -0,0 +1,29 @@ +Subject: Backport JDK-8337679 Memset warning in src/hotspot/share/adlc/adlArena.cpp + +--- + src/hotspot/share/adlc/adlArena.cpp | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/hotspot/share/adlc/adlArena.cpp b/src/hotspot/share/adlc/adlArena.cpp +index d29a255a9..f0f489d90 100644 +--- a/src/hotspot/share/adlc/adlArena.cpp ++++ b/src/hotspot/share/adlc/adlArena.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 2023, 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 +@@ -62,8 +62,6 @@ void AdlChunk::chop() { + AdlChunk *k = this; + while( k ) { + AdlChunk *tmp = k->_next; +- // clear out this chunk (to detect allocation bugs) +- memset(k, 0xBE, k->_len); + free(k); // Free chunk (was malloc'd) + k = tmp; + } +-- +2.33.0 + diff --git a/Backport-JDK-8338010-WB_IsFrameDeoptimized-miss-Reso.patch b/Backport-JDK-8338010-WB_IsFrameDeoptimized-miss-Reso.patch new file mode 100644 index 0000000..761150f --- /dev/null +++ b/Backport-JDK-8338010-WB_IsFrameDeoptimized-miss-Reso.patch @@ -0,0 +1,28 @@ +Subject: Backport JDK-8338010 WB_IsFrameDeoptimized miss ResourceMark + +--- + src/hotspot/share/prims/whitebox.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp +index 4a7e69ca8..f83e84e30 100644 +--- a/src/hotspot/share/prims/whitebox.cpp ++++ b/src/hotspot/share/prims/whitebox.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 +@@ -771,6 +771,7 @@ WB_END + WB_ENTRY(jboolean, WB_IsFrameDeoptimized(JNIEnv* env, jobject o, jint depth)) + bool result = false; + if (thread->has_last_Java_frame()) { ++ ResourceMark rm(THREAD); + RegisterMap reg_map(thread, + RegisterMap::UpdateMap::include, + RegisterMap::ProcessFrames::include, +-- +2.33.0 + diff --git a/Backport-JDK-8338938-The-result-of-the-combine-metho.patch b/Backport-JDK-8338938-The-result-of-the-combine-metho.patch new file mode 100644 index 0000000..a5ff5fc --- /dev/null +++ b/Backport-JDK-8338938-The-result-of-the-combine-metho.patch @@ -0,0 +1,82 @@ +Subject: Backport JDK-8338938 The result of the combine method of SettingsControl is not used + +--- + .../classes/jdk/jfr/internal/Control.java | 4 +-- + .../jfr/api/settings/TestFilterEvents.java | 31 ++++++++++++++++++- + 2 files changed, 32 insertions(+), 3 deletions(-) + +diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/Control.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/Control.java +index 339346bd6..fbc4d4c91 100644 +--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/Control.java ++++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/Control.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -136,7 +136,7 @@ final class Control { + @Override + public String run() { + try { +- delegate.combine(Collections.unmodifiableSet(values)); ++ return delegate.combine(Collections.unmodifiableSet(values)); + } catch (Throwable t) { + // Prevent malicious user to propagate exception callback in the wrong context + Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occurred when combining " + values + " for " + getClass()); +diff --git a/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java b/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java +index 42bfc3176..67619fb10 100644 +--- a/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java ++++ b/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2018, 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 +@@ -70,6 +70,7 @@ public class TestFilterEvents { + continuous.enable(HTTPGetEvent.class).with("threadNames", "\"unused-threadname-1\""); + assertEquals(0, makeProfilingRecording("\"unused-threadname-2\"")); + assertEquals(1, makeProfilingRecording("\"" + Thread.currentThread().getName() + "\"")); ++ assertEquals(2, makeCombineControl()); + continuous.close(); + } + +@@ -94,4 +95,32 @@ public class TestFilterEvents { + } + } + ++ private static int makeCombineControl() throws Exception { ++ try (Recording r1 = new Recording()) { ++ r1.enable(HTTPPostEvent.class).with("uriFilter", "https://www.example.com/list"); ++ r1.start(); ++ ++ try (Recording r2 = new Recording()) { ++ r2.enable(HTTPPostEvent.class).with("uriFilter", "https://www.example.com/get"); ++ r2.start(); ++ ++ HTTPPostEvent e1 = new HTTPPostEvent(); ++ e1.uri = "https://www.example.com/list"; ++ e1.commit(); ++ ++ HTTPPostEvent e2 = new HTTPPostEvent(); ++ e2.uri = "https://www.example.com/get"; ++ e2.commit(); ++ ++ HTTPPostEvent e3 = new HTTPPostEvent(); ++ e3.uri = "https://www.example.com/put"; ++ e3.commit(); ++ } ++ ++ r1.stop(); ++ ++ return Events.fromRecording(r1).size(); ++ } ++ } ++ + } +-- +2.33.0 + diff --git a/Backport-JDK-8339460-CDS-error-when-module-is-locate.patch b/Backport-JDK-8339460-CDS-error-when-module-is-locate.patch new file mode 100644 index 0000000..66e3b4b --- /dev/null +++ b/Backport-JDK-8339460-CDS-error-when-module-is-locate.patch @@ -0,0 +1,486 @@ +Subject: Backport JDK-8339460 CDS error when module is located in a directory with space in the name + +--- + src/hotspot/share/cds/classListParser.cpp | 6 +- + src/hotspot/share/cds/classListWriter.cpp | 4 +- + src/hotspot/share/cds/filemap.cpp | 4 +- + src/hotspot/share/classfile/classLoader.cpp | 50 +++++- + src/hotspot/share/classfile/classLoader.hpp | 4 +- + .../share/classfile/classLoaderExt.cpp | 12 +- + test/hotspot/jtreg/TEST.groups | 3 +- + .../cds/appcds/complexURI/ComplexURITest.java | 167 ++++++++++++++++++ + .../appcds/complexURI/mypackage/Another.java | 27 +++ + .../cds/appcds/complexURI/mypackage/Main.java | 37 ++++ + 10 files changed, 296 insertions(+), 18 deletions(-) + create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/complexURI/ComplexURITest.java + create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/complexURI/mypackage/Another.java + create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/complexURI/mypackage/Main.java + +diff --git a/src/hotspot/share/cds/classListParser.cpp b/src/hotspot/share/cds/classListParser.cpp +index a1e1a4131..0ba74ca4e 100644 +--- a/src/hotspot/share/cds/classListParser.cpp ++++ b/src/hotspot/share/cds/classListParser.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2015, 2023, 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 +@@ -472,7 +472,9 @@ InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS + THROW_NULL(vmSymbols::java_lang_ClassNotFoundException()); + } + +- InstanceKlass* k = UnregisteredClasses::load_class(class_name, _source, CHECK_NULL); ++ ResourceMark rm; ++ char * source_path = os::strdup_check_oom(ClassLoader::uri_to_path(_source)); ++ InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path, CHECK_NULL); + if (k->local_interfaces()->length() != _interfaces->length()) { + print_specified_interfaces(); + print_actual_interfaces(k); +diff --git a/src/hotspot/share/cds/classListWriter.cpp b/src/hotspot/share/cds/classListWriter.cpp +index 2a65ee51d..53637429a 100644 +--- a/src/hotspot/share/cds/classListWriter.cpp ++++ b/src/hotspot/share/cds/classListWriter.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2021, 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 +@@ -171,6 +171,8 @@ void ClassListWriter::write_to_stream(const InstanceKlass* k, outputStream* stre + } + } + ++ // NB: the string following "source: " is not really a proper file name, but rather ++ // a truncated URI referring to a file. It must be decoded after reading. + #ifdef _WINDOWS + // "file:/C:/dir/foo.jar" -> "C:/dir/foo.jar" + stream->print(" source: %s", cfs->source() + 6); +diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp +index 023c0762a..f56920c64 100644 +--- a/src/hotspot/share/cds/filemap.cpp ++++ b/src/hotspot/share/cds/filemap.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2023, 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 +@@ -583,7 +583,7 @@ int FileMapInfo::get_module_shared_path_index(Symbol* location) { + + // skip_uri_protocol was also called during dump time -- see ClassLoaderExt::process_module_table() + ResourceMark rm; +- const char* file = ClassLoader::skip_uri_protocol(location->as_C_string()); ++ const char* file = ClassLoader::uri_to_path(location->as_C_string()); + for (int i = ClassLoaderExt::app_module_paths_start_index(); i < get_number_of_shared_paths(); i++) { + SharedClassPathEntry* ent = shared_path(i); + assert(ent->in_named_module(), "must be"); +diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp +index 5e89673a5..74b9d9300 100644 +--- a/src/hotspot/share/classfile/classLoader.cpp ++++ b/src/hotspot/share/classfile/classLoader.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2023, 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 +@@ -78,6 +78,9 @@ + #include "utilities/macros.hpp" + #include "utilities/utf8.hpp" + ++#include ++#include ++ + // Entry point in java.dll for path canonicalization + + typedef int (*canonicalize_fn_t)(const char *orig, char *out, int len); +@@ -1223,7 +1226,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR + } + + #if INCLUDE_CDS +-char* ClassLoader::skip_uri_protocol(char* source) { ++static const char* skip_uri_protocol(const char* source) { + if (strncmp(source, "file:", 5) == 0) { + // file: protocol path could start with file:/ or file:/// + // locate the char after all the forward slashes +@@ -1242,6 +1245,47 @@ char* ClassLoader::skip_uri_protocol(char* source) { + return source; + } + ++static char decode_percent_encoded(const char *str, size_t& index) { ++ if (str[index] == '%' ++ && isxdigit(str[index + 1]) ++ && isxdigit(str[index + 2])) { ++ char hex[3]; ++ hex[0] = str[index + 1]; ++ hex[1] = str[index + 2]; ++ hex[2] = '\0'; ++ index += 2; ++ return (char) strtol(hex, NULL, 16); ++ } ++ return str[index]; ++} ++ ++char* ClassLoader::uri_to_path(const char* uri) { ++ const size_t len = strlen(uri) + 1; ++ char* path = NEW_RESOURCE_ARRAY(char, len); ++ ++ uri = skip_uri_protocol(uri); ++ ++ if (strncmp(uri, "//", 2) == 0) { ++ // Skip the empty "authority" part ++ uri += 2; ++ } ++ ++#ifdef _WINDOWS ++ if (uri[0] == '/') { ++ // Absolute path name on Windows does not begin with a slash ++ uri += 1; ++ } ++#endif ++ ++ size_t path_index = 0; ++ for (size_t i = 0; i < strlen(uri); ++i) { ++ char decoded = decode_percent_encoded(uri, i); ++ path[path_index++] = decoded; ++ } ++ path[path_index] = '\0'; ++ return path; ++} ++ + // Record the shared classpath index and loader type for classes loaded + // by the builtin loaders at dump time. + void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik, +@@ -1275,7 +1319,7 @@ void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik, + // Save the path from the file: protocol or the module name from the jrt: protocol + // if no protocol prefix is found, path is the same as stream->source(). This path + // must be valid since the class has been successfully parsed. +- char* path = skip_uri_protocol(src); ++ const char* path = ClassLoader::uri_to_path(src); + assert(path != nullptr, "sanity"); + for (int i = 0; i < FileMapInfo::get_number_of_shared_paths(); i++) { + SharedClassPathEntry* ent = FileMapInfo::shared_path(i); +diff --git a/src/hotspot/share/classfile/classLoader.hpp b/src/hotspot/share/classfile/classLoader.hpp +index 4cb196719..2f464063e 100644 +--- a/src/hotspot/share/classfile/classLoader.hpp ++++ b/src/hotspot/share/classfile/classLoader.hpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2023, 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 +@@ -364,7 +364,7 @@ class ClassLoader: AllStatic { + // entries during shared classpath setup time. + static int num_module_path_entries(); + static void exit_with_path_failure(const char* error, const char* message); +- static char* skip_uri_protocol(char* source); ++ static char* uri_to_path(const char* uri); + static void record_result(JavaThread* current, InstanceKlass* ik, + const ClassFileStream* stream, bool redefined); + #endif +diff --git a/src/hotspot/share/classfile/classLoaderExt.cpp b/src/hotspot/share/classfile/classLoaderExt.cpp +index c9fd8173b..5334b118e 100644 +--- a/src/hotspot/share/classfile/classLoaderExt.cpp ++++ b/src/hotspot/share/classfile/classLoaderExt.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2015, 2023, 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 +@@ -98,12 +98,10 @@ void ClassLoaderExt::process_module_table(JavaThread* current, ModuleEntryTable* + ModulePathsGatherer(JavaThread* current, GrowableArray* module_paths) : + _current(current), _module_paths(module_paths) {} + void do_module(ModuleEntry* m) { +- char* path = m->location()->as_C_string(); +- if (strncmp(path, "file:", 5) == 0) { +- path = ClassLoader::skip_uri_protocol(path); +- char* path_copy = NEW_RESOURCE_ARRAY(char, strlen(path) + 1); +- strcpy(path_copy, path); +- _module_paths->append(path_copy); ++ char* uri = m->location()->as_C_string(); ++ if (strncmp(uri, "file:", 5) == 0) { ++ char* path = ClassLoader::uri_to_path(uri); ++ _module_paths->append(path); + } + } + }; +diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups +index 4923fbd5b..4c7352956 100644 +--- a/test/hotspot/jtreg/TEST.groups ++++ b/test/hotspot/jtreg/TEST.groups +@@ -1,5 +1,5 @@ + # +-# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2013, 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 +@@ -430,6 +430,7 @@ hotspot_cds_only = \ + hotspot_appcds_dynamic = \ + runtime/cds/appcds/ \ + -runtime/cds/appcds/cacheObject \ ++ -runtime/cds/appcds/complexURI \ + -runtime/cds/appcds/customLoader \ + -runtime/cds/appcds/dynamicArchive \ + -runtime/cds/appcds/loaderConstraints/DynamicLoaderConstraintsTest.java \ +diff --git a/test/hotspot/jtreg/runtime/cds/appcds/complexURI/ComplexURITest.java b/test/hotspot/jtreg/runtime/cds/appcds/complexURI/ComplexURITest.java +new file mode 100644 +index 000000000..409e37e10 +--- /dev/null ++++ b/test/hotspot/jtreg/runtime/cds/appcds/complexURI/ComplexURITest.java +@@ -0,0 +1,167 @@ ++/* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2024 JetBrains s.r.o. ++ * 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 Verifies that CDS works with jar located in directories ++ * with names that need escaping ++ * @bug 8339460 ++ * @requires vm.cds ++ * @requires vm.cds.custom.loaders ++ * @requires vm.flagless ++ * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds ++ * @compile mypackage/Main.java mypackage/Another.java ++ * @run main/othervm ComplexURITest ++ */ ++ ++import jdk.test.lib.process.OutputAnalyzer; ++import jdk.test.lib.process.ProcessTools; ++import jdk.test.lib.Platform; ++ ++import java.io.File; ++import java.nio.file.Files; ++import java.nio.file.Path; ++ ++public class ComplexURITest { ++ final static String moduleName = "mymodule"; ++ ++ public static void main(String[] args) throws Exception { ++ System.setProperty("test.noclasspath", "true"); ++ String jarFile = JarBuilder.build(moduleName, "mypackage/Main", "mypackage/Another"); ++ ++ Path subDir = Path.of(".", "dir with space"); ++ Files.createDirectory(subDir); ++ Path newJarFilePath = subDir.resolve(moduleName + ".jar"); ++ Files.move(Path.of(jarFile), newJarFilePath); ++ jarFile = newJarFilePath.toString(); ++ ++ final String listFileName = "test-classlist.txt"; ++ final String staticArchiveName = "test-static.jsa"; ++ final String dynamicArchiveName = "test-dynamic.jsa"; ++ ++ // Verify static archive creation and use ++ File fileList = new File(listFileName); ++ delete(fileList.toPath()); ++ File staticArchive = new File(staticArchiveName); ++ delete(staticArchive.toPath()); ++ ++ createClassList(jarFile, listFileName); ++ if (!fileList.exists()) { ++ throw new RuntimeException("No class list created at " + fileList); ++ } ++ ++ createArchive(jarFile, listFileName, staticArchiveName); ++ if (!staticArchive.exists()) { ++ throw new RuntimeException("No shared classes archive created at " + staticArchive); ++ } ++ ++ useArchive(jarFile, staticArchiveName); ++ ++ // Verify dynamic archive creation and use ++ File dynamicArchive = new File(dynamicArchiveName); ++ delete(dynamicArchive.toPath()); ++ ++ createDynamicArchive(jarFile, dynamicArchiveName); ++ if (!dynamicArchive.exists()) { ++ throw new RuntimeException("No dynamic archive created at " + dynamicArchive); ++ } ++ ++ testDynamicArchive(jarFile, dynamicArchiveName); ++ } ++ ++ private static void delete(Path path) throws Exception { ++ if (Files.exists(path)) { ++ if (Platform.isWindows()) { ++ Files.setAttribute(path, "dos:readonly", false); ++ } ++ Files.delete(path); ++ } ++ } ++ ++ private static void createClassList(String jarFile, String list) throws Exception { ++ String[] launchArgs = { ++ "-XX:DumpLoadedClassList=" + list, ++ "--module-path", ++ jarFile, ++ "--module", ++ moduleName + "/mypackage.Main"}; ++ ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); ++ OutputAnalyzer output = TestCommon.executeAndLog(pb, "create-list"); ++ output.shouldHaveExitValue(0); ++ } ++ ++ private static void createArchive(String jarFile, String list, String archive) throws Exception { ++ String[] launchArgs = { ++ "-Xshare:dump", ++ "-XX:SharedClassListFile=" + list, ++ "-XX:SharedArchiveFile=" + archive, ++ "--module-path", ++ jarFile, ++ "--module", ++ moduleName + "/mypackage.Main"}; ++ ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); ++ OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-archive"); ++ output.shouldHaveExitValue(0); ++ } ++ ++ private static void useArchive(String jarFile, String archive) throws Exception { ++ String[] launchArgs = { ++ "-Xshare:on", ++ "-XX:SharedArchiveFile=" + archive, ++ "--module-path", ++ jarFile, ++ "--module", ++ moduleName + "/mypackage.Main"}; ++ ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); ++ OutputAnalyzer output = TestCommon.executeAndLog(pb, "use-archive"); ++ output.shouldHaveExitValue(0); ++ } ++ ++ private static void createDynamicArchive(String jarFile, String archive) throws Exception { ++ String[] launchArgs = { ++ "-XX:ArchiveClassesAtExit=" + archive, ++ "--module-path", ++ jarFile, ++ "--module", ++ moduleName + "/mypackage.Main"}; ++ ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); ++ OutputAnalyzer output = TestCommon.executeAndLog(pb, "dynamic-archive"); ++ output.shouldHaveExitValue(0); ++ } ++ ++ private static void testDynamicArchive(String jarFile, String archive) throws Exception { ++ String[] launchArgs = { ++ "-XX:SharedArchiveFile=" + archive, ++ "-XX:+PrintSharedArchiveAndExit", ++ "--module-path", ++ jarFile, ++ "--module", ++ moduleName + "/mypackage.Main"}; ++ ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); ++ OutputAnalyzer output = TestCommon.executeAndLog(pb, "dynamic-archive"); ++ output.shouldHaveExitValue(0); ++ output.shouldContain("archive is valid"); ++ output.shouldContain(": mypackage.Main app_loader"); ++ output.shouldContain(": mypackage.Another unregistered_loader"); ++ } ++} +diff --git a/test/hotspot/jtreg/runtime/cds/appcds/complexURI/mypackage/Another.java b/test/hotspot/jtreg/runtime/cds/appcds/complexURI/mypackage/Another.java +new file mode 100644 +index 000000000..106dfd490 +--- /dev/null ++++ b/test/hotspot/jtreg/runtime/cds/appcds/complexURI/mypackage/Another.java +@@ -0,0 +1,27 @@ ++/* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2024 JetBrains s.r.o. ++ * 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. ++ */ ++ ++package mypackage; ++ ++public class Another { ++} +diff --git a/test/hotspot/jtreg/runtime/cds/appcds/complexURI/mypackage/Main.java b/test/hotspot/jtreg/runtime/cds/appcds/complexURI/mypackage/Main.java +new file mode 100644 +index 000000000..fdb79e895 +--- /dev/null ++++ b/test/hotspot/jtreg/runtime/cds/appcds/complexURI/mypackage/Main.java +@@ -0,0 +1,37 @@ ++/* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2024 JetBrains s.r.o. ++ * 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. ++ */ ++ ++package mypackage; ++ ++import java.net.URL; ++import java.net.URLClassLoader; ++ ++public class Main { ++ public static void main(String[] args) throws Exception { ++ URL url1 = Main.class.getProtectionDomain().getCodeSource().getLocation(); ++ System.out.println("Will load Another from " + url1); ++ ClassLoader cl = URLClassLoader.newInstance(new URL[] { url1 }, null); ++ var anotherClass = cl.loadClass("mypackage.Another"); ++ System.out.println("Class " + anotherClass + " loaded successfully"); ++ } ++} +-- +2.33.0 + diff --git a/Backport-JDK-8340186-Shenandoah-Missing-load_referen.patch b/Backport-JDK-8340186-Shenandoah-Missing-load_referen.patch new file mode 100644 index 0000000..f6ca198 --- /dev/null +++ b/Backport-JDK-8340186-Shenandoah-Missing-load_referen.patch @@ -0,0 +1,30 @@ +Subject: Backport JDK-8340186 Shenandoah: Missing load_reference_barrier_phantom_narrow match in is_shenandoah_lrb_call + +--- + .../share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp +index ac3afa774..da9fd5466 100644 +--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp ++++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2018, 2021, Red Hat, Inc. All rights reserved. ++ * Copyright (c) 2018, 2023, 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 +@@ -306,7 +306,8 @@ bool ShenandoahBarrierSetC2::is_shenandoah_lrb_call(Node* call) { + (entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_strong_narrow)) || + (entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_weak)) || + (entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_weak_narrow)) || +- (entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_phantom)); ++ (entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_phantom)) || ++ (entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_phantom_narrow)); + } + + bool ShenandoahBarrierSetC2::is_shenandoah_marking_if(PhaseValues* phase, Node* n) { +-- +2.33.0 + diff --git a/Backport-JDK-8340273-Remove-CounterHalfLifeTime.patch b/Backport-JDK-8340273-Remove-CounterHalfLifeTime.patch new file mode 100644 index 0000000..e9162b3 --- /dev/null +++ b/Backport-JDK-8340273-Remove-CounterHalfLifeTime.patch @@ -0,0 +1,23 @@ +Subject: Backport JDK-8340273 Remove CounterHalfLifeTime + +--- + src/hotspot/share/runtime/globals.hpp | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp +index a066d0d37..6f8b3e85e 100644 +--- a/src/hotspot/share/runtime/globals.hpp ++++ b/src/hotspot/share/runtime/globals.hpp +@@ -1221,9 +1221,6 @@ const int ObjectAlignmentInBytes = 8; + product(bool, UseCounterDecay, true, \ + "Adjust recompilation counters") \ + \ +- develop(intx, CounterHalfLifeTime, 30, \ +- "Half-life time of invocation counters (in seconds)") \ +- \ + develop(intx, CounterDecayMinIntervalLength, 500, \ + "The minimum interval (in milliseconds) between invocation of " \ + "CounterDecay") \ +-- +2.33.0 + diff --git a/Backport-JDK-8340623-Remove-outdated-PROCESSOR_ARCHI.patch b/Backport-JDK-8340623-Remove-outdated-PROCESSOR_ARCHI.patch new file mode 100644 index 0000000..cfe3c65 --- /dev/null +++ b/Backport-JDK-8340623-Remove-outdated-PROCESSOR_ARCHI.patch @@ -0,0 +1,30 @@ +Subject: Backport JDK-8340623 Remove outdated PROCESSOR_ARCHITECTURE_IA64 from Windows coding + +--- + src/java.base/windows/native/libjava/java_props_md.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/src/java.base/windows/native/libjava/java_props_md.c b/src/java.base/windows/native/libjava/java_props_md.c +index 2ff4c9e88..280747d0d 100644 +--- a/src/java.base/windows/native/libjava/java_props_md.c ++++ b/src/java.base/windows/native/libjava/java_props_md.c +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 2023, 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 +@@ -263,9 +263,6 @@ cpu_isalist(void) + SYSTEM_INFO info; + GetSystemInfo(&info); + switch (info.wProcessorArchitecture) { +-#ifdef PROCESSOR_ARCHITECTURE_IA64 +- case PROCESSOR_ARCHITECTURE_IA64: return "ia64"; +-#endif + #ifdef PROCESSOR_ARCHITECTURE_AMD64 + case PROCESSOR_ARCHITECTURE_AMD64: return "amd64"; + #endif +-- +2.33.0 + diff --git a/Backport-of-8330191-Fix-typo-in-precompiled.hpp.patch b/Backport-of-8330191-Fix-typo-in-precompiled.hpp.patch new file mode 100644 index 0000000..d9c9726 --- /dev/null +++ b/Backport-of-8330191-Fix-typo-in-precompiled.hpp.patch @@ -0,0 +1,29 @@ +Subject: Backport of 8330191: Fix typo in precompiled.hpp + +--- + src/hotspot/share/precompiled/precompiled.hpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/hotspot/share/precompiled/precompiled.hpp b/src/hotspot/share/precompiled/precompiled.hpp +index c6b866801..e8dec0fc6 100644 +--- a/src/hotspot/share/precompiled/precompiled.hpp ++++ b/src/hotspot/share/precompiled/precompiled.hpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2010, 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 +@@ -29,7 +29,7 @@ + + // These header files are included in at least 130 C++ files, as of + // measurements made in November 2018. This list excludes files named +-// *.include.hpp, since including them decreased build performance. ++// *.incline.hpp, since including them decreased build performance. + + #include "classfile/classLoaderData.hpp" + #include "classfile/javaClasses.hpp" +-- +2.33.0 + diff --git a/Backport-of-8333088-ubsan-shenandoahAdaptiveHeuristi.patch b/Backport-of-8333088-ubsan-shenandoahAdaptiveHeuristi.patch new file mode 100644 index 0000000..5cb3b12 --- /dev/null +++ b/Backport-of-8333088-ubsan-shenandoahAdaptiveHeuristi.patch @@ -0,0 +1,22 @@ +Subject: Backport of 8333088: ubsan: shenandoahAdaptiveHeuristics.cpp: runtime error: division by zero + +--- + .../gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp +index a8f71c8c5..4f46611c4 100644 +--- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp ++++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp +@@ -243,7 +243,7 @@ bool ShenandoahAdaptiveHeuristics::should_start_gc() { + + double avg_cycle_time = _gc_time_history->davg() + (_margin_of_error_sd * _gc_time_history->dsd()); + double avg_alloc_rate = _allocation_rate.upper_bound(_margin_of_error_sd); +- if (avg_cycle_time > allocation_headroom / avg_alloc_rate) { ++ if (avg_cycle_time * avg_alloc_rate > allocation_headroom) { + log_info(gc)("Trigger: Average GC time (%.2f ms) is above the time for average allocation rate (%.0f %sB/s) to deplete free headroom (" SIZE_FORMAT "%s) (margin of error = %.2f)", + avg_cycle_time * 1000, + byte_size_in_proper_unit(avg_alloc_rate), proper_unit_for_byte_size(avg_alloc_rate), +-- +2.33.0 + diff --git a/Backport-of-8337067-Test-runtime-classFileParserBug-.patch b/Backport-of-8337067-Test-runtime-classFileParserBug-.patch new file mode 100644 index 0000000..1005828 --- /dev/null +++ b/Backport-of-8337067-Test-runtime-classFileParserBug-.patch @@ -0,0 +1,28 @@ +Subject: Backport of 8337067: Test runtime/classFileParserBug/Bad_NCDFE_Msg.java won't compile + +--- + .../jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/test/hotspot/jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java b/test/hotspot/jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java +index 1baf5bdc8..346794d4c 100644 +--- a/test/hotspot/jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java ++++ b/test/hotspot/jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2022, 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 +@@ -31,6 +31,7 @@ + * java.management + * @compile C.java + * @run driver Bad_NCDFE_Msg ++ **/ + + import java.io.File; + import jdk.test.lib.process.ProcessTools; +-- +2.33.0 + diff --git a/Backport-of-8337245-Fix-wrong-comment-of-StringConca.patch b/Backport-of-8337245-Fix-wrong-comment-of-StringConca.patch new file mode 100644 index 0000000..4893b74 --- /dev/null +++ b/Backport-of-8337245-Fix-wrong-comment-of-StringConca.patch @@ -0,0 +1,49 @@ +Subject: Backport of 8337245: Fix wrong comment of StringConcatHelper + +--- + .../share/classes/java/lang/StringConcatHelper.java | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/java.base/share/classes/java/lang/StringConcatHelper.java b/src/java.base/share/classes/java/lang/StringConcatHelper.java +index 139181af0..db4b2d690 100644 +--- a/src/java.base/share/classes/java/lang/StringConcatHelper.java ++++ b/src/java.base/share/classes/java/lang/StringConcatHelper.java +@@ -228,7 +228,7 @@ final class StringConcatHelper { + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to +- * @param value boolean value to encode ++ * @param value char value to encode + * @param prefix a constant to prepend before value + * @return updated index (coder value retained) + */ +@@ -263,7 +263,7 @@ final class StringConcatHelper { + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to +- * @param value boolean value to encode ++ * @param value int value to encode + * @param prefix a constant to prepend before value + * @return updated index (coder value retained) + */ +@@ -298,7 +298,7 @@ final class StringConcatHelper { + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to +- * @param value boolean value to encode ++ * @param value long value to encode + * @param prefix a constant to prepend before value + * @return updated index (coder value retained) + */ +@@ -335,7 +335,7 @@ final class StringConcatHelper { + * @param indexCoder final char index in the buffer, along with coder packed + * into higher bits. + * @param buf buffer to append to +- * @param value boolean value to encode ++ * @param value String value to encode + * @param prefix a constant to prepend before value + * @return updated index (coder value retained) + */ +-- +2.33.0 + diff --git a/Backport-of-8337274-Remove-repeated-the.patch b/Backport-of-8337274-Remove-repeated-the.patch new file mode 100644 index 0000000..edf753a --- /dev/null +++ b/Backport-of-8337274-Remove-repeated-the.patch @@ -0,0 +1,40 @@ +Subject: Backport of 8337274: Remove repeated 'the' + +--- + .../share/classes/javax/swing/text/html/StyleSheet.java | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java b/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java +index fd3c75829..89e8b63d6 100644 +--- a/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java ++++ b/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java +@@ -688,7 +688,7 @@ public class StyleSheet extends StyleContext { + * to return an AttributeSet that provides some sort of + * attribute conversion. + * +- * @param a The set of attributes to be represented in the ++ * @param a The set of attributes to be represented in + * the compact form. + */ + protected SmallAttributeSet createSmallAttributeSet(AttributeSet a) { +@@ -704,7 +704,7 @@ public class StyleSheet extends StyleContext { + * to return a MutableAttributeSet that provides some sort of + * attribute conversion. + * +- * @param a The set of attributes to be represented in the ++ * @param a The set of attributes to be represented in + * the larger form. + */ + protected MutableAttributeSet createLargeAttributeSet(AttributeSet a) { +@@ -2137,7 +2137,7 @@ public class StyleSheet extends StyleContext { + /** + * Returns a string that represents the value + * of the HTML.Attribute.TYPE attribute. +- * If this attributes is not defined, then ++ * If this attributes is not defined, + * then the type defaults to "disc" unless + * the tag is on Ordered list. In the case + * of the latter, the default type is "decimal". +-- +2.33.0 + diff --git a/Backport-of-8337712-Wrong-javadoc-in-java.util.Date-.patch b/Backport-of-8337712-Wrong-javadoc-in-java.util.Date-.patch new file mode 100644 index 0000000..4b4202a --- /dev/null +++ b/Backport-of-8337712-Wrong-javadoc-in-java.util.Date-.patch @@ -0,0 +1,29 @@ +Subject: Backport of 8337712: Wrong javadoc in java.util.Date#toString(): 61 and right parenthesis + +--- + src/java.base/share/classes/java/util/Date.java | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/java.base/share/classes/java/util/Date.java b/src/java.base/share/classes/java/util/Date.java +index 1850564d8..aa16f2a75 100644 +--- a/src/java.base/share/classes/java/util/Date.java ++++ b/src/java.base/share/classes/java/util/Date.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1994, 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 +@@ -1012,7 +1012,7 @@ public class Date + *
  • {@code mm} is the minute within the hour ({@code 00} through + * {@code 59}), as two decimal digits. + *
  • {@code ss} is the second within the minute ({@code 00} through +- * {@code 61}, as two decimal digits. ++ * {@code 61}), as two decimal digits. + *
  • {@code zzz} is the time zone (and may reflect daylight saving + * time). Standard time zone abbreviations include those + * recognized by the method {@code parse}. If time zone +-- +2.33.0 + diff --git a/Backport-of-8337787-Fix-Wzero-as-null-pointer-consta.patch b/Backport-of-8337787-Fix-Wzero-as-null-pointer-consta.patch new file mode 100644 index 0000000..7583835 --- /dev/null +++ b/Backport-of-8337787-Fix-Wzero-as-null-pointer-consta.patch @@ -0,0 +1,33 @@ +Subject: Backport of 8337787: Fix -Wzero-as-null-pointer-constant warnings when JVMTI feature is disabled + +--- + src/hotspot/share/prims/jvmtiExport.hpp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/hotspot/share/prims/jvmtiExport.hpp b/src/hotspot/share/prims/jvmtiExport.hpp +index 805c8c090..d8e20086b 100644 +--- a/src/hotspot/share/prims/jvmtiExport.hpp ++++ b/src/hotspot/share/prims/jvmtiExport.hpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 2023, 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 +@@ -279,10 +279,10 @@ class JvmtiExport : public AllStatic { + } + + // field access management +- static address get_field_access_count_addr() NOT_JVMTI_RETURN_(0); ++ static address get_field_access_count_addr() NOT_JVMTI_RETURN_(nullptr); + + // field modification management +- static address get_field_modification_count_addr() NOT_JVMTI_RETURN_(0); ++ static address get_field_modification_count_addr() NOT_JVMTI_RETURN_(nullptr); + + // ----------------- + +-- +2.33.0 + diff --git a/Backport-of-JDK-8316895-SeenThread::print_action_que.patch b/Backport-of-JDK-8316895-SeenThread::print_action_que.patch new file mode 100644 index 0000000..0645207 --- /dev/null +++ b/Backport-of-JDK-8316895-SeenThread::print_action_que.patch @@ -0,0 +1,40 @@ +Subject: Backport of JDK-8316895 SeenThread::print_action_queue called on a null pointer + +--- + src/hotspot/share/classfile/placeholders.cpp | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/src/hotspot/share/classfile/placeholders.cpp b/src/hotspot/share/classfile/placeholders.cpp +index 0f08e80dd..555317f63 100644 +--- a/src/hotspot/share/classfile/placeholders.cpp ++++ b/src/hotspot/share/classfile/placeholders.cpp +@@ -80,8 +80,7 @@ public: + void set_next(SeenThread* seen) { _stnext = seen; } + void set_prev(SeenThread* seen) { _stprev = seen; } + +- void print_action_queue(outputStream* st) { +- SeenThread* seen = this; ++ static void print_action_queue(SeenThread* seen, outputStream* st) { + while (seen != nullptr) { + seen->thread()->print_value_on(st); + st->print(", "); +@@ -327,13 +326,13 @@ void PlaceholderEntry::print_on(outputStream* st) const { + } + st->cr(); + st->print("loadInstanceThreadQ threads:"); +- loadInstanceThreadQ()->print_action_queue(st); ++ SeenThread::print_action_queue(loadInstanceThreadQ(), st); + st->cr(); + st->print("superThreadQ threads:"); +- superThreadQ()->print_action_queue(st); ++ SeenThread::print_action_queue(loadInstanceThreadQ(), st); + st->cr(); + st->print("defineThreadQ threads:"); +- defineThreadQ()->print_action_queue(st); ++ SeenThread::print_action_queue(loadInstanceThreadQ(), st); + st->cr(); + } + +-- +2.33.0 + diff --git a/Backport-of-JDK-8328723-IP-Address-error-when-client.patch b/Backport-of-JDK-8328723-IP-Address-error-when-client.patch new file mode 100644 index 0000000..7a56864 --- /dev/null +++ b/Backport-of-JDK-8328723-IP-Address-error-when-client.patch @@ -0,0 +1,40 @@ +Subject: Backport of JDK-8328723 IP Address error when client enables HTTPS endpoint check on server socket + +--- + .../sun/security/ssl/X509TrustManagerImpl.java | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java +index e3df4c162..58794e5dc 100644 +--- a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java ++++ b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2022, 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 +@@ -428,8 +428,17 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager + } + + if (!identifiable) { +- checkIdentity(peerHost, +- trustedChain[0], algorithm, chainsToPublicCA); ++ try { ++ checkIdentity(peerHost, ++ trustedChain[0], algorithm, chainsToPublicCA); ++ } catch(CertificateException ce) { ++ if (checkClientTrusted && "HTTPS".equalsIgnoreCase(algorithm)) { ++ throw new CertificateException("Endpoint Identification Algorithm " + ++ "HTTPS is not supported on the server side"); ++ } else { ++ throw ce; ++ } ++ } + } + } + +-- +2.33.0 + diff --git a/Backport-of-JDK-8332720-ubsan-instanceKlass.cpp:3550.patch b/Backport-of-JDK-8332720-ubsan-instanceKlass.cpp:3550.patch new file mode 100644 index 0000000..d618d2d --- /dev/null +++ b/Backport-of-JDK-8332720-ubsan-instanceKlass.cpp:3550.patch @@ -0,0 +1,32 @@ +Subject: Backport of JDK-8332720 ubsan: instanceKlass.cpp:3550:76: runtime error: member call on null pointer of type 'struct Array' + +--- + src/hotspot/share/oops/instanceKlass.cpp | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp +index 6f0d521b9..edbca5df7 100644 +--- a/src/hotspot/share/oops/instanceKlass.cpp ++++ b/src/hotspot/share/oops/instanceKlass.cpp +@@ -3587,11 +3587,13 @@ void InstanceKlass::print_on(outputStream* st) const { + } + } + st->print(BULLET"method ordering: "); method_ordering()->print_value_on(st); st->cr(); +- st->print(BULLET"default_methods: "); default_methods()->print_value_on(st); st->cr(); +- if (Verbose && default_methods() != nullptr) { +- Array* method_array = default_methods(); +- for (int i = 0; i < method_array->length(); i++) { +- st->print("%d : ", i); method_array->at(i)->print_value(); st->cr(); ++ if (default_methods() != nullptr) { ++ st->print(BULLET"default_methods: "); default_methods()->print_value_on(st); st->cr(); ++ if (Verbose) { ++ Array* method_array = default_methods(); ++ for (int i = 0; i < method_array->length(); i++) { ++ st->print("%d : ", i); method_array->at(i)->print_value(); st->cr(); ++ } + } + } + if (default_vtable_indices() != nullptr) { +-- +2.33.0 + diff --git a/Backport-of-JDK-8336343-Add-more-known-sysroot-libra.patch b/Backport-of-JDK-8336343-Add-more-known-sysroot-libra.patch new file mode 100644 index 0000000..7e53435 --- /dev/null +++ b/Backport-of-JDK-8336343-Add-more-known-sysroot-libra.patch @@ -0,0 +1,39 @@ +Subject: Backport of JDK-8336343 Add more known sysroot library locations for ALSA + +--- + make/autoconf/lib-alsa.m4 | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/make/autoconf/lib-alsa.m4 b/make/autoconf/lib-alsa.m4 +index 19a91f948..8d0fb324c 100644 +--- a/make/autoconf/lib-alsa.m4 ++++ b/make/autoconf/lib-alsa.m4 +@@ -70,6 +70,25 @@ AC_DEFUN_ONCE([LIB_SETUP_ALSA], + PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no]) + fi + fi ++ if test "x$ALSA_FOUND" = xno; then ++ # If we have sysroot set, and no explicit library location is set, ++ # look at known locations in sysroot. ++ if test "x$SYSROOT" != "x" && test "x${with_alsa_lib}" == x; then ++ if test -f "$SYSROOT/usr/lib64/libasound.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then ++ ALSA_LIBS="-L$SYSROOT/usr/lib64 -lasound" ++ ALSA_FOUND=yes ++ elif test -f "$SYSROOT/usr/lib/libasound.so"; then ++ ALSA_LIBS="-L$SYSROOT/usr/lib -lasound" ++ ALSA_FOUND=yes ++ elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libasound.so"; then ++ ALSA_LIBS="-L$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI -lasound" ++ ALSA_FOUND=yes ++ elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libasound.so"; then ++ ALSA_LIBS="-L$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI -lasound" ++ ALSA_FOUND=yes ++ fi ++ fi ++ fi + if test "x$ALSA_FOUND" = xno; then + AC_CHECK_HEADERS([alsa/asoundlib.h], + [ +-- +2.33.0 + diff --git a/backport-of-8339298-Remove-unused-function-declarati.patch b/backport-of-8339298-Remove-unused-function-declarati.patch new file mode 100644 index 0000000..1090411 --- /dev/null +++ b/backport-of-8339298-Remove-unused-function-declarati.patch @@ -0,0 +1,36 @@ +Subject: backport of 8339298: Remove unused function declaration poll_for_safepoint + +--- + src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.hpp | 2 -- + src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp | 2 -- + 2 files changed, 4 deletions(-) + +diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.hpp +index 43ec18925..fcb6d2943 100644 +--- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.hpp ++++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.hpp +@@ -60,8 +60,6 @@ friend class ArrayCopyStub; + void casw(Register addr, Register newval, Register cmpval); + void casl(Register addr, Register newval, Register cmpval); + +- void poll_for_safepoint(relocInfo::relocType rtype, CodeEmitInfo* info = nullptr); +- + static const int max_tableswitches = 20; + struct tableswitch switches[max_tableswitches]; + int tableswitch_count; +diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp +index 04e76796c..a74bf1611 100644 +--- a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp ++++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp +@@ -62,8 +62,6 @@ private: + void caswu(Register addr, Register newval, Register cmpval); + void casl(Register addr, Register newval, Register cmpval); + +- void poll_for_safepoint(relocInfo::relocType rtype, CodeEmitInfo* info = nullptr); +- + void deoptimize_trap(CodeEmitInfo *info); + + enum { +-- +2.33.0 + diff --git a/openjdk-21.spec b/openjdk-21.spec index b10f78f..d7f92a9 100644 --- a/openjdk-21.spec +++ b/openjdk-21.spec @@ -897,7 +897,7 @@ Name: java-21-%{origin} Version: %{newjavaver}.%{buildver} # This package needs `.rolling` as part of Release so as to not conflict on install with # java-X-openjdk. I.e. when latest rolling release is also an LTS release packaged as -Release: 4 +Release: 5 # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons # and this change was brought into RHEL-4. java-1.5.0-ibm packages @@ -973,6 +973,74 @@ Patch7: add-downgrade-the-glibc-symver-of-log2f-posix_spawn.patch Patch8: add-downgrade-the-glibc-symver-of-memcpy.patch Patch9: add-downgrade-the-glibc-symbol-of-fcntl.patch +# 21.0.4 +Patch10: Backport-JDK-8336855-Duplicate-protected-declaration.patch +Patch11: Backport-JDK-8334758-Incorrect-note-in-Javadoc-for-a.patch +Patch12: Backport-JDK-8323699-MessageFormat.toPattern-generat.patch +Patch13: Backport-JDK-8325022-Incorrect-error-message-on-clie.patch +Patch14: Backport-JDK-8333462-Performance-regression-of-new-D.patch +Patch15: Backport-JDK-8332866-Crash-in-ImageIO-JPEG-decoding-.patch +Patch16: Backport-JDK-8333805-Replaying-compilation-with-null.patch +Patch17: Backport-JDK-8332818-ubsan-archiveHeapLoader.cpp:70:.patch +Patch18: Backport-JDK-8333887-ubsan-unsafe.cpp:247:13:-runtim.patch +Patch19: 8339351-Remove-duplicate-line-in-FileMapHeader-print.patch +Patch20: BackPort-JDK-8324580-SIGFPE-on-THP-initialization-on.patch +Patch21: 8339149-jfr_flush_event_writer-return-value-type-mis.patch +Patch22: 8300800-UB-Shift-exponent-32-is-too-large-for-32-bit.patch +Patch23: 8334780-Crash-assert-h_array_list.not_null-failed-in.patch +Patch24: 8337982-Remove-dead-undef-assrt0n.patch +Patch25: Backport-JDK-8334239-Introduce-macro-for-ubsan-metho.patch +Patch26: 8335610-DiagnosticFramework-CmdLine-is_executable-co.patch +Patch27: Backport-of-8337245-Fix-wrong-comment-of-StringConca.patch +Patch28: Backport-of-8337274-Remove-repeated-the.patch +Patch29: backport-of-8339298-Remove-unused-function-declarati.patch +Patch30: Backport-of-8333088-ubsan-shenandoahAdaptiveHeuristi.patch +Patch31: Backport-JDK-8320682-[AArch64]-C1-compilation-fails-.patch +Patch32: BackPort-JDK-8336346-Fix--Wzero-as-null-pointer-cons.patch +Patch33: Backport-JDK-8332524-Instead-of-printing-TLSv1.3,-.patch +Patch34: Backport-JDK-8333149-ubsan-memset-on-nullptr-target-.patch +Patch35: Backport-JDK-8333622-ubsan-relocInfo_x86.cpp:101:56:.patch +Patch36: Backport-JDK-8333354-ubsan-frame.inline.hpp:91:25:-a.patch +Patch37: Backport-JDK-8336080-Fix--Wzero-as-null-pointer-cons.patch +Patch38: Backport-JDK-8336152-Remove-unused-forward-declarati.patch +Patch39: Backport-of-8330191-Fix-typo-in-precompiled.hpp.patch +Patch40: Backport-of-8337787-Fix-Wzero-as-null-pointer-consta.patch +Patch41: Backport-of-8337712-Wrong-javadoc-in-java.util.Date-.patch +Patch42: Backport-of-8337067-Test-runtime-classFileParserBug-.patch +Patch43: Backport-JDK-8333639-ubsan-cppVtables.cpp:81:55-runt.patch +Patch44: Backport-of-JDK-8336343-Add-more-known-sysroot-libra.patch +Patch45: Backport-of-JDK-8316895-SeenThread::print_action_que.patch +Patch46: Backport-of-JDK-8328723-IP-Address-error-when-client.patch +Patch47: Backport-of-JDK-8332720-ubsan-instanceKlass.cpp:3550.patch +Patch48: Backport-JDK-8207908-JMXStatusTest.java-fails-assert.patch +Patch49: Backport-JDK-8328107-Shenandoah-C2-TestVerifyLoopOpt.patch +Patch50: Backport-JDK-8328553-Get-rid-of-JApplet-in-test-jdk-.patch +Patch51: Backport-JDK-8329754-The-ThreadSafe-attribute-is-ign.patch +Patch52: Backport-JDK-8332920-C2-Partial-Peeling-is-wrongly-a.patch +Patch53: Backport-JDK-8335638-Calling-VarHandle.-access-mode-.patch +Patch54: Backport-JDK-8338938-The-result-of-the-combine-metho.patch +Patch55: Backport-JDK-8313909-JVMCI-assert-cp-tag_at-index-.i.patch +Patch56: Backport-JDK-8304484-CDS-dynamic-dumping-incorrectly.patch +Patch57: Backport-JDK-8322812-Manpage-for-jcmd-is-missing-JFR.patch +Patch58: Backport-JDK-8327538-The-SSLExtension-class-specifie.patch +Patch59: Backport-JDK-8331391-Enhance-the-keytool-code-by-inv.patch +Patch60: Backport-JDK-8333599-Improve-description-of-b-matche.patch +Patch61: Backport-JDK-8334123-log-the-opening-of-Type-1-fonts.patch +Patch62: Backport-JDK-8336012-Fix-usages-of-jtreg-reserved-pr.patch +Patch63: Backport-JDK-8336879-Always-true-condition-img-null-.patch +Patch64: Backport-JDK-8337334-Test-tools-javac-7142086-T71420.patch +Patch65: Backport-JDK-8340623-Remove-outdated-PROCESSOR_ARCHI.patch +Patch66: Backport-JDK-8338010-WB_IsFrameDeoptimized-miss-Reso.patch +Patch67: Backport-JDK-8340186-Shenandoah-Missing-load_referen.patch +Patch68: Backport-JDK-8340273-Remove-CounterHalfLifeTime.patch +Patch69: Backport-JDK-8339460-CDS-error-when-module-is-locate.patch +Patch70: Backport-JDK-8332297-annotation-processor-that-gener.patch +Patch71: Backport-JDK-8329174-update-CodeBuffer-layout-in-com.patch +Patch72: Backport-JDK-8325994-JFR-Examples-in-JFR.start-help-.patch +Patch73: Backport-JDK-8325730-StringBuilder.toString-allocati.patch +Patch74: Backport-JDK-8337679-Memset-warning-in-src-hotspot-s.patch +Patch75: Backport-JDK-8326957-Implement-JEP-474-ZGC-Generatio.patch +Patch76: Backport-JDK-8320308-C2-compilation-crashes-in-Libra.patch ############################################ # # LoongArch64 specific patches @@ -1209,6 +1277,73 @@ pushd %{top_level_dir_name} %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch47 -p1 +%patch48 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 +%patch56 -p1 +%patch57 -p1 +%patch58 -p1 +%patch59 -p1 +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 +%patch66 -p1 +%patch67 -p1 +%patch68 -p1 +%patch69 -p1 +%patch70 -p1 +%patch71 -p1 +%patch72 -p1 +%patch73 -p1 +%patch74 -p1 +%patch75 -p1 +%patch76 -p1 popd # openjdk %endif @@ -1769,6 +1904,75 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect %changelog +* Sat Oct 12 2024 Autistic_boyya - 1:21.0.4.7-5 +- add 8300800-UB-Shift-exponent-32-is-too-large-for-32-bit.patch +- add 8334780-Crash-assert-h_array_list.not_null-failed-in.patch +- add 8335610-DiagnosticFramework-CmdLine-is_executable-co.patch +- add 8337982-Remove-dead-undef-assrt0n.patch +- add 8339149-jfr_flush_event_writer-return-value-type-mis.patch +- add 8339351-Remove-duplicate-line-in-FileMapHeader-print.patch +- add BackPort-JDK-8324580-SIGFPE-on-THP-initialization-on.patch +- add BackPort-JDK-8336346-Fix--Wzero-as-null-pointer-cons.patch +- add Backport-JDK-8207908-JMXStatusTest.java-fails-assert.patch +- add Backport-JDK-8304484-CDS-dynamic-dumping-incorrectly.patch +- add Backport-JDK-8313909-JVMCI-assert-cp-tag_at-index-.i.patch +- add Backport-JDK-8320308-C2-compilation-crashes-in-Libra.patch +- add Backport-JDK-8320682-[AArch64]-C1-compilation-fails-.patch +- add Backport-JDK-8322812-Manpage-for-jcmd-is-missing-JFR.patch +- add Backport-JDK-8323699-MessageFormat.toPattern-generat.patch +- add Backport-JDK-8325022-Incorrect-error-message-on-clie.patch +- add Backport-JDK-8325730-StringBuilder.toString-allocati.patch +- add Backport-JDK-8325994-JFR-Examples-in-JFR.start-help-.patch +- add Backport-JDK-8326957-Implement-JEP-474-ZGC-Generatio.patch +- add Backport-JDK-8327538-The-SSLExtension-class-specifie.patch +- add Backport-JDK-8328107-Shenandoah-C2-TestVerifyLoopOpt.patch +- add Backport-JDK-8328553-Get-rid-of-JApplet-in-test-jdk-.patch +- add Backport-JDK-8329174-update-CodeBuffer-layout-in-com.patch +- add Backport-JDK-8329754-The-ThreadSafe-attribute-is-ign.patch +- add Backport-JDK-8331391-Enhance-the-keytool-code-by-inv.patch +- add Backport-JDK-8332297-annotation-processor-that-gener.patch +- add Backport-JDK-8332524-Instead-of-printing-TLSv1.3,-.patch +- add Backport-JDK-8332818-ubsan-archiveHeapLoader.cpp:70:.patch +- add Backport-JDK-8332866-Crash-in-ImageIO-JPEG-decoding-.patch +- add Backport-JDK-8332920-C2-Partial-Peeling-is-wrongly-a.patch +- add Backport-JDK-8333149-ubsan-memset-on-nullptr-target-.patch +- add Backport-JDK-8333354-ubsan-frame.inline.hpp:91:25:-a.patch +- add Backport-JDK-8333462-Performance-regression-of-new-D.patch +- add Backport-JDK-8333599-Improve-description-of-b-matche.patch +- add Backport-JDK-8333622-ubsan-relocInfo_x86.cpp:101:56:.patch +- add Backport-JDK-8333639-ubsan-cppVtables.cpp:81:55-runt.patch +- add Backport-JDK-8333805-Replaying-compilation-with-null.patch +- add Backport-JDK-8333887-ubsan-unsafe.cpp:247:13:-runtim.patch +- add Backport-JDK-8334123-log-the-opening-of-Type-1-fonts.patch +- add Backport-JDK-8334239-Introduce-macro-for-ubsan-metho.patch +- add Backport-JDK-8334758-Incorrect-note-in-Javadoc-for-a.patch +- add Backport-JDK-8335638-Calling-VarHandle.-access-mode-.patch +- add Backport-JDK-8336012-Fix-usages-of-jtreg-reserved-pr.patch +- add Backport-JDK-8336080-Fix--Wzero-as-null-pointer-cons.patch +- add Backport-JDK-8336152-Remove-unused-forward-declarati.patch +- add Backport-JDK-8336855-Duplicate-protected-declaration.patch +- add Backport-JDK-8336879-Always-true-condition-img-null-.patch +- add Backport-JDK-8337334-Test-tools-javac-7142086-T71420.patch +- add Backport-JDK-8337679-Memset-warning-in-src-hotspot-s.patch +- add Backport-JDK-8338010-WB_IsFrameDeoptimized-miss-Reso.patch +- add Backport-JDK-8338938-The-result-of-the-combine-metho.patch +- add Backport-JDK-8339460-CDS-error-when-module-is-locate.patch +- add Backport-JDK-8340186-Shenandoah-Missing-load_referen.patch +- add Backport-JDK-8340273-Remove-CounterHalfLifeTime.patch +- add Backport-JDK-8340623-Remove-outdated-PROCESSOR_ARCHI.patch +- add Backport-of-8330191-Fix-typo-in-precompiled.hpp.patch +- add Backport-of-8333088-ubsan-shenandoahAdaptiveHeuristi.patch +- add Backport-of-8337067-Test-runtime-classFileParserBug-.patch +- add Backport-of-8337245-Fix-wrong-comment-of-StringConca.patch +- add Backport-of-8337274-Remove-repeated-the.patch +- add Backport-of-8337712-Wrong-javadoc-in-java.util.Date-.patch +- add Backport-of-8337787-Fix-Wzero-as-null-pointer-consta.patch +- add Backport-of-JDK-8316895-SeenThread::print_action_que.patch +- add Backport-of-JDK-8328723-IP-Address-error-when-client.patch +- add Backport-of-JDK-8332720-ubsan-instanceKlass.cpp:3550.patch +- add Backport-of-JDK-8336343-Add-more-known-sysroot-libra.patch +- add backport-of-8339298-Remove-unused-function-declarati.patch + * Wed Aug 14 2024 songliyang - 1:21.0.4.7-4 - delete redundant symbols while viewing spec file with vim that make it strange on highlight diff --git a/pr3183-rh1340845-support_system_crypto_policy.patch b/pr3183-rh1340845-support_system_crypto_policy.patch deleted file mode 100644 index 9ca3dc6..0000000 --- a/pr3183-rh1340845-support_system_crypto_policy.patch +++ /dev/null @@ -1,87 +0,0 @@ - -# HG changeset patch -# User andrew -# Date 1478057514 0 -# Node ID 1c4d5cb2096ae55106111da200b0bcad304f650c -# Parent 3d53f19b48384e5252f4ec8891f7a3a82d77af2a -diff -r 3d53f19b4838 -r 1c4d5cb2096a src/java.base/share/classes/java/security/Security.java ---- a/src/java.base/share/classes/java/security/Security.java Wed Oct 26 03:51:39 2016 +0100 -+++ b/src/java.base/share/classes/java/security/Security.java Wed Nov 02 03:31:54 2016 +0000 -@@ -43,6 +43,9 @@ - * implementation-specific location, which is typically the properties file - * {@code conf/security/java.security} in the Java installation directory. - * -+ *

    Additional default values of security properties are read from a -+ * system-specific location, if available.

    -+ * - * @author Benjamin Renaud - * @since 1.1 - */ -@@ -52,6 +55,10 @@ - private static final Debug sdebug = - Debug.getInstance("properties"); - -+ /* System property file*/ -+ private static final String SYSTEM_PROPERTIES = -+ "/etc/crypto-policies/back-ends/java.config"; -+ - /* The java.security properties */ - private static Properties props; - -@@ -93,6 +100,7 @@ - if (sdebug != null) { - sdebug.println("reading security properties file: " + - propFile); -+ sdebug.println(props.toString()); - } - } catch (IOException e) { - if (sdebug != null) { -@@ -114,6 +122,31 @@ - } - - if ("true".equalsIgnoreCase(props.getProperty -+ ("security.useSystemPropertiesFile"))) { -+ -+ // now load the system file, if it exists, so its values -+ // will win if they conflict with the earlier values -+ try (BufferedInputStream bis = -+ new BufferedInputStream(new FileInputStream(SYSTEM_PROPERTIES))) { -+ props.load(bis); -+ loadedProps = true; -+ -+ if (sdebug != null) { -+ sdebug.println("reading system security properties file " + -+ SYSTEM_PROPERTIES); -+ sdebug.println(props.toString()); -+ } -+ } catch (IOException e) { -+ if (sdebug != null) { -+ sdebug.println -+ ("unable to load security properties from " + -+ SYSTEM_PROPERTIES); -+ e.printStackTrace(); -+ } -+ } -+ } -+ -+ if ("true".equalsIgnoreCase(props.getProperty - ("security.overridePropertiesFile"))) { - - String extraPropFile = System.getProperty -diff -r 3d53f19b4838 -r 1c4d5cb2096a src/java.base/share/conf/security/java.security ---- a/src/java.base/share/conf/security/java.security Wed Oct 26 03:51:39 2016 +0100 -+++ b/src/java.base/share/conf/security/java.security Wed Nov 02 03:31:54 2016 +0000 -@@ -276,6 +276,13 @@ - security.overridePropertiesFile=true - - # -+# Determines whether this properties file will be appended to -+# using the system properties file stored at -+# /etc/crypto-policies/back-ends/java.config -+# -+security.useSystemPropertiesFile=true -+ -+# - # Determines the default key and trust manager factory algorithms for - # the javax.net.ssl package. - # -- Gitee