diff --git a/8202952.patch b/8202952.patch deleted file mode 100644 index 368a3934ee5c1d0ea1d93bd6b948cc6543f298c7..0000000000000000000000000000000000000000 --- a/8202952.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5fafa8bd0a85d93ff0480bc2d163c4070742d8f5 Mon Sep 17 00:00:00 2001 -Date: Fri, 22 Jan 2021 11:26:11 +0800 -Subject: 8202952:C2:Unexpected dead nodes after - matching - -Bug url: https://bugs.openjdk.java.net/browse/JDK-8202952 ---- - hotspot/src/share/vm/opto/matcher.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp -index 70e8af221..f5d30c3af 100644 ---- a/hotspot/src/share/vm/opto/matcher.cpp -+++ b/hotspot/src/share/vm/opto/matcher.cpp -@@ -2230,6 +2230,7 @@ void Matcher::find_shared( Node *n ) { - // AtomicAdd is not an addressing expression. - // Cheap to find it by looking for screwy base. - !adr->in(AddPNode::Base)->is_top() && -+ LP64_ONLY( off->get_long() == (int) (off->get_long()) && ) // immL32 - // Are there other uses besides address expressions? - !is_visited(adr) ) { - address_visited.set(adr->_idx); // Flag as address_visited --- -2.19.0 - diff --git a/8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch b/8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch deleted file mode 100644 index 5e41bd132d423cc91448e6409f8e871b793b7613..0000000000000000000000000000000000000000 --- a/8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch +++ /dev/null @@ -1,227 +0,0 @@ -From d85c283f3bb1fd5f1d96c076e858a7409af19aae Mon Sep 17 00:00:00 2001 -Subject: 8283441: C2: segmentation fault in ciMethodBlocks::make_block_at(int) - -Bug url: https://bugs.openjdk.org/browse/JDK-8283441 ---- - hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 12 ++++-- - hotspot/src/share/vm/ci/ciMethodBlocks.cpp | 17 +++++--- - .../src/share/vm/compiler/methodLiveness.cpp | 9 ++-- - hotspot/test/compiler/parsing/Custom.jasm | 38 +++++++++++++++++ - ...UnreachableBlockFallsThroughEndOfCode.java | 42 +++++++++++++++++++ - 5 files changed, 106 insertions(+), 12 deletions(-) - create mode 100644 hotspot/test/compiler/parsing/Custom.jasm - create mode 100644 hotspot/test/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java - -diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp -index eb8ffe5e5..db353541f 100644 ---- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp -+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp -@@ -206,8 +206,10 @@ void BlockListBuilder::handle_exceptions(BlockBegin* current, int cur_bci) { - } - - void BlockListBuilder::handle_jsr(BlockBegin* current, int sr_bci, int next_bci) { -- // start a new block after jsr-bytecode and link this block into cfg -- make_block_at(next_bci, current); -+ if (next_bci < method()->code_size()) { -+ // start a new block after jsr-bytecode and link this block into cfg -+ make_block_at(next_bci, current); -+ } - - // start a new block at the subroutine entry at mark it with special flag - BlockBegin* sr_block = make_block_at(sr_bci, current); -@@ -227,6 +229,8 @@ void BlockListBuilder::set_leaders() { - // branch target and a modification of the successor lists. - BitMap bci_block_start = method()->bci_block_start(); - -+ int end_bci = method()->code_size(); -+ - ciBytecodeStream s(method()); - while (s.next() != ciBytecodeStream::EOBC()) { - int cur_bci = s.cur_bci(); -@@ -297,7 +301,9 @@ void BlockListBuilder::set_leaders() { - case Bytecodes::_if_acmpne: // fall through - case Bytecodes::_ifnull: // fall through - case Bytecodes::_ifnonnull: -- make_block_at(s.next_bci(), current); -+ if (s.next_bci() < end_bci) { -+ make_block_at(s.next_bci(), current); -+ } - make_block_at(s.get_dest(), current); - current = NULL; - break; -diff --git a/hotspot/src/share/vm/ci/ciMethodBlocks.cpp b/hotspot/src/share/vm/ci/ciMethodBlocks.cpp -index 3ce828ecb..bb3937c15 100644 ---- a/hotspot/src/share/vm/ci/ciMethodBlocks.cpp -+++ b/hotspot/src/share/vm/ci/ciMethodBlocks.cpp -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2006, 2022, 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,12 +33,13 @@ - - - ciBlock *ciMethodBlocks::block_containing(int bci) { -+ assert(bci >= 0 && bci < _code_size, "valid bytecode range"); - ciBlock *blk = _bci_to_block[bci]; - return blk; - } - - bool ciMethodBlocks::is_block_start(int bci) { -- assert(bci >=0 && bci < _code_size, "valid bytecode range"); -+ assert(bci >= 0 && bci < _code_size, "valid bytecode range"); - ciBlock *b = _bci_to_block[bci]; - assert(b != NULL, "must have block for bytecode"); - return b->start_bci() == bci; -@@ -146,7 +147,9 @@ void ciMethodBlocks::do_analysis() { - case Bytecodes::_ifnonnull : - { - cur_block->set_control_bci(bci); -- ciBlock *fall_through = make_block_at(s.next_bci()); -+ if (s.next_bci() < limit_bci) { -+ ciBlock *fall_through = make_block_at(s.next_bci()); -+ } - int dest_bci = s.get_dest(); - ciBlock *dest = make_block_at(dest_bci); - break; -@@ -166,7 +169,9 @@ void ciMethodBlocks::do_analysis() { - case Bytecodes::_jsr : - { - cur_block->set_control_bci(bci); -- ciBlock *ret = make_block_at(s.next_bci()); -+ if (s.next_bci() < limit_bci) { -+ ciBlock *ret = make_block_at(s.next_bci()); -+ } - int dest_bci = s.get_dest(); - ciBlock *dest = make_block_at(dest_bci); - break; -@@ -224,7 +229,9 @@ void ciMethodBlocks::do_analysis() { - case Bytecodes::_jsr_w : - { - cur_block->set_control_bci(bci); -- ciBlock *ret = make_block_at(s.next_bci()); -+ if (s.next_bci() < limit_bci) { -+ ciBlock *ret = make_block_at(s.next_bci()); -+ } - int dest_bci = s.get_far_dest(); - ciBlock *dest = make_block_at(dest_bci); - break; -diff --git a/hotspot/src/share/vm/compiler/methodLiveness.cpp b/hotspot/src/share/vm/compiler/methodLiveness.cpp -index eda1ab156..7fb496dc9 100644 ---- a/hotspot/src/share/vm/compiler/methodLiveness.cpp -+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp -@@ -268,10 +268,11 @@ void MethodLiveness::init_basic_blocks() { - case Bytecodes::_ifnull: - case Bytecodes::_ifnonnull: - // Two way branch. Set predecessors at each destination. -- dest = _block_map->at(bytes.next_bci()); -- assert(dest != NULL, "must be a block immediately following this one."); -- dest->add_normal_predecessor(current_block); -- -+ if (bytes.next_bci() < method_len) { -+ dest = _block_map->at(bytes.next_bci()); -+ assert(dest != NULL, "must be a block immediately following this one."); -+ dest->add_normal_predecessor(current_block); -+ } - dest = _block_map->at(bytes.get_dest()); - assert(dest != NULL, "branch desination must start a block."); - dest->add_normal_predecessor(current_block); -diff --git a/hotspot/test/compiler/parsing/Custom.jasm b/hotspot/test/compiler/parsing/Custom.jasm -new file mode 100644 -index 000000000..78bfc518d ---- /dev/null -+++ b/hotspot/test/compiler/parsing/Custom.jasm -@@ -0,0 +1,38 @@ -+/* -+ * Copyright (c) 2022, 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 compiler/parsing; -+ -+super public class Custom { -+ -+ public static Method test:"(I)V" stack 2 locals 1 { -+ return; -+Loop: -+ // Unreachable block -+ iload_0; -+ bipush 100; -+ if_icmpge Loop; -+ // Falls through -+ } -+ -+} -\ No newline at end of file -diff --git a/hotspot/test/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java b/hotspot/test/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java -new file mode 100644 -index 000000000..5b1d17d97 ---- /dev/null -+++ b/hotspot/test/compiler/parsing/UnreachableBlockFallsThroughEndOfCode.java -@@ -0,0 +1,42 @@ -+/* -+ * Copyright (c) 2022, 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 UnreachableBlockFallsThroughEndOfCode.java -+ * @bug 8283441 -+ * @compile Custom.jasm UnreachableBlockFallsThroughEndOfCode.java -+ * @summary Compiling method that falls off the end of the code array -+ * @run main/othervm -XX:TieredStopAtLevel=1 -Xbatch compiler.parsing.UnreachableBlockFallsThroughEndOfCode -+ * @run main/othervm -XX:-TieredCompilation -Xbatch compiler.parsing.UnreachableBlockFallsThroughEndOfCode -+ */ -+ -+ package compiler.parsing; -+ -+ public class UnreachableBlockFallsThroughEndOfCode { -+ public static void main(String[] strArr) { -+ for (int i = 0; i < 20000; i++) { -+ Custom.test(i); -+ } -+ } -+ } -\ No newline at end of file --- -2.22.0 - diff --git a/8308682-Enhance-AES-performance.patch b/8308682-Enhance-AES-performance.patch new file mode 100644 index 0000000000000000000000000000000000000000..84a1e1c4796bbeca319c72bbace07b23459430f9 --- /dev/null +++ b/8308682-Enhance-AES-performance.patch @@ -0,0 +1,708 @@ +From 6926e9b83bc3f9b785d5298786a5c41e247b2a3f Mon Sep 17 00:00:00 2001 +Date: Mon, 16 Oct 2023 10:56:30 +0800 +Subject: [PATCH 1/5] 8308682: Enhance AES performance + +Bug url: https://bugs.openjdk.org/browse/JDK-8308682 +--- + .../src/cpu/aarch64/vm/assembler_aarch64.hpp | 2 + + .../cpu/aarch64/vm/stubGenerator_aarch64.cpp | 451 +++++++++--------- + .../compiler/codegen/aes/CTR_Wraparound.java | 169 +++++++ + 3 files changed, 406 insertions(+), 216 deletions(-) + create mode 100644 hotspot/test/compiler/codegen/aes/CTR_Wraparound.java + +diff --git a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp +index 9202e61f8..b12095aca 100644 +--- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp ++++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp +@@ -2140,6 +2140,8 @@ public: + INSN(sshl, 0, 0b010001); + INSN(ushl, 1, 0b010001); + ++ INSN(cmhi, 1, 0b001101); // accepted arrangements: T8B, T16B, T4H, T8H, T2S, T4S, T2D ++ + #undef INSN + + #define INSN(NAME, opc, opc2) \ +diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp +index 565fe559c..f61028d50 100644 +--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp ++++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp +@@ -2804,265 +2804,284 @@ class StubGenerator: public StubCodeGenerator { + return start; + } + ++ // Big-endian 128-bit + 64-bit -> 128-bit addition. ++ // Inputs: 128-bits. in is preserved. ++ // The least-significant 64-bit word is in the upper dword of the vector ++ // inc (the 64-bit increment) is preserved. Its lower dword must be zero ++ // Output: result ++ void be_add_128_64(FloatRegister result, FloatRegister in, ++ FloatRegister inc, FloatRegister tmp) { ++ assert_different_registers(result, tmp, inc); ++ ++ __ addv(result, __ T2D, in, inc); // Add inc to the least-significant dword of input ++ __ cmhi(tmp, __ T2D, inc, result); // Check for result overflowing ++ __ ins(tmp, __ D, tmp, 0, 1); // Move LSD of comparison result to MSD ++ __ ins(tmp, __ D, inc, 1, 0); // Move 0 to LSD of comparison result ++ __ subv(result, __ T2D, result, tmp); // Subtract -1 from MSD if there was an overflow ++ } ++ + // CTR AES crypt. +- // Arguments: +- // +- // Inputs: +- // c_rarg0 - source byte array address +- // c_rarg1 - destination byte array address +- // c_rarg2 - K (key) in little endian int array +- // c_rarg3 - counter vector byte array address +- // c_rarg4 - input length +- // c_rarg5 - saved encryptedCounter start +- // c_rarg6 - saved used length ++ // Arguments: ++ // ++ // Inputs: ++ // c_rarg0 - source byte array address ++ // c_rarg1 - destination byte array address ++ // c_rarg2 - K (key) in little endian int array ++ // c_rarg3 - counter vector byte array address ++ // c_rarg4 - input length ++ // c_rarg5 - saved encryptedCounter start ++ // c_rarg6 - saved used length ++ // ++ // Output: ++ // r0 - input length ++ // ++ address generate_counterMode_AESCrypt() { ++ const Register in = c_rarg0; ++ const Register out = c_rarg1; ++ const Register key = c_rarg2; ++ const Register counter = c_rarg3; ++ const Register saved_len = c_rarg4, len = r10; ++ const Register saved_encrypted_ctr = c_rarg5; ++ const Register used_ptr = c_rarg6, used = r12; ++ ++ const Register offset = r7; ++ const Register keylen = r11; ++ ++ const unsigned char block_size = 16; ++ const int bulk_width = 4; ++ // NB: bulk_width can be 4 or 8. 8 gives slightly faster ++ // performance with larger data sizes, but it also means that the ++ // fast path isn't used until you have at least 8 blocks, and up ++ // to 127 bytes of data will be executed on the slow path. For ++ // that reason, and also so as not to blow away too much icache, 4 ++ // blocks seems like a sensible compromise. ++ ++ // Algorithm: + // +- // Output: +- // r0 - input length ++ // if (len == 0) { ++ // goto DONE; ++ // } ++ // int result = len; ++ // do { ++ // if (used >= blockSize) { ++ // if (len >= bulk_width * blockSize) { ++ // CTR_large_block(); ++ // if (len == 0) ++ // goto DONE; ++ // } ++ // for (;;) { ++ // 16ByteVector v0 = counter; ++ // embeddedCipher.encryptBlock(v0, 0, encryptedCounter, 0); ++ // used = 0; ++ // if (len < blockSize) ++ // break; /* goto NEXT */ ++ // 16ByteVector v1 = load16Bytes(in, offset); ++ // v1 = v1 ^ encryptedCounter; ++ // store16Bytes(out, offset); ++ // used = blockSize; ++ // offset += blockSize; ++ // len -= blockSize; ++ // if (len == 0) ++ // goto DONE; ++ // } ++ // } ++ // NEXT: ++ // out[outOff++] = (byte)(in[inOff++] ^ encryptedCounter[used++]); ++ // len--; ++ // } while (len != 0); ++ // DONE: ++ // return result; + // +- address generate_counterMode_AESCrypt() { +- const Register in = c_rarg0; +- const Register out = c_rarg1; +- const Register key = c_rarg2; +- const Register counter = c_rarg3; +- const Register saved_len = c_rarg4, len = r10; +- const Register saved_encrypted_ctr = c_rarg5; +- const Register used_ptr = c_rarg6, used = r12; +- +- const Register offset = r7; +- const Register keylen = r11; +- +- const unsigned char block_size = 16; +- const int bulk_width = 4; +- // NB: bulk_width can be 4 or 8. 8 gives slightly faster +- // performance with larger data sizes, but it also means that the +- // fast path isn't used until you have at least 8 blocks, and up +- // to 127 bytes of data will be executed on the slow path. For +- // that reason, and also so as not to blow away too much icache, 4 +- // blocks seems like a sensible compromise. +- +- // Algorithm: +- // +- // if (len == 0) { +- // goto DONE; +- // } +- // int result = len; +- // do { +- // if (used >= blockSize) { +- // if (len >= bulk_width * blockSize) { +- // CTR_large_block(); +- // if (len == 0) +- // goto DONE; +- // } +- // for (;;) { +- // 16ByteVector v0 = counter; +- // embeddedCipher.encryptBlock(v0, 0, encryptedCounter, 0); +- // used = 0; +- // if (len < blockSize) +- // break; /* goto NEXT */ +- // 16ByteVector v1 = load16Bytes(in, offset); +- // v1 = v1 ^ encryptedCounter; +- // store16Bytes(out, offset); +- // used = blockSize; +- // offset += blockSize; +- // len -= blockSize; +- // if (len == 0) +- // goto DONE; +- // } +- // } +- // NEXT: +- // out[outOff++] = (byte)(in[inOff++] ^ encryptedCounter[used++]); +- // len--; +- // } while (len != 0); +- // DONE: +- // return result; +- // +- // CTR_large_block() +- // Wide bulk encryption of whole blocks. ++ // CTR_large_block() ++ // Wide bulk encryption of whole blocks. + +- __ align(CodeEntryAlignment); +- StubCodeMark mark(this, "StubRoutines", "counterMode_AESCrypt"); +- const address start = __ pc(); +- __ enter(); ++ __ align(CodeEntryAlignment); ++ StubCodeMark mark(this, "StubRoutines", "counterMode_AESCrypt"); ++ const address start = __ pc(); ++ __ enter(); + +- Label DONE, CTR_large_block, large_block_return; +- __ ldrw(used, Address(used_ptr)); +- __ cbzw(saved_len, DONE); ++ Label DONE, CTR_large_block, large_block_return; ++ __ ldrw(used, Address(used_ptr)); ++ __ cbzw(saved_len, DONE); + +- __ mov(len, saved_len); +- __ mov(offset, 0); ++ __ mov(len, saved_len); ++ __ mov(offset, 0); + +- // Compute #rounds for AES based on the length of the key array +- __ ldrw(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT))); ++ // Compute #rounds for AES based on the length of the key array ++ __ ldrw(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT))); + +- __ aesenc_loadkeys(key, keylen); ++ __ aesenc_loadkeys(key, keylen); + +- { +- Label L_CTR_loop, NEXT; ++ { ++ Label L_CTR_loop, NEXT; + +- __ bind(L_CTR_loop); ++ __ bind(L_CTR_loop); + +- __ cmp(used, block_size); +- __ br(__ LO, NEXT); ++ __ cmp(used, block_size); ++ __ br(__ LO, NEXT); + +- // Maybe we have a lot of data +- __ subsw(rscratch1, len, bulk_width * block_size); +- __ br(__ HS, CTR_large_block); +- __ BIND(large_block_return); +- __ cbzw(len, DONE); ++ // Maybe we have a lot of data ++ __ subsw(rscratch1, len, bulk_width * block_size); ++ __ br(__ HS, CTR_large_block); ++ __ BIND(large_block_return); ++ __ cbzw(len, DONE); + +- // Setup the counter +- __ movi(v4, __ T4S, 0); +- __ movi(v5, __ T4S, 1); +- __ ins(v4, __ S, v5, 3, 3); // v4 contains { 0, 0, 0, 1 } ++ // Setup the counter ++ __ movi(v4, __ T4S, 0); ++ __ movi(v5, __ T4S, 1); ++ __ ins(v4, __ S, v5, 2, 2); // v4 contains { 0, 1 } + +- __ ld1(v0, __ T16B, counter); // Load the counter into v0 +- __ rev32(v16, __ T16B, v0); +- __ addv(v16, __ T4S, v16, v4); +- __ rev32(v16, __ T16B, v16); +- __ st1(v16, __ T16B, counter); // Save the incremented counter back ++ // 128-bit big-endian increment ++ __ ld1(v0, __ T16B, counter); ++ __ rev64(v16, __ T16B, v0); ++ be_add_128_64(v16, v16, v4, /*tmp*/v5); ++ __ rev64(v16, __ T16B, v16); ++ __ st1(v16, __ T16B, counter); ++ // Previous counter value is in v0 ++ // v4 contains { 0, 1 } + +- { +- // We have fewer than bulk_width blocks of data left. Encrypt +- // them one by one until there is less than a full block +- // remaining, being careful to save both the encrypted counter +- // and the counter. +- +- Label inner_loop; +- __ bind(inner_loop); +- // Counter to encrypt is in v0 +- __ aesecb_encrypt(noreg, noreg, keylen); +- __ st1(v0, __ T16B, saved_encrypted_ctr); +- +- // Do we have a remaining full block? +- +- __ mov(used, 0); +- __ cmp(len, block_size); +- __ br(__ LO, NEXT); +- +- // Yes, we have a full block +- __ ldrq(v1, Address(in, offset)); +- __ eor(v1, __ T16B, v1, v0); +- __ strq(v1, Address(out, offset)); +- __ mov(used, block_size); +- __ add(offset, offset, block_size); +- +- __ subw(len, len, block_size); +- __ cbzw(len, DONE); +- +- // Increment the counter, store it back +- __ orr(v0, __ T16B, v16, v16); +- __ rev32(v16, __ T16B, v16); +- __ addv(v16, __ T4S, v16, v4); +- __ rev32(v16, __ T16B, v16); +- __ st1(v16, __ T16B, counter); // Save the incremented counter back +- +- __ b(inner_loop); +- } ++ { ++ // We have fewer than bulk_width blocks of data left. Encrypt ++ // them one by one until there is less than a full block ++ // remaining, being careful to save both the encrypted counter ++ // and the counter. + +- __ BIND(NEXT); +- +- // Encrypt a single byte, and loop. +- // We expect this to be a rare event. +- __ ldrb(rscratch1, Address(in, offset)); +- __ ldrb(rscratch2, Address(saved_encrypted_ctr, used)); +- __ eor(rscratch1, rscratch1, rscratch2); +- __ strb(rscratch1, Address(out, offset)); +- __ add(offset, offset, 1); +- __ add(used, used, 1); +- __ subw(len, len,1); +- __ cbnzw(len, L_CTR_loop); +- } ++ Label inner_loop; ++ __ bind(inner_loop); ++ // Counter to encrypt is in v0 ++ __ aesecb_encrypt(noreg, noreg, keylen); ++ __ st1(v0, __ T16B, saved_encrypted_ctr); + +- __ bind(DONE); +- __ strw(used, Address(used_ptr)); +- __ mov(r0, saved_len); ++ // Do we have a remaining full block? + +- __ leave(); // required for proper stackwalking of RuntimeStub frame +- __ ret(lr); ++ __ mov(used, 0); ++ __ cmp(len, block_size); ++ __ br(__ LO, NEXT); + +- // Bulk encryption ++ // Yes, we have a full block ++ __ ldrq(v1, Address(in, offset)); ++ __ eor(v1, __ T16B, v1, v0); ++ __ strq(v1, Address(out, offset)); ++ __ mov(used, block_size); ++ __ add(offset, offset, block_size); + +- __ BIND (CTR_large_block); +- assert(bulk_width == 4 || bulk_width == 8, "must be"); ++ __ subw(len, len, block_size); ++ __ cbzw(len, DONE); + +- if (bulk_width == 8) { +- __ sub(sp, sp, 4 * 16); +- __ st1(v12, v13, v14, v15, __ T16B, Address(sp)); ++ // Increment the counter, store it back ++ __ orr(v0, __ T16B, v16, v16); ++ __ rev64(v16, __ T16B, v16); ++ be_add_128_64(v16, v16, v4, /*tmp*/v5); ++ __ rev64(v16, __ T16B, v16); ++ __ st1(v16, __ T16B, counter); // Save the incremented counter back ++ ++ __ b(inner_loop); + } +- __ sub(sp, sp, 4 * 16); +- __ st1(v8, v9, v10, v11, __ T16B, Address(sp)); +- RegSet saved_regs = (RegSet::of(in, out, offset) +- + RegSet::of(saved_encrypted_ctr, used_ptr, len)); +- __ push(saved_regs, sp); +- __ andr(len, len, -16 * bulk_width); // 8/4 encryptions, 16 bytes per encryption +- __ add(in, in, offset); +- __ add(out, out, offset); + +- // Keys should already be loaded into the correct registers ++ __ BIND(NEXT); ++ ++ // Encrypt a single byte, and loop. ++ // We expect this to be a rare event. ++ __ ldrb(rscratch1, Address(in, offset)); ++ __ ldrb(rscratch2, Address(saved_encrypted_ctr, used)); ++ __ eor(rscratch1, rscratch1, rscratch2); ++ __ strb(rscratch1, Address(out, offset)); ++ __ add(offset, offset, 1); ++ __ add(used, used, 1); ++ __ subw(len, len,1); ++ __ cbnzw(len, L_CTR_loop); ++ } + +- __ ld1(v0, __ T16B, counter); // v0 contains the first counter +- __ rev32(v16, __ T16B, v0); // v16 contains byte-reversed counter ++ __ bind(DONE); ++ __ strw(used, Address(used_ptr)); ++ __ mov(r0, saved_len); + +- // AES/CTR loop +- { +- Label L_CTR_loop; +- __ BIND(L_CTR_loop); ++ __ leave(); // required for proper stackwalking of RuntimeStub frame ++ __ ret(lr); + +- // Setup the counters +- __ movi(v8, __ T4S, 0); +- __ movi(v9, __ T4S, 1); +- __ ins(v8, __ S, v9, 3, 3); // v8 contains { 0, 0, 0, 1 } ++ // Bulk encryption + +- for (FloatRegister f = v0; f < v0 + bulk_width; f++) { +- __ rev32(f, __ T16B, v16); +- __ addv(v16, __ T4S, v16, v8); +- } ++ __ BIND (CTR_large_block); ++ assert(bulk_width == 4 || bulk_width == 8, "must be"); + +- __ ld1(v8, v9, v10, v11, __ T16B, __ post(in, 4 * 16)); ++ if (bulk_width == 8) { ++ __ sub(sp, sp, 4 * 16); ++ __ st1(v12, v13, v14, v15, __ T16B, Address(sp)); ++ } ++ __ sub(sp, sp, 4 * 16); ++ __ st1(v8, v9, v10, v11, __ T16B, Address(sp)); ++ RegSet saved_regs = (RegSet::of(in, out, offset) ++ + RegSet::of(saved_encrypted_ctr, used_ptr, len)); ++ __ push(saved_regs, sp); ++ __ andr(len, len, -16 * bulk_width); // 8/4 encryptions, 16 bytes per encryption ++ __ add(in, in, offset); ++ __ add(out, out, offset); + +- // Encrypt the counters +- __ aesecb_encrypt(noreg, noreg, keylen, v0, bulk_width); ++ // Keys should already be loaded into the correct registers + +- if (bulk_width == 8) { +- __ ld1(v12, v13, v14, v15, __ T16B, __ post(in, 4 * 16)); +- } ++ __ ld1(v0, __ T16B, counter); // v0 contains the first counter ++ __ rev64(v16, __ T16B, v0); // v16 contains byte-reversed counter + +- // XOR the encrypted counters with the inputs +- for (int i = 0; i < bulk_width; i++) { +- __ eor(v0 + i, __ T16B, v0 + i, v8 + i); +- } ++ // AES/CTR loop ++ { ++ Label L_CTR_loop; ++ __ BIND(L_CTR_loop); + +- // Write the encrypted data +- __ st1(v0, v1, v2, v3, __ T16B, __ post(out, 4 * 16)); +- if (bulk_width == 8) { +- __ st1(v4, v5, v6, v7, __ T16B, __ post(out, 4 * 16)); +- } ++ // Setup the counters ++ __ movi(v8, __ T4S, 0); ++ __ movi(v9, __ T4S, 1); ++ __ ins(v8, __ S, v9, 2, 2); // v8 contains { 0, 1 } + +- __ subw(len, len, 16 * bulk_width); +- __ cbnzw(len, L_CTR_loop); ++ for (FloatRegister f = v0; f < v0 + bulk_width; f++) { ++ __ rev64(f, __ T16B, v16); ++ be_add_128_64(v16, v16, v8, /*tmp*/v9); + } + +- // Save the counter back where it goes +- __ rev32(v16, __ T16B, v16); +- __ st1(v16, __ T16B, counter); ++ __ ld1(v8, v9, v10, v11, __ T16B, __ post(in, 4 * 16)); + +- __ pop(saved_regs, sp); ++ // Encrypt the counters ++ __ aesecb_encrypt(noreg, noreg, keylen, v0, bulk_width); + +- __ ld1(v8, v9, v10, v11, __ T16B, __ post(sp, 4 * 16)); + if (bulk_width == 8) { +- __ ld1(v12, v13, v14, v15, __ T16B, __ post(sp, 4 * 16)); ++ __ ld1(v12, v13, v14, v15, __ T16B, __ post(in, 4 * 16)); + } + +- __ andr(rscratch1, len, -16 * bulk_width); +- __ sub(len, len, rscratch1); +- __ add(offset, offset, rscratch1); +- __ mov(used, 16); +- __ strw(used, Address(used_ptr)); +- __ b(large_block_return); ++ // XOR the encrypted counters with the inputs ++ for (int i = 0; i < bulk_width; i++) { ++ __ eor(v0 + i, __ T16B, v0 + i, v8 + i); ++ } + +- return start; ++ // Write the encrypted data ++ __ st1(v0, v1, v2, v3, __ T16B, __ post(out, 4 * 16)); ++ if (bulk_width == 8) { ++ __ st1(v4, v5, v6, v7, __ T16B, __ post(out, 4 * 16)); ++ } ++ ++ __ subw(len, len, 16 * bulk_width); ++ __ cbnzw(len, L_CTR_loop); + } + ++ // Save the counter back where it goes ++ __ rev64(v16, __ T16B, v16); ++ __ st1(v16, __ T16B, counter); ++ ++ __ pop(saved_regs, sp); ++ ++ __ ld1(v8, v9, v10, v11, __ T16B, __ post(sp, 4 * 16)); ++ if (bulk_width == 8) { ++ __ ld1(v12, v13, v14, v15, __ T16B, __ post(sp, 4 * 16)); ++ } ++ ++ __ andr(rscratch1, len, -16 * bulk_width); ++ __ sub(len, len, rscratch1); ++ __ add(offset, offset, rscratch1); ++ __ mov(used, 16); ++ __ strw(used, Address(used_ptr)); ++ __ b(large_block_return); ++ ++ return start; ++ } ++ + + + // Arguments: +diff --git a/hotspot/test/compiler/codegen/aes/CTR_Wraparound.java b/hotspot/test/compiler/codegen/aes/CTR_Wraparound.java +new file mode 100644 +index 000000000..f578b432c +--- /dev/null ++++ b/hotspot/test/compiler/codegen/aes/CTR_Wraparound.java +@@ -0,0 +1,169 @@ ++import javax.crypto.Cipher; ++import javax.crypto.spec.IvParameterSpec; ++import javax.crypto.spec.SecretKeySpec; ++import java.lang.reflect.Executable; ++import java.util.Arrays; ++import java.util.Random; ++import java.util.concurrent.Callable; ++ ++/** ++ * @test ++ * @bug 8308682 ++ * @summary Check for 128-bit AES/CTR wraparound ++ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox /compiler/testlibrary ++ * @build CTR_Wraparound ++ * @run main ClassFileInstaller sun.hotspot.WhiteBox ++ * sun.hotspot.WhiteBox$WhiteBoxPermission ++ * @run main/othervm -Xbootclasspath/a:. ++ * -XX:+UnlockDiagnosticVMOptions ++ * -XX:+WhiteBoxAPI ++ * CTR_Wraparound 32 ++ * @run main/othervm -Xbootclasspath/a:. ++ * -XX:+UnlockDiagnosticVMOptions ++ * -XX:+WhiteBoxAPI ++ * CTR_Wraparound 1009 ++ * @run main/othervm -Xbootclasspath/a:. ++ * -XX:+UnlockDiagnosticVMOptions ++ * -XX:+WhiteBoxAPI ++ * CTR_Wraparound 2048 ++ */ ++ ++public class CTR_Wraparound extends CompilerWhiteBoxTest { ++ private static final String ALGO = "AES/CTR/NoPadding"; ++ private static final int LOOPS = 100000; ++ private int length; ++ private int maxOffset; ++ ++ public CTR_Wraparound(int len,int offset){ ++ super(new CTR_WraparoundTestCase()); ++ length = len; ++ maxOffset = offset; ++ } ++ ++ public static class CTR_WraparoundTestCase implements TestCase { ++ ++ public String name() { ++ return "CTR_WraparoundTestCase"; ++ } ++ ++ public Executable getExecutable(){ ++ try { ++ return Class.forName("com.sun.crypto.provider.CounterMode").getDeclaredMethod("implCrypt", byte[].class, int.class, int.class, byte[].class, int.class); ++ } catch (NoSuchMethodException e) { ++ throw new RuntimeException("Test bug, method unavailable. " + e); ++ } catch (ClassNotFoundException e) { ++ throw new RuntimeException("Test bug, class unavailable. " + e); ++ } ++ } ++ ++ public Callable getCallable() { ++ return null; ++ } ++ ++ public boolean isOsr() { ++ return false; ++ } ++ ++ } ++ ++ private static boolean isServerVM(String VMName) { return VMName.toLowerCase().contains("server");} ++ ++ ++ ++ protected static boolean checkIntrinsicForCompilationLevel(Executable method, int compLevel) { ++ boolean intrinsicEnabled = Boolean.valueOf(getVMOption("UseAESCTRIntrinsics")); ++ boolean intrinsicAvailable = WHITE_BOX.isIntrinsicAvailable(method, ++ compLevel); ++ if(intrinsicAvailable && intrinsicEnabled){ ++ return true; ++ } ++ return false; ++ } ++ ++ public static void main(String[] args) throws Exception { ++ int length = Integer.parseInt(args[0]); ++ int maxOffset = 60; ++ if (args.length > 1) { ++ maxOffset = Integer.parseInt(args[1]); ++ System.out.println("InitialOffset = " + maxOffset); ++ } ++ new CTR_Wraparound(length,maxOffset).test(); ++ } ++ ++ @Override ++ protected void test() throws Exception { ++ ++ String VMName = System.getProperty("java.vm.name"); ++ Executable intrinsicMethod = testCase.getExecutable(); ++ boolean isIntrinsicEnabled = false; ++ if (isServerVM(VMName)) { ++ if (TIERED_COMPILATION) { ++ isIntrinsicEnabled = checkIntrinsicForCompilationLevel(intrinsicMethod, COMP_LEVEL_SIMPLE); ++ } ++ isIntrinsicEnabled = checkIntrinsicForCompilationLevel(intrinsicMethod, COMP_LEVEL_FULL_OPTIMIZATION); ++ } else { ++ isIntrinsicEnabled = checkIntrinsicForCompilationLevel(intrinsicMethod, COMP_LEVEL_SIMPLE); ++ } ++ if(!isIntrinsicEnabled){ ++ return; ++ } ++ ++ ++ long SEED = Long.getLong("jdk.test.lib.random.seed", new Random().nextLong()); ++ Random random = new Random(SEED); ++ ++ byte[] keyBytes = new byte[32]; ++ Arrays.fill(keyBytes, (byte)0xff); ++ SecretKeySpec key = new SecretKeySpec(keyBytes, "AES"); ++ ++ byte[] ivBytes = new byte[16]; ++ ++ Arrays.fill(ivBytes, (byte)0xff); ++ ++ byte[][] plaintext = new byte[maxOffset][]; ++ byte[][] ciphertext = new byte[maxOffset][]; ++ ++ for (int offset = 0; offset < maxOffset; offset++) { ++ ivBytes[ivBytes.length - 1] = (byte)-offset; ++ IvParameterSpec iv = new IvParameterSpec(ivBytes); ++ ++ Cipher encryptCipher = Cipher.getInstance(ALGO); ++ Cipher decryptCipher = Cipher.getInstance(ALGO); ++ ++ encryptCipher.init(Cipher.ENCRYPT_MODE, key, iv); ++ decryptCipher.init(Cipher.DECRYPT_MODE, key, iv); ++ ++ plaintext[offset] = new byte[length]; ++ ciphertext[offset] = new byte[length]; ++ random.nextBytes(plaintext[offset]); ++ ++ byte[] decrypted = new byte[length]; ++ ++ encryptCipher.doFinal(plaintext[offset], 0, length, ciphertext[offset]); ++ decryptCipher.doFinal(ciphertext[offset], 0, length, decrypted); ++ ++ if (!Arrays.equals(plaintext[offset], decrypted)) { ++ throw new Exception("mismatch in setup at offset " + offset); ++ } ++ } ++ ++ for (int offset = 0; offset < maxOffset; offset++) { ++ ivBytes[ivBytes.length - 1] = (byte)-offset; ++ IvParameterSpec iv = new IvParameterSpec(ivBytes); ++ ++ Cipher encryptCipher = Cipher.getInstance(ALGO); ++ ++ encryptCipher.init(Cipher.ENCRYPT_MODE, key, iv); ++ ++ byte[] encrypted = new byte[length]; ++ ++ for (int i = 0; i < LOOPS; i++) { ++ encryptCipher.doFinal(plaintext[offset], 0, length, encrypted); ++ if (!Arrays.equals(ciphertext[offset], encrypted)) { ++ throw new Exception("array mismatch at offset " + offset ++ + " with length " + length); ++ } ++ } ++ } ++ } ++} +-- +2.19.1 + diff --git a/Add-metaspace-memory-allocation-failure-validation.patch b/Add-metaspace-memory-allocation-failure-validation.patch new file mode 100644 index 0000000000000000000000000000000000000000..9f0a82e84d9ed3e1b49973fc2414af21fac23a1d --- /dev/null +++ b/Add-metaspace-memory-allocation-failure-validation.patch @@ -0,0 +1,39 @@ +From 0778f0119083ae33aea5ce9b5a1b44f565f45397 Mon Sep 17 00:00:00 2001 +Date: Thu, 19 Oct 2023 15:25:43 +0800 +Subject: [PATCH 4/5] Add metaspace memory allocation failure validation + +--- + hotspot/src/share/vm/memory/metaspace.cpp | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp +index 0569500c1..f39ae41f3 100644 +--- a/hotspot/src/share/vm/memory/metaspace.cpp ++++ b/hotspot/src/share/vm/memory/metaspace.cpp +@@ -571,7 +571,7 @@ class OccupancyMap : public CHeapObj { + assert(_map_size * 8 >= num_bits, "sanity"); + _map[0] = (uint8_t*) os::malloc(_map_size, mtInternal); + _map[1] = (uint8_t*) os::malloc(_map_size, mtInternal); +- assert(_map[0] != NULL && _map[1] != NULL, "Occupancy Map: allocation failed."); ++ guarantee(_map[0] != NULL && _map[1] != NULL, "Metaspace Occupancy Map: allocation failed."); + memset(_map[1], 0, _map_size); + memset(_map[0], 0, _map_size); + // Sanity test: the first respectively last possible chunk start address in +@@ -918,6 +918,14 @@ void VirtualSpaceNode::print_map(outputStream* st, bool is_class) const { + char* lines[NUM_LINES]; + for (int i = 0; i < NUM_LINES; i ++) { + lines[i] = (char*)os::malloc(line_len, mtInternal); ++ // Only print the VirtualSpaceNode memory layout during metaspace OOM. ++ // If it fails,we should return instead of hanging the VM. ++ if (lines[i] == NULL) { ++ for (int j = 0; j < i; j ++) { ++ os::free(lines[j]); ++ } ++ return; ++ } + } + int pos = 0; + const MetaWord* p = bottom(); +-- +2.19.1 + diff --git a/Dynamic-CDS-Archive.patch b/Dynamic-CDS-Archive.patch index edccdea2d34992af8b341928e6630b677a2897e3..30a6ff8169def8d3ed47633f5431a0b3a19d72dd 100644 --- a/Dynamic-CDS-Archive.patch +++ b/Dynamic-CDS-Archive.patch @@ -3047,12 +3047,8 @@ index 8dd4e6b21..6a2d8077f 100644 void SymbolTable::buckets_unlink(int start_idx, int end_idx, BucketUnlinkContext* context, size_t* memory_total) { for (int i = start_idx; i < end_idx; ++i) { -@@ -225,10 +241,25 @@ Symbol* SymbolTable::lookup(int index, const char* name, - unsigned int SymbolTable::hash_symbol(const char* s, int len) { - return use_alternate_hashcode() ? - AltHashing::halfsiphash_32(seed(), (const uint8_t*)s, len) : -- java_lang_String::hash_code(s, len); -+ java_lang_String::hash_code((const jbyte*)s, len); +@@ -228,7 +244,22 @@ Symbol* SymbolTable::lookup(int index, const char* name, + java_lang_String::hash_code((const jbyte*)s, len); } +#if INCLUDE_CDS diff --git a/Fix-the-memory-leak-of-MetaspaceAllocationTest.patch b/Fix-the-memory-leak-of-MetaspaceAllocationTest.patch new file mode 100644 index 0000000000000000000000000000000000000000..896d6f9a06bee9526d65267a4425205a3f07fc72 --- /dev/null +++ b/Fix-the-memory-leak-of-MetaspaceAllocationTest.patch @@ -0,0 +1,24 @@ +From 1c55195c050d26f7c3ef53ed8f4ff25f398cfa1e Mon Sep 17 00:00:00 2001 +Date: Thu, 19 Oct 2023 11:24:12 +0800 +Subject: [PATCH 2/5] Fix the memory leak of MetaspaceAllocationTest + +--- + hotspot/src/share/vm/memory/metaspace.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp +index 0569500c1..847af1ce9 100644 +--- a/hotspot/src/share/vm/memory/metaspace.cpp ++++ b/hotspot/src/share/vm/memory/metaspace.cpp +@@ -5712,6 +5712,8 @@ public: + for (int i = 0; i < NUM_PARALLEL_METASPACES; i ++) { + if (_spaces[i].space != NULL) { + delete _spaces[i].space; ++ } ++ if (_spaces[i].lock != NULL) { + delete _spaces[i].lock; + } + } +-- +2.19.1 + diff --git a/The-OverWriteOldestGCLog-option-is-added-to-control.patch b/The-OverWriteOldestGCLog-option-is-added-to-control.patch index 5130e9e06e2d69d17d09381837de40d699dc865b..d80eddd2aa16fc24bf3e014ddbae9976a6d1bb6e 100644 --- a/The-OverWriteOldestGCLog-option-is-added-to-control.patch +++ b/The-OverWriteOldestGCLog-option-is-added-to-control.patch @@ -63,7 +63,7 @@ index f4e127145..133b5a7c0 100644 + // remove the existing normal file + char exist_file_name[JVM_MAXPATHLEN]; + jio_snprintf(exist_file_name, JVM_MAXPATHLEN, "%s.%d", filename, next_num); -+ if (access(exist_file_name, F_OK) == 0) { ++ if (access(exist_file_name, 0) == 0) { // mode 0: Check whether the file exists, F_OK=0. F_OK will cause Windows build failure. Use 0 instead. + if (remove(exist_file_name) != 0) { + warning("Could not delete existing normal file %s\n", exist_file_name); + } diff --git a/add-missing-test-case.patch b/add-missing-test-case.patch index b3acf9c2d9097aa43fc505599286b3dd4c421879..4fc31ae20862ab358d875031aa1fb28f885303b0 100644 --- a/add-missing-test-case.patch +++ b/add-missing-test-case.patch @@ -91,7 +91,7 @@ index 00000000..9b614024 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ -+8.382.5.0.13 ++8.392.5.0.13 -- 2.23.0 diff --git a/change-value-of-GCLockerRetryAllocationCount-from-2-.patch b/change-value-of-GCLockerRetryAllocationCount-from-2-.patch new file mode 100644 index 0000000000000000000000000000000000000000..a74ca540612d462d228cc2712fa2126f2105454b --- /dev/null +++ b/change-value-of-GCLockerRetryAllocationCount-from-2-.patch @@ -0,0 +1,157 @@ +From 9b431c9bba018a2dd2bb6850cfd674b51207bf49 Mon Sep 17 00:00:00 2001 +Date: Thu, 19 Oct 2023 01:37:43 +0000 +Subject: [PATCH 3/5] change value of GCLockerRetryAllocationCount from 2 to + 1000 to avoid OOM + +--- + hotspot/src/share/vm/runtime/globals.hpp | 2 +- + .../g1/TestGcLockerEvacFailureThreaded.java | 124 ++++++++++++++++++ + 2 files changed, 125 insertions(+), 1 deletion(-) + create mode 100644 hotspot/test/gc/g1/TestGcLockerEvacFailureThreaded.java + +diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp +index fdd9db149..65806a475 100644 +--- a/hotspot/src/share/vm/runtime/globals.hpp ++++ b/hotspot/src/share/vm/runtime/globals.hpp +@@ -1575,7 +1575,7 @@ class CommandLineFlags { + "How much the GC can expand the eden by while the GC locker " \ + "is active (as a percentage)") \ + \ +- diagnostic(uintx, GCLockerRetryAllocationCount, 2, \ ++ diagnostic(uintx, GCLockerRetryAllocationCount, 1000, \ + "Number of times to retry allocations when " \ + "blocked by the GC locker") \ + \ +diff --git a/hotspot/test/gc/g1/TestGcLockerEvacFailureThreaded.java b/hotspot/test/gc/g1/TestGcLockerEvacFailureThreaded.java +new file mode 100644 +index 000000000..74accd951 +--- /dev/null ++++ b/hotspot/test/gc/g1/TestGcLockerEvacFailureThreaded.java +@@ -0,0 +1,124 @@ ++import java.io.ByteArrayOutputStream; ++import java.io.IOException; ++import java.lang.ref.SoftReference; ++import java.nio.ByteBuffer; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Random; ++import java.util.zip.GZIPOutputStream; ++ ++import com.oracle.java.testlibrary.ProcessTools; ++import com.oracle.java.testlibrary.OutputAnalyzer; ++ ++/* ++ * @test TestGcLockerEvacFailureThreaded.java ++ * @bug 8048556 8137099 ++ * @summary Ensure that GCLocker does not cause early program termination. ++ * @key gc ++ * @library /testlibrary ++ */ ++public class TestGcLockerEvacFailureThreaded { ++ public static void main(String[] args) throws Exception { ++ System.out.println("Beginning test\n"); ++ ++ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", ++ "-Xmx64m", ++ TestGcLocker.class.getName()); ++ ++ OutputAnalyzer output = new OutputAnalyzer(pb.start()); ++ ++ System.out.println("Output:\n" + output.getOutput()); ++ ++ output.shouldNotContain("java.lang.OutOfMemoryError"); ++ output.shouldHaveExitValue(0); ++ } ++ ++ /** ++ * Tests whether GCLocker terminates the application when forced to spin multiple times. ++ * We cause a long-running native call during which a GC is invoked by another thread. ++ */ ++ static class TestGcLocker { ++ ++ private static int gzipItemLengthBytes = 10500; ++ private static int nGzipItems = 3500; ++ private static int aliveDataItems = (int) (nGzipItems * 0.7); ++ ++ private static int nThreads = 500; ++ private static int loopSize = 1000; ++ ++ private static List dataToBeGzipped = new ArrayList<>(nGzipItems); ++ ++ private static List aliveData = new ArrayList<>(aliveDataItems); ++ ++ private static Random randomGenerator = new Random(); ++ ++ private static volatile boolean cont = true; ++ ++ private static void createData(int gzipItemLengthBytes, int nGzipItems) throws IOException { ++ for (int gzipDataIndex = 0; gzipDataIndex < nGzipItems; gzipDataIndex++) { ++ ByteBuffer buffer = ByteBuffer.allocate(gzipItemLengthBytes); ++ for (int i = 0; i < gzipItemLengthBytes/4; i++) { // since integer is 4 bytes ++ int randomInt = randomGenerator.nextInt(100); ++ buffer.putInt(randomInt); ++ } ++ byte[] data = buffer.array(); ++ dataToBeGzipped.add(data); ++ } ++ ++ for (int i = 0; i < aliveDataItems; i++) { ++ aliveData.add(new byte[0]); ++ } ++ ++ for (int gzipDataIndex = 0; gzipDataIndex < nGzipItems; gzipDataIndex++) { ++ native_critical_section(dataToBeGzipped.get(gzipDataIndex)); ++ } ++ ++ } ++ ++ public static void runTest(int loopSize) { ++ try { ++ int i = 0; ++ while (cont && (i < loopSize)) { ++ i++; ++ try { ++ native_critical_section(dataToBeGzipped.get(i % nGzipItems)); ++ } catch (OutOfMemoryError e) { ++ cont = false; //Remove this if you still want to continue after OOME ++ e.printStackTrace(); ++ } ++ } ++ ++ } catch (IOException e) { ++ cont = true; ++ e.printStackTrace(); ++ } ++ } ++ ++ private static void native_critical_section(byte[] data) throws IOException { ++ try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPOutputStream gzos = new GZIPOutputStream(bos)) { ++ gzos.write(data); ++ gzos.finish(); ++ byte[] compressedData = bos.toByteArray(); ++ int index = randomGenerator.nextInt(aliveDataItems); ++ aliveData.set(index, compressedData); ++ } ++ } ++ ++ public static void main(String[] args) throws InterruptedException, IOException { ++ createData(gzipItemLengthBytes, nGzipItems); ++ ++ System.gc(); //This will tell us the resident set size ++ ++ for (int i = 0; i < nThreads; i++) { ++ Thread t = new Thread() { ++ public void run() { ++ runTest(loopSize); ++ } ++ }; ++ t.start(); ++ } ++ System.out.println("Threads started"); ++ } ++ } ++} ++ +-- +2.19.1 + diff --git a/fix_X509TrustManagerImpl_symantec_distrust.patch b/fix_X509TrustManagerImpl_symantec_distrust.patch index cbeefea9cb707adc84def524c3d77897109cce5a..14a85ba4e7766742054f4a45bec6a113f961004b 100644 --- a/fix_X509TrustManagerImpl_symantec_distrust.patch +++ b/fix_X509TrustManagerImpl_symantec_distrust.patch @@ -35,7 +35,7 @@ diff --git a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java b/jdk/test/sun index 54e1bfa0d..c1423dc5b 100644 --- a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java +++ b/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java -@@ -53,12 +53,12 @@ public class VerifyCACerts { +@@ -54,12 +54,12 @@ public class VerifyCACerts { + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. @@ -47,9 +47,9 @@ index 54e1bfa0d..c1423dc5b 100644 private static final String CHECKSUM - = "2D:04:88:6C:52:53:54:EB:38:2D:BC:E0:AF:B7:82:F4:9E:32:A8:1A:1B:A3:AE:CF:25:CB:C2:F6:0F:4E:E1:20"; + = "81:65:90:49:CF:39:8A:7B:B6:7E:88:9D:A3:E9:D4:31:0E:9B:D0:50:9E:09:76:37:E9:2A:14:74:17:6E:12:EF"; - // map of cert alias to SHA-256 fingerprint @SuppressWarnings("serial") + private static final Map FINGERPRINT_MAP @@ -111,7 +111,9 @@ public class VerifyCACerts { "7E:37:CB:8B:4C:47:09:0C:AB:36:55:1B:A6:F4:5D:B8:40:68:0F:BA:16:6A:95:2D:B1:00:71:7F:43:05:3F:C2"); put("digicerthighassuranceevrootca [jdk]", diff --git a/jdk8u-jdk8u382-b05.tar.xz b/jdk8u-jdk8u392-b08.tar.xz similarity index 82% rename from jdk8u-jdk8u382-b05.tar.xz rename to jdk8u-jdk8u392-b08.tar.xz index dfd279342dc9be49eea6c731f1ad2f584b7a578f..e026d3b0934c8a2353ecb81a39316f1f9aa7985d 100644 Binary files a/jdk8u-jdk8u382-b05.tar.xz and b/jdk8u-jdk8u392-b08.tar.xz differ diff --git a/kae-phase1.patch b/kae-phase1.patch index 89f335366c2c4b9eaafc36125d6f9442c08c6d91..d7362ac7d6b13a77b0e231328bf7cbfae9e21add 100644 --- a/kae-phase1.patch +++ b/kae-phase1.patch @@ -5485,7 +5485,7 @@ index 50f65eab..a388c76a 100644 + "kae.disableKaeDispose", "read")); if (lib != null) { p.env("KRB5_CONFIG", CONF) - .env("KRB5_TRACE", "/dev/stderr") + .env("KRB5_TRACE", Platform.isWindows() ? "CON" : "/dev/stderr") -- 2.19.0 diff --git a/openjdk-1.8.0.spec b/openjdk-1.8.0.spec index 8bf3484cdc1ab629c3cd2cd16e6ec128d338f55f..8a2edaca1f49b7c023f85d58975096a590649bb0 100644 --- a/openjdk-1.8.0.spec +++ b/openjdk-1.8.0.spec @@ -155,13 +155,13 @@ %global origin_nice OpenJDK %global top_level_dir_name %{origin} %global repo jdk8u -%global revision jdk8u382-b05 +%global revision jdk8u392-b08 %global full_revision %{repo}-%{revision} # Define IcedTea version used for SystemTap tapsets and desktop files %global icedteaver 3.15.0 -%global updatever 382 -%global buildver b05 +%global updatever 392 +%global buildver b08 # priority must be 7 digits in total. The expression is workarounding tip %global priority 1800%{updatever} @@ -925,7 +925,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r Name: java-%{javaver}-%{origin} Version: %{javaver}.%{updatever}.%{buildver} -Release: 10 +Release: 0 # 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 # also included the epoch in their virtual provides. This created a @@ -982,7 +982,6 @@ Source20: repackReproduciblePolycies.sh Patch8: replace-vector-to-improve-performance-of-xml.validat.patch Patch10: 8221658.patch Patch18: fix-vendor-info.patch -Patch21: 8202952.patch Patch25: 8196485.patch Patch26: disable-UseLSE-on-ARMv8.1-by-default.patch Patch27: 8157570.patch @@ -1253,7 +1252,6 @@ Patch364: enhance-java-heap-oom-err-log.patch Patch365: 8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch Patch366: 8179273-sun.net.httpserver.LeftOverInputStream-shoul.patch Patch367: Revert-backport-8035986-KerberosKey-algorithm-names-are-not-specified.patch -Patch368: 8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch Patch369: add-0010-8301749-Tracking-malloc-pooled-memory-size.patch Patch370: 8213397-Stack-dump-should-show-more-clearly-when-a-t.patch Patch371: Record-the-number-of-processes-to-errlog-file.patch.patch @@ -1278,6 +1276,10 @@ Patch389: add-8227041-runtime-memory-RunUnitTestsConcurrently.patch Patch390: add-fix-windows-build-Dynamic-CDS-failure.patch Patch391: add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch Patch392: 8295068-SSLEngine-throws-NPE-parsing-CertificateRequ.patch +Patch393: 8308682-Enhance-AES-performance.patch +Patch394: Fix-the-memory-leak-of-MetaspaceAllocationTest.patch +Patch395: Add-metaspace-memory-allocation-failure-validation.patch +Patch396: change-value-of-GCLockerRetryAllocationCount-from-2-.patch ############################################# # @@ -1620,7 +1622,6 @@ pushd %{top_level_dir_name} %patch8 -p1 %patch10 -p1 %patch18 -p1 -%patch21 -p1 %patch25 -p1 %patch26 -p1 %patch27 -p1 @@ -1859,7 +1860,6 @@ pushd %{top_level_dir_name} %patch365 -p1 %patch366 -p1 %patch367 -p1 -%patch368 -p1 %patch369 -p1 %patch370 -p1 %patch371 -p1 @@ -1884,6 +1884,10 @@ pushd %{top_level_dir_name} %patch390 -p1 %patch391 -p1 %patch392 -p1 +%patch393 -p1 +%patch394 -p1 +%patch395 -p1 +%patch396 -p1 %ifarch riscv64 %patch2000 -p1 @@ -2529,6 +2533,19 @@ cjc.mainProgram(arg) %endif %changelog +* Fri Oct 20 2023 Autistic_boyya - 1:1.8.0.392-b08.0 +- add 8308682-Enhance-AES-performance.patch +- add Fix-the-memory-leak-of-MetaspaceAllocationTest.patch +- add Add-metaspace-memory-allocation-failure-validation.patch +- add change-value-of-GCLockerRetryAllocationCount-from-2-.patch +- del 8202952.patch +- del 8283441-C2-segmentation-fault-in-ciMethodBlocks-make.patch +- modified Dynamic-CDS-Archive.patch +- modified fix_X509TrustManagerImpl_symantec_distrust.patch +- modified kae-phase1.patch +- modified update-cacerts-and-VerifyCACerts.java-test.patch +- upgrade to jdk8u392-b08 + * Mon Sep 25 2023 kuenking111 - 1:1.8.0.382-b05.10 - del useless code diff --git a/update-cacerts-and-VerifyCACerts.java-test.patch b/update-cacerts-and-VerifyCACerts.java-test.patch index 4a1fe9a768bfd9259b9f58bcde456ff60b52cbb8..dc4681f3d1e961831d4358d4a3e3a4d6b3370108 100644 --- a/update-cacerts-and-VerifyCACerts.java-test.patch +++ b/update-cacerts-and-VerifyCACerts.java-test.patch @@ -253,7 +253,7 @@ diff --git a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java b/jdk/test/sun index dd107fc..791ddb6 100644 --- a/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java +++ b/jdk/test/sun/security/lib/cacerts/VerifyCACerts.java -@@ -53,12 +53,12 @@ public class VerifyCACerts { +@@ -54,12 +54,12 @@ public class VerifyCACerts { + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. @@ -263,11 +263,11 @@ index dd107fc..791ddb6 100644 // SHA-256 of cacerts, can be generated with // shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95 private static final String CHECKSUM -- = "72:C7:B8:9E:54:94:D2:D9:C0:E5:9F:F7:C3:8C:3B:18:D7:42:23:82:51:F2:AD:A1:14:26:E0:4A:F2:5F:AE:80"; +- = "88:72:92:56:FF:E5:A3:E4:39:98:6D:18:0B:BA:CC:0B:66:CB:1D:6D:52:CE:D7:C8:AD:63:B7:F1:5F:02:24:52"; + = "2D:04:88:6C:52:53:54:EB:38:2D:BC:E0:AF:B7:82:F4:9E:32:A8:1A:1B:A3:AE:CF:25:CB:C2:F6:0F:4E:E1:20"; - // map of cert alias to SHA-256 fingerprint @SuppressWarnings("serial") + private static final Map FINGERPRINT_MAP @@ -93,12 +93,6 @@ public class VerifyCACerts { "E7:93:C9:B0:2F:D8:AA:13:E2:1C:31:22:8A:CC:B0:81:19:64:3B:74:9C:89:89:64:B1:74:6D:46:C3:D4:CB:D2"); put("usertrusteccca [jdk]",