update to 8u422
This commit is contained in:
parent
64c5c6a6c6
commit
dbbd692128
@ -1957,9 +1957,9 @@ index 6413e155b..b59832f73 100644
|
||||
- * @bug 7152176 8168518
|
||||
+ * @bug 7152176 8168518 8014628
|
||||
* @summary More krb5 tests
|
||||
* @library ../../../../java/security/testlibrary/
|
||||
* @library ../../../../java/security/testlibrary/ /test/lib
|
||||
* @compile -XDignore.symbol.file ReplayCacheTestProc.java
|
||||
@@ -126,8 +126,13 @@ public class ReplayCacheTestProc {
|
||||
@@ -139,8 +139,13 @@ public class ReplayCacheTestProc {
|
||||
kdc.addPrincipalRandKey(service(i));
|
||||
}
|
||||
|
||||
@ -1971,9 +1971,9 @@ index 6413e155b..b59832f73 100644
|
||||
+ // Write KTAB after krb5.conf so it contains no aes-sha2 keys
|
||||
kdc.writeKtab(OneKDC.KTAB);
|
||||
- KDC.saveConfig(OneKDC.KRB5_CONF, kdc);
|
||||
|
||||
// User-provided libs
|
||||
String userLibs = System.getProperty("test.libs");
|
||||
|
||||
pi = Proc.create("ReplayCacheTestProc").debug("C")
|
||||
.args("initiator")
|
||||
diff --git a/jdk/test/sun/security/krb5/etype/ETypeOrder.java b/jdk/test/sun/security/krb5/etype/ETypeOrder.java
|
||||
index 9437b16ed..be36d6372 100644
|
||||
--- a/jdk/test/sun/security/krb5/etype/ETypeOrder.java
|
||||
|
||||
@ -2,8 +2,8 @@ diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c
|
||||
index 3c1ea7280..b8d866786 100644
|
||||
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp
|
||||
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp
|
||||
@@ -542,7 +542,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
|
||||
exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
||||
@@ -544,7 +544,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
|
||||
p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
- NOT_PRODUCT(Exceptions::debug_check_abort(exception));
|
||||
|
||||
@ -0,0 +1,168 @@
|
||||
From b9649e772450f25e3c5d47ce1a15b3e1afa12017 Mon Sep 17 00:00:00 2001
|
||||
Date: Wed, 17 Apr 2024 10:43:54 +0000
|
||||
Subject: [PATCH] [Backport]6956385: URLConnection.getLastModified() leaks file handles
|
||||
for jar:file and file: URLs
|
||||
---
|
||||
.../www/protocol/file/FileURLConnection.java | 6 ++
|
||||
.../www/protocol/jar/JarURLConnection.java | 13 ++-
|
||||
.../protocol/jar/FileURLConnectionLeak.java | 100 ++++++++++++++++++
|
||||
3 files changed, 117 insertions(+), 2 deletions(-)
|
||||
create mode 100644 jdk/test/sun/net/www/protocol/jar/FileURLConnectionLeak.java
|
||||
|
||||
diff --git a/jdk/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java
|
||||
index 1997cb08c..16f404988 100644
|
||||
--- a/jdk/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java
|
||||
+++ b/jdk/src/share/classes/sun/net/www/protocol/file/FileURLConnection.java
|
||||
@@ -103,6 +103,12 @@ public class FileURLConnection extends URLConnection {
|
||||
}
|
||||
}
|
||||
|
||||
+ public synchronized void closeInputStream() throws IOException {
|
||||
+ if (is != null) {
|
||||
+ is.close();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private boolean initializedHeaders = false;
|
||||
|
||||
private void initializeHeaders() {
|
||||
diff --git a/jdk/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
|
||||
index d7c442442..f1757da78 100644
|
||||
--- a/jdk/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
|
||||
+++ b/jdk/src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package sun.net.www.protocol.jar;
|
||||
|
||||
+import sun.net.www.protocol.file.FileURLConnection;
|
||||
+
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -107,8 +109,15 @@ public class JarURLConnection extends java.net.JarURLConnection {
|
||||
try {
|
||||
super.close();
|
||||
} finally {
|
||||
- if (!getUseCaches()) {
|
||||
- jarFile.close();
|
||||
+ try {
|
||||
+ if (!getUseCaches()) {
|
||||
+ jarFile.close();
|
||||
+ }
|
||||
+ } finally {
|
||||
+ if (jarFileURLConnection instanceof FileURLConnection) {
|
||||
+ FileURLConnection fileURLConnection = (FileURLConnection) jarFileURLConnection;
|
||||
+ fileURLConnection.closeInputStream();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/jdk/test/sun/net/www/protocol/jar/FileURLConnectionLeak.java b/jdk/test/sun/net/www/protocol/jar/FileURLConnectionLeak.java
|
||||
new file mode 100644
|
||||
index 000000000..4a5f9d7e2
|
||||
--- /dev/null
|
||||
+++ b/jdk/test/sun/net/www/protocol/jar/FileURLConnectionLeak.java
|
||||
@@ -0,0 +1,100 @@
|
||||
+/*
|
||||
+ * 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 6956385
|
||||
+ * @summary JarURLConnection may fail to close its underlying FileURLConnection
|
||||
+ * @run main/othervm FileURLConnectionLeak
|
||||
+ */
|
||||
+
|
||||
+import java.io.InputStream;
|
||||
+import java.io.OutputStream;
|
||||
+import java.lang.management.ManagementFactory;
|
||||
+import java.lang.management.RuntimeMXBean;
|
||||
+import java.net.URI;
|
||||
+import java.net.URL;
|
||||
+import java.net.URLConnection;
|
||||
+import java.nio.file.Files;
|
||||
+import java.nio.file.Path;
|
||||
+import java.nio.file.Paths;
|
||||
+import java.util.jar.Attributes;
|
||||
+import java.util.jar.JarOutputStream;
|
||||
+import java.util.jar.Manifest;
|
||||
+
|
||||
+public class FileURLConnectionLeak {
|
||||
+ public static void main(String[] args) throws Exception {
|
||||
+ Path jar = Paths.get("x.jar").toAbsolutePath();
|
||||
+ Manifest mani = new Manifest();
|
||||
+ mani.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
|
||||
+ try (OutputStream os = Files.newOutputStream(jar); OutputStream jos = new JarOutputStream(os, mani)) {}
|
||||
+ URL u = URI.create("jar:" + jar.toUri() + "!/META-INF/MANIFEST.MF").toURL();
|
||||
+ URLConnection urlConnection = u.openConnection();
|
||||
+ urlConnection.setDefaultUseCaches(false);
|
||||
+ // FileURLConnection.is not used, so was always fine:
|
||||
+ try (InputStream is = u.openStream()) {
|
||||
+ byte[] buffer = new byte[1024];
|
||||
+ int bytesRead;
|
||||
+ while ((bytesRead = is.read(buffer)) != -1) {
|
||||
+ System.out.write(buffer, 0, bytesRead);
|
||||
+ }
|
||||
+ }
|
||||
+ // FileURLConnection.is opened implicitly:
|
||||
+ URLConnection conn = u.openConnection();
|
||||
+ conn.getLastModified();
|
||||
+ // Idiom to close URLConnection (cf. JDK-8224095), which must also close the other stream:
|
||||
+ conn.getInputStream().close();
|
||||
+ Path fds = Paths.get("/proc/" + getPid() + "/fd");
|
||||
+ if (Files.isDirectory(fds)) {
|
||||
+ // Linux: verify that x.jar is not open
|
||||
+ for (Path fd : (Iterable<Path>) Files.list(fds)::iterator) {
|
||||
+ if (Files.isSymbolicLink(fd)) {
|
||||
+ Path file = Files.readSymbolicLink(fd);
|
||||
+ if (file.equals(jar)) {
|
||||
+ throw new IllegalStateException("Still held open " + jar + " from " + fd);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Windows: verify that mandatory file locks do not prevent deletion
|
||||
+ Files.delete(jar);
|
||||
+ }
|
||||
+
|
||||
+ private static int getPid() {
|
||||
+ try {
|
||||
+ // get runtime MXBean
|
||||
+ RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
|
||||
+ // get pid
|
||||
+ String name = runtime.getName();
|
||||
+ int index = name.indexOf('@');
|
||||
+ if (index != -1) {
|
||||
+ return Integer.parseInt(name.substring(0, index));
|
||||
+ }
|
||||
+ } catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,169 @@
|
||||
From 8f3c271e9d34a1105f069fb9d3081c72e1c48180 Mon Sep 17 00:00:00 2001
|
||||
Date: Tue, 28 May 2024 02:31:27 +0000
|
||||
Subject: [PATCH] [Backport]7036144:GZIPInputStream readTrailer uses faulty available()
|
||||
test for end-of-stream
|
||||
---
|
||||
.../java/util/zip/GZIPInputStream.java | 24 ++--
|
||||
.../zip/GZIP/GZIPInputStreamAvailable.java | 112 ++++++++++++++++++
|
||||
2 files changed, 121 insertions(+), 15 deletions(-)
|
||||
create mode 100644 jdk/test/java/util/zip/GZIP/GZIPInputStreamAvailable.java
|
||||
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
index b3d9240ba..0d57e8ab3 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
@@ -224,23 +224,17 @@ class GZIPInputStream extends InflaterInputStream {
|
||||
(readUInt(in) != (inf.getBytesWritten() & 0xffffffffL)))
|
||||
throw new ZipException("Corrupt GZIP trailer");
|
||||
|
||||
- // If there are more bytes available in "in" or
|
||||
- // the leftover in the "inf" is > 26 bytes:
|
||||
- // this.trailer(8) + next.header.min(10) + next.trailer(8)
|
||||
// try concatenated case
|
||||
- if (this.in.available() > 0 || n > 26) {
|
||||
- int m = 8; // this.trailer
|
||||
- try {
|
||||
- m += readHeader(in); // next.header
|
||||
- } catch (IOException ze) {
|
||||
- return true; // ignore any malformed, do nothing
|
||||
- }
|
||||
- inf.reset();
|
||||
- if (n > m)
|
||||
- inf.setInput(buf, len - n + m, n - m);
|
||||
- return false;
|
||||
+ int m = 8; // this.trailer
|
||||
+ try {
|
||||
+ m += readHeader(in); // next.header
|
||||
+ } catch (IOException ze) {
|
||||
+ return true; // ignore any malformed, do nothing
|
||||
}
|
||||
- return true;
|
||||
+ inf.reset();
|
||||
+ if (n > m)
|
||||
+ inf.setInput(buf, len - n + m, n - m);
|
||||
+ return false;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/jdk/test/java/util/zip/GZIP/GZIPInputStreamAvailable.java b/jdk/test/java/util/zip/GZIP/GZIPInputStreamAvailable.java
|
||||
new file mode 100644
|
||||
index 000000000..265050b17
|
||||
--- /dev/null
|
||||
+++ b/jdk/test/java/util/zip/GZIP/GZIPInputStreamAvailable.java
|
||||
@@ -0,0 +1,112 @@
|
||||
+/*
|
||||
+ * 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 7036144
|
||||
+ * @summary Test concatenated gz streams when available() returns zero
|
||||
+ */
|
||||
+
|
||||
+import java.io.*;
|
||||
+import java.util.*;
|
||||
+import java.util.zip.*;
|
||||
+
|
||||
+public class GZIPInputStreamAvailable {
|
||||
+
|
||||
+ public static final int NUM_COPIES = 100;
|
||||
+ public static void main(String[] args) throws Throwable {
|
||||
+ testZeroAvailable();
|
||||
+ }
|
||||
+
|
||||
+ public static void testZeroAvailable() throws IOException {
|
||||
+
|
||||
+ // Create some uncompressed data and then repeat it NUM_COPIES times
|
||||
+ byte[] uncompressed1 = "this is a test".getBytes("ASCII");
|
||||
+ byte[] uncompressedN = repeat(uncompressed1, NUM_COPIES);
|
||||
+
|
||||
+ // Compress the original data and then repeat that NUM_COPIES times
|
||||
+ byte[] compressed1 = deflate(uncompressed1);
|
||||
+ byte[] compressedN = repeat(compressed1, NUM_COPIES);
|
||||
+
|
||||
+ // (a) Read back inflated data from a stream where available() is accurate and verify
|
||||
+ byte[] readback1 = inflate(new ByteArrayInputStream(compressedN), uncompressedN.length);
|
||||
+ assertArrayEquals(uncompressedN, readback1);
|
||||
+
|
||||
+ // (b) Read back inflated data from a stream where available() always returns zero and verify
|
||||
+ byte[] readback2 = inflate(new ZeroAvailableStream(new ByteArrayInputStream(compressedN)), uncompressedN.length);
|
||||
+ assertArrayEquals(uncompressedN, readback2);
|
||||
+ }
|
||||
+
|
||||
+ public static byte[] repeat(byte[] data, int count) {
|
||||
+ byte[] repeat = new byte[data.length * count];
|
||||
+ int off = 0;
|
||||
+ for (int i = 0; i < count; i++) {
|
||||
+ System.arraycopy(data, 0, repeat, off, data.length);
|
||||
+ off += data.length;
|
||||
+ }
|
||||
+ return repeat;
|
||||
+ }
|
||||
+
|
||||
+ public static byte[] deflate(byte[] data) throws IOException {
|
||||
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
||||
+ try (GZIPOutputStream out = new GZIPOutputStream(buf)) {
|
||||
+ out.write(data);
|
||||
+ }
|
||||
+ return buf.toByteArray();
|
||||
+ }
|
||||
+
|
||||
+ public static byte[] inflate(InputStream in, int bufferLen) throws IOException {
|
||||
+ GZIPInputStream gzipInputStream = new GZIPInputStream(in);
|
||||
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
+ byte[] buffer = new byte[bufferLen];
|
||||
+ int len;
|
||||
+ while ((len = gzipInputStream.read(buffer)) != -1) {
|
||||
+ bos.write(buffer, 0, len);
|
||||
+ }
|
||||
+ gzipInputStream.close();
|
||||
+ bos.close();
|
||||
+ return bos.toByteArray();
|
||||
+ }
|
||||
+
|
||||
+ public static class ZeroAvailableStream extends FilterInputStream {
|
||||
+ public ZeroAvailableStream(InputStream in) {
|
||||
+ super(in);
|
||||
+ }
|
||||
+ @Override
|
||||
+ public int available() {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void assertArrayEquals(byte[] arr1, byte[] arr2) {
|
||||
+ if (arr1 == null && arr2 == null) return;
|
||||
+ if (arr1 != null && arr2 != null && arr1.length == arr2.length) {
|
||||
+ for (int i = 0; i < arr1.length; i++) {
|
||||
+ if (arr1[i] != arr2[i]) {
|
||||
+ throw new AssertionError(Arrays.toString(arr1) + " != " + Arrays.toString(arr2));
|
||||
+ }
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ throw new AssertionError(Arrays.toString(arr1) + " != " + Arrays.toString(arr2));
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
From 7af1eca9cf66942bf9e54a582f3046ae9b96a8eb Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 23 May 2024 11:28:10 +0800
|
||||
Subject: [PATCH] [Backport]8068864: C2 failed: modified node is not on
|
||||
IGVN._worklist
|
||||
---
|
||||
hotspot/src/share/vm/opto/loopTransform.cpp | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
|
||||
index 414edc26b..0aca095ce 100644
|
||||
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
|
||||
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
|
||||
@@ -2006,10 +2006,9 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
|
||||
}
|
||||
Node *main_cmp = main_bol->in(1);
|
||||
if( main_cmp->outcnt() > 1 ) { // CmpNode shared?
|
||||
- _igvn.hash_delete(main_bol);
|
||||
main_cmp = main_cmp->clone();// Clone a private CmpNode
|
||||
register_new_node( main_cmp, main_cle->in(0) );
|
||||
- main_bol->set_req(1,main_cmp);
|
||||
+ _igvn.replace_input_of(main_bol, 1, main_cmp);
|
||||
}
|
||||
// Hack the now-private loop bounds
|
||||
_igvn.replace_input_of(main_cmp, 2, main_limit);
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
From 005d0a4e518c2f41aa1d5fc76110214001532df8 Mon Sep 17 00:00:00 2001
|
||||
Date: Wed, 29 May 2024 14:52:13 +0800
|
||||
Subject: [PATCH] [Backport]8151845: Comment in globals.hpp for MetaspaceSize is
|
||||
incorrect.
|
||||
---
|
||||
hotspot/src/share/vm/memory/metaspace.cpp | 2 +-
|
||||
hotspot/src/share/vm/runtime/globals.hpp | 3 ++-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
|
||||
index d08bfba84..1df9eb606 100644
|
||||
--- a/hotspot/src/share/vm/memory/metaspace.cpp
|
||||
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
|
||||
@@ -2599,7 +2599,7 @@ void MetaspaceGC::compute_new_size() {
|
||||
if (PrintGCDetails && Verbose) {
|
||||
gclog_or_tty->print_cr(" "
|
||||
" shrinking:"
|
||||
- " initSize: %.1fK"
|
||||
+ " initThreshold: %.1fK"
|
||||
" maximum_desired_capacity: %.1fK",
|
||||
MetaspaceSize / (double) K,
|
||||
maximum_desired_capacity / (double) K);
|
||||
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
index 6aa53d2d2..f3daa12a6 100644
|
||||
--- a/hotspot/src/share/vm/runtime/globals.hpp
|
||||
+++ b/hotspot/src/share/vm/runtime/globals.hpp
|
||||
@@ -3332,7 +3332,8 @@ class CommandLineFlags {
|
||||
"non-daemon thread (in bytes)") \
|
||||
\
|
||||
product_pd(uintx, MetaspaceSize, \
|
||||
- "Initial size of Metaspaces (in bytes)") \
|
||||
+ "Initial threshold (in bytes) at which a garbage collection " \
|
||||
+ "is done to reduce Metaspace usage") \
|
||||
\
|
||||
product(uintx, MaxMetaspaceSize, max_uintx, \
|
||||
"Maximum size of Metaspaces (in bytes)") \
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,305 @@
|
||||
From 50df8472137e95ff6f64fe4136bbad64db8b46e7 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 27 May 2024 15:12:37 +0800
|
||||
Subject: [PATCH] 8209362: sun/security/ssl/SSLSocketImpl/ReuseAddr.java failed
|
||||
due to "BindException: Address already in use (Bind failed)"
|
||||
---
|
||||
.../net/ssl/templates/SSLSocketTemplate.java | 6 +-
|
||||
.../security/ssl/SSLSocketImpl/ReuseAddr.java | 237 ++----------------
|
||||
2 files changed, 17 insertions(+), 226 deletions(-)
|
||||
|
||||
diff --git a/jdk/test/javax/net/ssl/templates/SSLSocketTemplate.java b/jdk/test/javax/net/ssl/templates/SSLSocketTemplate.java
|
||||
index 9e09a0e35..e62f57eba 100644
|
||||
--- a/jdk/test/javax/net/ssl/templates/SSLSocketTemplate.java
|
||||
+++ b/jdk/test/javax/net/ssl/templates/SSLSocketTemplate.java
|
||||
@@ -224,12 +224,12 @@ public class SSLSocketTemplate {
|
||||
/*
|
||||
* What's the server port? Use any free port by default
|
||||
*/
|
||||
- private volatile int serverPort = 0;
|
||||
+ protected volatile int serverPort = 0;
|
||||
|
||||
/*
|
||||
* Define the server side of the test.
|
||||
*/
|
||||
- private void doServerSide() throws Exception {
|
||||
+ protected void doServerSide() throws Exception {
|
||||
// kick start the server side service
|
||||
SSLContext context = createServerSSLContext();
|
||||
SSLServerSocketFactory sslssf = context.getServerSocketFactory();
|
||||
@@ -290,7 +290,7 @@ public class SSLSocketTemplate {
|
||||
/*
|
||||
* Define the client side of the test.
|
||||
*/
|
||||
- private void doClientSide() throws Exception {
|
||||
+ protected void doClientSide() throws Exception {
|
||||
|
||||
// Wait for server to get started.
|
||||
//
|
||||
diff --git a/jdk/test/sun/security/ssl/SSLSocketImpl/ReuseAddr.java b/jdk/test/sun/security/ssl/SSLSocketImpl/ReuseAddr.java
|
||||
index 650c30988..abad01099 100644
|
||||
--- a/jdk/test/sun/security/ssl/SSLSocketImpl/ReuseAddr.java
|
||||
+++ b/jdk/test/sun/security/ssl/SSLSocketImpl/ReuseAddr.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -25,240 +25,31 @@
|
||||
* @test
|
||||
* @bug 4482446
|
||||
* @summary java.net.SocketTimeoutException on 98, NT, 2000 for JSSE
|
||||
- * @run main/othervm ReuseAddr
|
||||
+ * @library /javax/net/ssl/templates
|
||||
+ * @run main ReuseAddr
|
||||
*
|
||||
* SunJSSE does not support dynamic system properties, no way to re-use
|
||||
* system properties in samevm/agentvm mode.
|
||||
* @author Brad Wetmore
|
||||
*/
|
||||
|
||||
-import java.io.*;
|
||||
-import java.net.*;
|
||||
-import javax.net.ssl.*;
|
||||
+import java.net.ServerSocket;
|
||||
|
||||
-public class ReuseAddr {
|
||||
+public class ReuseAddr extends SSLSocketTemplate {
|
||||
|
||||
- /*
|
||||
- * =============================================================
|
||||
- * Set the various variables needed for the tests, then
|
||||
- * specify what tests to run on each side.
|
||||
- */
|
||||
+ @Override
|
||||
+ protected void doServerSide() throws Exception {
|
||||
+ super.doServerSide();
|
||||
|
||||
- /*
|
||||
- * Should we run the client or server in a separate thread?
|
||||
- * Both sides can throw exceptions, but do you have a preference
|
||||
- * as to which side should be the main thread.
|
||||
- */
|
||||
- static boolean separateServerThread = true;
|
||||
-
|
||||
- /*
|
||||
- * Where do we find the keystores?
|
||||
- */
|
||||
- private final static String pathToStores = "../../../../javax/net/ssl/etc";
|
||||
- static String keyStoreFile = "keystore";
|
||||
- static String trustStoreFile = "truststore";
|
||||
- static String passwd = "passphrase";
|
||||
-
|
||||
- /*
|
||||
- * Is the server ready to serve?
|
||||
- */
|
||||
- volatile static boolean serverReady = false;
|
||||
-
|
||||
- /*
|
||||
- * Turn on SSL debugging?
|
||||
- */
|
||||
- static boolean debug = false;
|
||||
-
|
||||
- /*
|
||||
- * If the client or server is doing some kind of object creation
|
||||
- * that the other side depends on, and that thread prematurely
|
||||
- * exits, you may experience a hang. The test harness will
|
||||
- * terminate all hung threads after its timeout has expired,
|
||||
- * currently 3 minutes by default, but you might try to be
|
||||
- * smart about it....
|
||||
- */
|
||||
-
|
||||
- /*
|
||||
- * Define the server side of the test.
|
||||
- *
|
||||
- * If the server prematurely exits, serverReady will be set to true
|
||||
- * to avoid infinite hangs.
|
||||
- */
|
||||
- void doServerSide() throws Exception {
|
||||
- SSLServerSocketFactory sslssf =
|
||||
- (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
|
||||
- SSLServerSocket sslServerSocket =
|
||||
- (SSLServerSocket) sslssf.createServerSocket(serverPort);
|
||||
- serverPort = sslServerSocket.getLocalPort();
|
||||
-
|
||||
- /*
|
||||
- * Signal Client, we're ready for his connect.
|
||||
- */
|
||||
- serverReady = true;
|
||||
-
|
||||
- SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
|
||||
- InputStream sslIS = sslSocket.getInputStream();
|
||||
- OutputStream sslOS = sslSocket.getOutputStream();
|
||||
-
|
||||
- sslIS.read();
|
||||
- sslOS.write(85);
|
||||
- sslOS.flush();
|
||||
-
|
||||
- sslSocket.close();
|
||||
-
|
||||
- // Close original server socket
|
||||
- sslServerSocket.close();
|
||||
-
|
||||
- // Try rebinding to same port
|
||||
- sslServerSocket =
|
||||
- (SSLServerSocket) sslssf.createServerSocket(serverPort);
|
||||
- sslServerSocket.close();
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Define the client side of the test.
|
||||
- *
|
||||
- * If the server prematurely exits, serverReady will be set to true
|
||||
- * to avoid infinite hangs.
|
||||
- */
|
||||
- void doClientSide() throws Exception {
|
||||
-
|
||||
- /*
|
||||
- * Wait for server to get started.
|
||||
- */
|
||||
- while (!serverReady) {
|
||||
- Thread.sleep(50);
|
||||
+ // Note that if this port is already used by another test,
|
||||
+ // this test will fail.
|
||||
+ System.out.println("Try rebinding to same port: " + serverPort);
|
||||
+ try (ServerSocket server = new ServerSocket(serverPort)) {
|
||||
+ System.out.println("Server port: " + server.getLocalPort());
|
||||
}
|
||||
-
|
||||
- SSLSocketFactory sslsf =
|
||||
- (SSLSocketFactory) SSLSocketFactory.getDefault();
|
||||
- SSLSocket sslSocket = (SSLSocket)
|
||||
- sslsf.createSocket("localhost", serverPort);
|
||||
-
|
||||
- InputStream sslIS = sslSocket.getInputStream();
|
||||
- OutputStream sslOS = sslSocket.getOutputStream();
|
||||
-
|
||||
- sslOS.write(280);
|
||||
- sslOS.flush();
|
||||
- sslIS.read();
|
||||
-
|
||||
- sslSocket.close();
|
||||
}
|
||||
|
||||
- /*
|
||||
- * =============================================================
|
||||
- * The remainder is just support stuff
|
||||
- */
|
||||
-
|
||||
- // use any free port by default
|
||||
- volatile int serverPort = 0;
|
||||
-
|
||||
- volatile Exception serverException = null;
|
||||
- volatile Exception clientException = null;
|
||||
-
|
||||
public static void main(String[] args) throws Exception {
|
||||
- String keyFilename =
|
||||
- System.getProperty("test.src", "./") + "/" + pathToStores +
|
||||
- "/" + keyStoreFile;
|
||||
- String trustFilename =
|
||||
- System.getProperty("test.src", "./") + "/" + pathToStores +
|
||||
- "/" + trustStoreFile;
|
||||
-
|
||||
- System.setProperty("javax.net.ssl.keyStore", keyFilename);
|
||||
- System.setProperty("javax.net.ssl.keyStorePassword", passwd);
|
||||
- System.setProperty("javax.net.ssl.trustStore", trustFilename);
|
||||
- System.setProperty("javax.net.ssl.trustStorePassword", passwd);
|
||||
-
|
||||
- if (debug)
|
||||
- System.setProperty("javax.net.debug", "all");
|
||||
-
|
||||
- /*
|
||||
- * Start the tests.
|
||||
- */
|
||||
- new ReuseAddr();
|
||||
- }
|
||||
-
|
||||
- Thread clientThread = null;
|
||||
- Thread serverThread = null;
|
||||
-
|
||||
- /*
|
||||
- * Primary constructor, used to drive remainder of the test.
|
||||
- *
|
||||
- * Fork off the other side, then do your work.
|
||||
- */
|
||||
- ReuseAddr() throws Exception {
|
||||
- if (separateServerThread) {
|
||||
- startServer(true);
|
||||
- startClient(false);
|
||||
- } else {
|
||||
- startClient(true);
|
||||
- startServer(false);
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Wait for other side to close down.
|
||||
- */
|
||||
- if (separateServerThread) {
|
||||
- serverThread.join();
|
||||
- } else {
|
||||
- clientThread.join();
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * When we get here, the test is pretty much over.
|
||||
- *
|
||||
- * If the main thread excepted, that propagates back
|
||||
- * immediately. If the other thread threw an exception, we
|
||||
- * should report back.
|
||||
- */
|
||||
- if (serverException != null)
|
||||
- throw serverException;
|
||||
- if (clientException != null)
|
||||
- throw clientException;
|
||||
- }
|
||||
-
|
||||
- void startServer(boolean newThread) throws Exception {
|
||||
- if (newThread) {
|
||||
- serverThread = new Thread() {
|
||||
- public void run() {
|
||||
- try {
|
||||
- doServerSide();
|
||||
- } catch (Exception e) {
|
||||
- /*
|
||||
- * Our server thread just died.
|
||||
- *
|
||||
- * Release the client, if not active already...
|
||||
- */
|
||||
- System.err.println("Server died...");
|
||||
- serverReady = true;
|
||||
- serverException = e;
|
||||
- }
|
||||
- }
|
||||
- };
|
||||
- serverThread.start();
|
||||
- } else {
|
||||
- doServerSide();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- void startClient(boolean newThread) throws Exception {
|
||||
- if (newThread) {
|
||||
- clientThread = new Thread() {
|
||||
- public void run() {
|
||||
- try {
|
||||
- doClientSide();
|
||||
- } catch (Exception e) {
|
||||
- /*
|
||||
- * Our client thread just died.
|
||||
- */
|
||||
- System.err.println("Client died...");
|
||||
- clientException = e;
|
||||
- }
|
||||
- }
|
||||
- };
|
||||
- clientThread.start();
|
||||
- } else {
|
||||
- doClientSide();
|
||||
- }
|
||||
+ new ReuseAddr().run();
|
||||
}
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -0,0 +1,171 @@
|
||||
From 8e53927b6739a935dc833f7e9527dacb71bae1a8 Mon Sep 17 00:00:00 2001
|
||||
Date: Thu, 30 May 2024 07:02:40 +0000
|
||||
Subject: [PATCH] [Backport]8210706: G1 may deadlock when starting a concurrent cycle at
|
||||
shutdown
|
||||
---
|
||||
.../gc_implementation/g1/concurrentMark.cpp | 20 +++++++++++--------
|
||||
.../gc_implementation/g1/concurrentMark.hpp | 4 ++++
|
||||
.../g1/concurrentMarkThread.cpp | 8 +++++++-
|
||||
.../gc_implementation/g1/g1CollectedHeap.cpp | 14 +++++++------
|
||||
.../shared/concurrentGCThread.hpp | 2 ++
|
||||
5 files changed, 33 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
|
||||
index 1347a7e16..cad474b83 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
|
||||
@@ -477,6 +477,16 @@ HeapRegion* CMRootRegions::claim_next() {
|
||||
return res;
|
||||
}
|
||||
|
||||
+void CMRootRegions::notify_scan_done() {
|
||||
+ MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
|
||||
+ _scan_in_progress = false;
|
||||
+ RootRegionScan_lock->notify_all();
|
||||
+}
|
||||
+
|
||||
+void CMRootRegions::cancel_scan() {
|
||||
+ notify_scan_done();
|
||||
+}
|
||||
+
|
||||
void CMRootRegions::scan_finished() {
|
||||
assert(scan_in_progress(), "pre-condition");
|
||||
|
||||
@@ -486,11 +496,7 @@ void CMRootRegions::scan_finished() {
|
||||
}
|
||||
_next_survivor = NULL;
|
||||
|
||||
- {
|
||||
- MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
|
||||
- _scan_in_progress = false;
|
||||
- RootRegionScan_lock->notify_all();
|
||||
- }
|
||||
+ notify_scan_done();
|
||||
}
|
||||
|
||||
bool CMRootRegions::wait_until_scan_finished() {
|
||||
@@ -1224,13 +1230,11 @@ public:
|
||||
};
|
||||
|
||||
void ConcurrentMark::scanRootRegions() {
|
||||
- // Start of concurrent marking.
|
||||
- ClassLoaderDataGraph::clear_claimed_marks();
|
||||
-
|
||||
// scan_in_progress() will have been set to true only if there was
|
||||
// at least one root region to scan. So, if it's false, we
|
||||
// should not attempt to do any further work.
|
||||
if (root_regions()->scan_in_progress()) {
|
||||
+ assert(!has_aborted(), "Aborting before root region scanning is finished not supported.");
|
||||
_parallel_marking_threads = calc_parallel_marking_threads();
|
||||
assert(parallel_marking_threads() <= max_parallel_marking_threads(),
|
||||
"Maximum number of marking threads exceeded");
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
|
||||
index bbd5d590a..172caef29 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp
|
||||
@@ -333,6 +333,8 @@ private:
|
||||
volatile bool _should_abort;
|
||||
HeapRegion* volatile _next_survivor;
|
||||
|
||||
+ void notify_scan_done();
|
||||
+
|
||||
public:
|
||||
CMRootRegions();
|
||||
// We actually do most of the initialization in this method.
|
||||
@@ -352,6 +354,8 @@ public:
|
||||
// all have been claimed.
|
||||
HeapRegion* claim_next();
|
||||
|
||||
+ void cancel_scan();
|
||||
+
|
||||
// Flag that we're done with root region scanning and notify anyone
|
||||
// who's waiting on it. If aborted is false, assume that all regions
|
||||
// have been claimed.
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
|
||||
index 9b0452f92..3c4553bf7 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
+#include "classfile/classLoaderData.hpp"
|
||||
#include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
|
||||
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
|
||||
#include "gc_implementation/g1/g1CollectorPolicy.hpp"
|
||||
@@ -100,6 +101,10 @@ void ConcurrentMarkThread::run() {
|
||||
HandleMark hm;
|
||||
double cycle_start = os::elapsedVTime();
|
||||
|
||||
+ {
|
||||
+ ClassLoaderDataGraph::clear_claimed_marks();
|
||||
+ }
|
||||
+
|
||||
// We have to ensure that we finish scanning the root regions
|
||||
// before the next GC takes place. To ensure this we have to
|
||||
// make sure that we do not join the STS until the root regions
|
||||
@@ -109,7 +114,7 @@ void ConcurrentMarkThread::run() {
|
||||
// correctness issue.
|
||||
|
||||
double scan_start = os::elapsedTime();
|
||||
- if (!cm()->has_aborted()) {
|
||||
+ {
|
||||
if (G1Log::fine()) {
|
||||
gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
|
||||
gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]");
|
||||
@@ -297,6 +302,7 @@ void ConcurrentMarkThread::run() {
|
||||
}
|
||||
}
|
||||
assert(_should_terminate, "just checking");
|
||||
+ _cm->root_regions()->cancel_scan();
|
||||
|
||||
terminate();
|
||||
}
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
|
||||
index 5b156f99d..3ff5586c1 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
|
||||
@@ -1346,8 +1346,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
|
||||
ref_processor_cm()->verify_no_references_recorded();
|
||||
|
||||
// Abandon current iterations of concurrent marking and concurrent
|
||||
- // refinement, if any are in progress. We have to do this before
|
||||
- // wait_until_scan_finished() below.
|
||||
+ // refinement, if any are in progress.
|
||||
concurrent_mark()->abort();
|
||||
|
||||
// Make sure we'll choose a new allocation region afterwards.
|
||||
@@ -4032,10 +4031,13 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||
verify_region_sets_optional();
|
||||
verify_dirty_young_regions();
|
||||
|
||||
- // This call will decide whether this pause is an initial-mark
|
||||
- // pause. If it is, during_initial_mark_pause() will return true
|
||||
- // for the duration of this pause.
|
||||
- g1_policy()->decide_on_conc_mark_initiation();
|
||||
+ // We should not be doing initial mark unless the conc mark thread is running
|
||||
+ if (!_cmThread->should_terminate()) {
|
||||
+ // This call will decide whether this pause is an initial-mark
|
||||
+ // pause. If it is, during_initial_mark_pause() will return true
|
||||
+ // for the duration of this pause.
|
||||
+ g1_policy()->decide_on_conc_mark_initiation();
|
||||
+ }
|
||||
|
||||
// We do not allow initial-mark to be piggy-backed on a mixed GC.
|
||||
assert(!g1_policy()->during_initial_mark_pause() ||
|
||||
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
|
||||
index 1e16bf726..ceb65b029 100644
|
||||
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
|
||||
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
|
||||
// Tester
|
||||
bool is_ConcurrentGC_thread() const { return true; }
|
||||
+
|
||||
+ bool should_terminate() { return _should_terminate; }
|
||||
};
|
||||
|
||||
// The SurrogateLockerThread is used by concurrent GC threads for
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,524 @@
|
||||
From d9cb35d747e5f38210a3207d6821e333dcf45a8b Mon Sep 17 00:00:00 2001
|
||||
Date: Fri, 31 May 2024 15:39:38 +0800
|
||||
Subject: [PATCH] [Backport]8318889: Backport Important Fixed Issues in Later Versions
|
||||
2024_5_30
|
||||
---
|
||||
hotspot/src/os/linux/vm/os_perf_linux.cpp | 2 +-
|
||||
hotspot/src/share/vm/opto/loopnode.cpp | 8 +-
|
||||
hotspot/src/share/vm/prims/jni.cpp | 5 +
|
||||
.../abstractMethod/AbstractMethodClass.jasm | 43 ++++++
|
||||
.../abstractMethod/TestJNIAbstractMethod.java | 68 +++++++++
|
||||
.../jni/abstractMethod/libJNIAbstractMethod.c | 43 ++++++
|
||||
.../media/sound/StandardMidiFileReader.java | 13 +-
|
||||
.../classes/javax/swing/text/html/CSS.java | 6 +-
|
||||
jdk/src/share/native/java/util/zip/zip_util.c | 2 +-
|
||||
.../native/sun/awt/image/jpeg/imageioJPEG.c | 4 +
|
||||
.../native/sun/awt/image/jpeg/jpegdecoder.c | 4 +
|
||||
.../File/SMFInterruptedRunningStatus.java | 143 ++++++++++++++++++
|
||||
12 files changed, 331 insertions(+), 10 deletions(-)
|
||||
create mode 100644 hotspot/test/runtime/jni/abstractMethod/AbstractMethodClass.jasm
|
||||
create mode 100644 hotspot/test/runtime/jni/abstractMethod/TestJNIAbstractMethod.java
|
||||
create mode 100644 hotspot/test/runtime/jni/abstractMethod/libJNIAbstractMethod.c
|
||||
create mode 100644 jdk/test/javax/sound/midi/File/SMFInterruptedRunningStatus.java
|
||||
|
||||
diff --git a/hotspot/src/os/linux/vm/os_perf_linux.cpp b/hotspot/src/os/linux/vm/os_perf_linux.cpp
|
||||
index 0d1f75810..6a92675a6 100644
|
||||
--- a/hotspot/src/os/linux/vm/os_perf_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/os_perf_linux.cpp
|
||||
@@ -941,7 +941,7 @@ SystemProcessInterface::SystemProcesses::ProcessIterator::ProcessIterator() {
|
||||
bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() {
|
||||
_dir = os::opendir("/proc");
|
||||
_entry = NULL;
|
||||
- _valid = true;
|
||||
+ _valid = _dir != NULL; // May be null if /proc is not accessible.
|
||||
next_process();
|
||||
|
||||
return true;
|
||||
diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp
|
||||
index 5e6d53a48..351e6888b 100644
|
||||
--- a/hotspot/src/share/vm/opto/loopnode.cpp
|
||||
+++ b/hotspot/src/share/vm/opto/loopnode.cpp
|
||||
@@ -2571,6 +2571,7 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool skip_loop_opts)
|
||||
NOT_PRODUCT( C->verify_graph_edges(); )
|
||||
worklist.push( C->top() );
|
||||
build_loop_late( visited, worklist, nstack );
|
||||
+ if (C->failing()) { return; }
|
||||
|
||||
if (_verify_only) {
|
||||
// restore major progress flag
|
||||
@@ -3781,6 +3782,7 @@ void PhaseIdealLoop::build_loop_late( VectorSet &visited, Node_List &worklist, N
|
||||
} else {
|
||||
// All of n's children have been processed, complete post-processing.
|
||||
build_loop_late_post(n);
|
||||
+ if (C->failing()) { return; }
|
||||
if (nstack.is_empty()) {
|
||||
// Finished all nodes on stack.
|
||||
// Process next node on the worklist.
|
||||
@@ -3884,13 +3886,15 @@ void PhaseIdealLoop::build_loop_late_post( Node *n ) {
|
||||
Node *legal = LCA; // Walk 'legal' up the IDOM chain
|
||||
Node *least = legal; // Best legal position so far
|
||||
while( early != legal ) { // While not at earliest legal
|
||||
-#ifdef ASSERT
|
||||
if (legal->is_Start() && !early->is_Root()) {
|
||||
+#ifdef ASSERT
|
||||
// Bad graph. Print idom path and fail.
|
||||
dump_bad_graph("Bad graph detected in build_loop_late", n, early, LCA);
|
||||
assert(false, "Bad graph detected in build_loop_late");
|
||||
- }
|
||||
#endif
|
||||
+ C->record_method_not_compilable("Bad graph detected in build_loop_late");
|
||||
+ return;
|
||||
+ }
|
||||
// Find least loop nesting depth
|
||||
legal = idom(legal); // Bump up the IDOM tree
|
||||
// Check for lower nesting depth
|
||||
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
|
||||
index de0aae9b4..cccb578ea 100644
|
||||
--- a/hotspot/src/share/vm/prims/jni.cpp
|
||||
+++ b/hotspot/src/share/vm/prims/jni.cpp
|
||||
@@ -1380,6 +1380,11 @@ static void jni_invoke_nonstatic(JNIEnv *env, JavaValue* result, jobject receive
|
||||
}
|
||||
}
|
||||
|
||||
+ if (selected_method->is_abstract()) {
|
||||
+ ResourceMark rm(THREAD);
|
||||
+ THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), selected_method->name()->as_C_string());
|
||||
+ }
|
||||
+
|
||||
methodHandle method(THREAD, selected_method);
|
||||
|
||||
// Create object to hold arguments for the JavaCall, and associate it with
|
||||
diff --git a/hotspot/test/runtime/jni/abstractMethod/AbstractMethodClass.jasm b/hotspot/test/runtime/jni/abstractMethod/AbstractMethodClass.jasm
|
||||
new file mode 100644
|
||||
index 000000000..24c53f203
|
||||
--- /dev/null
|
||||
+++ b/hotspot/test/runtime/jni/abstractMethod/AbstractMethodClass.jasm
|
||||
@@ -0,0 +1,43 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ */
|
||||
+/*
|
||||
+ * This is a non-abstract class with an abstract method.
|
||||
+ *
|
||||
+ */
|
||||
+super public class AbstractMethodClass
|
||||
+ extends java/lang/Object
|
||||
+ version 51:0 // Java 7 version
|
||||
+{
|
||||
+
|
||||
+ public Method "<init>":"()V"
|
||||
+ stack 1 locals 1
|
||||
+ {
|
||||
+ aload_0;
|
||||
+ invokespecial Method java/lang/Object."<init>":"()V";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ public abstract Method "abstractM":"()V";
|
||||
+
|
||||
+}
|
||||
diff --git a/hotspot/test/runtime/jni/abstractMethod/TestJNIAbstractMethod.java b/hotspot/test/runtime/jni/abstractMethod/TestJNIAbstractMethod.java
|
||||
new file mode 100644
|
||||
index 000000000..2384f6d5a
|
||||
--- /dev/null
|
||||
+++ b/hotspot/test/runtime/jni/abstractMethod/TestJNIAbstractMethod.java
|
||||
@@ -0,0 +1,68 @@
|
||||
+/*
|
||||
+ * 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 8323243
|
||||
+ * @summary Test that invocation of an abstract method from JNI works correctly
|
||||
+ * @compile AbstractMethodClass.jasm
|
||||
+ * @run main/othervm/native TestJNIAbstractMethod
|
||||
+ */
|
||||
+
|
||||
+/**
|
||||
+ * We are testing invocation of an abstract method from JNI - which should
|
||||
+ * simply result in throwning AbstractMethodError. To invoke an abstract method
|
||||
+ * we must have an instance method (as abstract static methods are illegal),
|
||||
+ * but instantiating an abstract class is also illegal at the Java language
|
||||
+ * level, so we have to use a custom jasm class that contains an abstract method
|
||||
+ * declaration, but which is not itself declared as an abstract class.
|
||||
+ */
|
||||
+public class TestJNIAbstractMethod {
|
||||
+
|
||||
+ // Invokes an abstract method from JNI and throws AbstractMethodError.
|
||||
+ private static native void invokeAbstractM(Class<?> AMclass,
|
||||
+ AbstractMethodClass receiver);
|
||||
+
|
||||
+ static {
|
||||
+ System.loadLibrary("JNIAbstractMethod");
|
||||
+ }
|
||||
+
|
||||
+ public static void main(String[] args) {
|
||||
+ AbstractMethodClass obj = new AbstractMethodClass();
|
||||
+ try {
|
||||
+ System.out.println("Attempting direct invocation via Java");
|
||||
+ obj.abstractM();
|
||||
+ throw new RuntimeException("Did not get AbstractMethodError from Java!");
|
||||
+ } catch (AbstractMethodError expected) {
|
||||
+ System.out.println("ok - got expected exception: " + expected);
|
||||
+ }
|
||||
+ try {
|
||||
+ System.out.println("Attempting direct invocation via JNI");
|
||||
+ invokeAbstractM(obj.getClass(), obj);
|
||||
+ throw new RuntimeException("Did not get AbstractMethodError from JNI!");
|
||||
+ } catch (AbstractMethodError expected) {
|
||||
+ System.out.println("ok - got expected exception: " + expected);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/hotspot/test/runtime/jni/abstractMethod/libJNIAbstractMethod.c b/hotspot/test/runtime/jni/abstractMethod/libJNIAbstractMethod.c
|
||||
new file mode 100644
|
||||
index 000000000..35a28f702
|
||||
--- /dev/null
|
||||
+++ b/hotspot/test/runtime/jni/abstractMethod/libJNIAbstractMethod.c
|
||||
@@ -0,0 +1,43 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ */
|
||||
+#include <jni.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+JNIEXPORT void JNICALL Java_TestJNIAbstractMethod_invokeAbstractM(JNIEnv* env,
|
||||
+ jclass this_cls,
|
||||
+ jclass target_cls,
|
||||
+ jobject receiver) {
|
||||
+
|
||||
+ jmethodID mid = (*env)->GetMethodID(env, target_cls, "abstractM", "()V");
|
||||
+ if (mid == NULL) {
|
||||
+ fprintf(stderr, "Error looking up method abstractM\n");
|
||||
+ (*env)->ExceptionDescribe(env);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ printf("Invoking abstract method ...\n");
|
||||
+ (*env)->CallVoidMethod(env, receiver, mid); // Should raise exception
|
||||
+
|
||||
+}
|
||||
diff --git a/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java b/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
|
||||
index 20ebe4f06..ba7f344a4 100644
|
||||
--- a/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
|
||||
+++ b/jdk/src/share/classes/com/sun/media/sound/StandardMidiFileReader.java
|
||||
@@ -326,10 +326,10 @@ final class SMFParser {
|
||||
// reset current tick to 0
|
||||
long tick = 0;
|
||||
|
||||
- // reset current status byte to 0 (invalid value).
|
||||
+ // reset current running status byte to 0 (invalid value).
|
||||
// this should cause us to throw an InvalidMidiDataException if we don't
|
||||
// get a valid status byte from the beginning of the track.
|
||||
- int status = 0;
|
||||
+ int runningStatus = 0;
|
||||
boolean endOfTrackFound = false;
|
||||
|
||||
while (!trackFinished() && !endOfTrackFound) {
|
||||
@@ -346,10 +346,17 @@ final class SMFParser {
|
||||
// check for new status
|
||||
int byteValue = readUnsigned();
|
||||
|
||||
+ int status;
|
||||
if (byteValue >= 0x80) {
|
||||
status = byteValue;
|
||||
+
|
||||
+ // update running status (only for channel messages)
|
||||
+ if ((status & 0xF0) != 0xF0) {
|
||||
+ runningStatus = status;
|
||||
+ }
|
||||
} else {
|
||||
- data1 = byteValue;
|
||||
+ status = runningStatus;
|
||||
+ data1 = byteValue;
|
||||
}
|
||||
|
||||
switch (status & 0xF0) {
|
||||
diff --git a/jdk/src/share/classes/javax/swing/text/html/CSS.java b/jdk/src/share/classes/javax/swing/text/html/CSS.java
|
||||
index 4a944d381..4713bcd60 100644
|
||||
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java
|
||||
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java
|
||||
@@ -2581,8 +2581,8 @@ public class CSS implements Serializable {
|
||||
* Used for BackgroundImages.
|
||||
*/
|
||||
static class BackgroundImage extends CssValue {
|
||||
- private boolean loadedImage;
|
||||
- private ImageIcon image;
|
||||
+ private volatile boolean loadedImage;
|
||||
+ private ImageIcon image;
|
||||
|
||||
Object parseCssValue(String value) {
|
||||
BackgroundImage retValue = new BackgroundImage();
|
||||
@@ -2600,7 +2600,6 @@ public class CSS implements Serializable {
|
||||
synchronized(this) {
|
||||
if (!loadedImage) {
|
||||
URL url = CSS.getURL(base, svalue);
|
||||
- loadedImage = true;
|
||||
if (url != null) {
|
||||
image = new ImageIcon();
|
||||
Image tmpImg = Toolkit.getDefaultToolkit().createImage(url);
|
||||
@@ -2608,6 +2607,7 @@ public class CSS implements Serializable {
|
||||
image.setImage(tmpImg);
|
||||
}
|
||||
}
|
||||
+ loadedImage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c
|
||||
index ff59c5ecc..8b0c08909 100644
|
||||
--- a/jdk/src/share/native/java/util/zip/zip_util.c
|
||||
+++ b/jdk/src/share/native/java/util/zip/zip_util.c
|
||||
@@ -443,7 +443,7 @@ hash(const char *s)
|
||||
static unsigned int
|
||||
hashN(const char *s, int length)
|
||||
{
|
||||
- int h = 0;
|
||||
+ unsigned int h = 0;
|
||||
while (length-- > 0)
|
||||
h = 31*h + *s++;
|
||||
return h;
|
||||
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
index 7e1d8c99d..1cd9e8bdb 100644
|
||||
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
|
||||
@@ -1131,6 +1131,10 @@ imageio_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
|
||||
return;
|
||||
}
|
||||
num_bytes += sb->remaining_skip;
|
||||
+ // Check for overflow if remaining_skip value is too large
|
||||
+ if (num_bytes < 0) {
|
||||
+ return;
|
||||
+ }
|
||||
sb->remaining_skip = 0;
|
||||
|
||||
/* First the easy case where we are skipping <= the current contents. */
|
||||
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
|
||||
index cea158e17..2f64d33cc 100644
|
||||
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
|
||||
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
|
||||
@@ -406,6 +406,10 @@ sun_jpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
|
||||
return;
|
||||
}
|
||||
num_bytes += src->remaining_skip;
|
||||
+ // Check for overflow if remaining_skip value is too large
|
||||
+ if (num_bytes < 0) {
|
||||
+ return;
|
||||
+ }
|
||||
src->remaining_skip = 0;
|
||||
ret = (int)src->pub.bytes_in_buffer; /* this conversion is safe, because capacity of the buffer is limited by jnit */
|
||||
if (ret >= num_bytes) {
|
||||
diff --git a/jdk/test/javax/sound/midi/File/SMFInterruptedRunningStatus.java b/jdk/test/javax/sound/midi/File/SMFInterruptedRunningStatus.java
|
||||
new file mode 100644
|
||||
index 000000000..1b82e2f73
|
||||
--- /dev/null
|
||||
+++ b/jdk/test/javax/sound/midi/File/SMFInterruptedRunningStatus.java
|
||||
@@ -0,0 +1,143 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
+ *
|
||||
+ * This code is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 only, as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
+ * version 2 for more details (a copy is included in the LICENSE file that
|
||||
+ * accompanied this code).
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License version
|
||||
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
||||
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *
|
||||
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
+ * or visit www.oracle.com if you need additional information or have any
|
||||
+ * questions.
|
||||
+ */
|
||||
+
|
||||
+import java.io.ByteArrayInputStream;
|
||||
+
|
||||
+import javax.sound.midi.MidiSystem;
|
||||
+import javax.sound.midi.Sequence;
|
||||
+import javax.sound.midi.Track;
|
||||
+
|
||||
+/**
|
||||
+ * @test
|
||||
+ * @bug 8319598
|
||||
+ * @summary SMFParser bug with running status, interrupted by Meta or SysEx messages
|
||||
+ */
|
||||
+public class SMFInterruptedRunningStatus {
|
||||
+
|
||||
+ public static void main(String[] args) throws Exception {
|
||||
+
|
||||
+ byte[][] files = new byte[][] {SMF_1, SMF_2, SMF_3};
|
||||
+ for (int i = 0; i < files.length; i++) {
|
||||
+ Sequence seq = MidiSystem.getSequence(
|
||||
+ new ByteArrayInputStream(files[i]));
|
||||
+ testSequence(seq, i + 1);
|
||||
+ }
|
||||
+
|
||||
+ // no exception thrown, all files have been parsed correctly
|
||||
+ System.out.println("Test passed");
|
||||
+ }
|
||||
+
|
||||
+ private static void testSequence(Sequence seq, int fileNumber) {
|
||||
+
|
||||
+ // check number of tracks and number of events
|
||||
+ Track[] tracks = seq.getTracks();
|
||||
+ if (1 != tracks.length) {
|
||||
+ throw new RuntimeException("file number "
|
||||
+ + fileNumber + " fails (incorrect number of tracks: "
|
||||
+ + tracks.length + ")");
|
||||
+ }
|
||||
+ Track track = tracks[0];
|
||||
+ if (7 != track.size()) {
|
||||
+ throw new RuntimeException("file number " + fileNumber
|
||||
+ + " fails (incorrect number of events: "
|
||||
+ + track.size() + ")");
|
||||
+ }
|
||||
+
|
||||
+ // check status byte of each message
|
||||
+ int[] expectedStatusBytes = new int[] {
|
||||
+ 0x90, 0xFF, 0x90, 0x90, 0x90, 0xFF, 0xFF};
|
||||
+ for (int i = 0; i < expectedStatusBytes.length; i++) {
|
||||
+ int expected = expectedStatusBytes[i];
|
||||
+ if (expected != track.get(i).getMessage().getStatus()) {
|
||||
+ throw new RuntimeException("file number " + fileNumber
|
||||
+ + " fails (wrong status byte in event " + i + ")");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // MIDI file without running status - should work equally before
|
||||
+ // and after the bugfix
|
||||
+ private static final byte[] SMF_1 = {
|
||||
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
|
||||
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
|
||||
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x24, // track header
|
||||
+ 0x00, // delta time
|
||||
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
|
||||
+ 0x40, // delta time
|
||||
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
|
||||
+ 0x20, // delta time
|
||||
+ (byte) 0x90, 0x3C, 0x00, // Note-OFF (C)
|
||||
+ 0x20, // delta time
|
||||
+ (byte) 0x90, 0x3E, 0x7F, // Note-ON (D)
|
||||
+ 0x60, // delta time
|
||||
+ (byte) 0x90, 0x3E, 0x00, // Note-OFF (D)
|
||||
+ 0x20, // delta time
|
||||
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
|
||||
+ 0x00, // delta time
|
||||
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
|
||||
+ };
|
||||
+
|
||||
+ // MIDI file with running status, interrupted by a META message
|
||||
+ // - failed before the bugfix
|
||||
+ private static final byte[] SMF_2 = {
|
||||
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
|
||||
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
|
||||
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x21, // track header
|
||||
+ 0x00, // delta time
|
||||
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
|
||||
+ 0x40, // delta time
|
||||
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (interruptor)
|
||||
+ 0x20, // delta time
|
||||
+ 0x3C, 0x00, // Note-OFF (C) - running status
|
||||
+ 0x20, // delta time
|
||||
+ 0x3E, 0x7F, // Note-ON (D) - running status
|
||||
+ 0x60, // delta time
|
||||
+ 0x3E, 0x00, // Note-OFF (D) - running status
|
||||
+ 0x20, // delta time
|
||||
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
|
||||
+ 0x00, // delta time
|
||||
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
|
||||
+ };
|
||||
+
|
||||
+ // MIDI file with running status, interrupted by a META message
|
||||
+ // - succeeded before the bugfix but with wrong interpretation of the data
|
||||
+ private static final byte[] SMF_3 = {
|
||||
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
|
||||
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
|
||||
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x21, // track header
|
||||
+ 0x00, // delta time
|
||||
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
|
||||
+ 0x40, // delta time
|
||||
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (interruptor)
|
||||
+ 0x20, // delta time
|
||||
+ 0x3C, 0x00, // Note-OFF (C) - running status
|
||||
+ 0x0D, // delta time
|
||||
+ 0x3E, 0x7F, // Note-ON (D) - running status
|
||||
+ 0x60, // delta time
|
||||
+ 0x3E, 0x00, // Note-OFF (D) - running status
|
||||
+ 0x20, // delta time
|
||||
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
|
||||
+ 0x00, // delta time
|
||||
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
|
||||
+ };
|
||||
+}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -3070,12 +3070,13 @@ index 8dd4e6b21..6a2d8077f 100644
|
||||
// We take care not to be blocking while holding the
|
||||
// SymbolTable_lock. Otherwise, the system might deadlock, since the
|
||||
// symboltable is used during compilation (VM_thread) The lock free
|
||||
@@ -236,12 +267,32 @@ unsigned int SymbolTable::hash_symbol(const char* s, int len) {
|
||||
// entries in the symbol table during normal execution (only during
|
||||
// safepoints).
|
||||
@@ -251,13 +282,33 @@ unsigned int SymbolTable::hash_symbol(const char* s, int len) {
|
||||
return len;
|
||||
}
|
||||
|
||||
-Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) {
|
||||
+Symbol* SymbolTable::lookup_common(const char* name, int len) {
|
||||
len = check_length(name, len);
|
||||
unsigned int hashValue = hash_symbol(name, len);
|
||||
int index = the_table()->hash_to_index(hashValue);
|
||||
+ Symbol* s;
|
||||
|
||||
1316
Huawei-Add-Aggressive-CDS.patch
Normal file
1316
Huawei-Add-Aggressive-CDS.patch
Normal file
File diff suppressed because it is too large
Load Diff
97
Huawei-Keep-objects-when-remove-unshareable-info.patch
Normal file
97
Huawei-Keep-objects-when-remove-unshareable-info.patch
Normal file
@ -0,0 +1,97 @@
|
||||
From 844511f2b4b6a4be079fc5ac2f2d5b56826df85a Mon Sep 17 00:00:00 2001
|
||||
Date: Tue, 4 Jun 2024 19:09:40 +0800
|
||||
Subject: [PATCH] [Huawei]Keep objects when remove unshareable info
|
||||
---
|
||||
hotspot/src/share/vm/oops/instanceKlass.cpp | 18 +++---------------
|
||||
.../Thread/TestThreadDumpClassInitMonitor.java | 15 +++++++++++----
|
||||
2 files changed, 14 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
index 833cf9afe..df9aaabfb 100644
|
||||
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
|
||||
@@ -2467,21 +2467,6 @@ void InstanceKlass::remove_unshareable_info() {
|
||||
m->remove_unshareable_info();
|
||||
}
|
||||
|
||||
- if (UseAppCDS || DynamicDumpSharedSpaces) {
|
||||
- if (_oop_map_cache != NULL) {
|
||||
- delete _oop_map_cache;
|
||||
- _oop_map_cache = NULL;
|
||||
- }
|
||||
-
|
||||
- JNIid::deallocate(jni_ids());
|
||||
- set_jni_ids(NULL);
|
||||
-
|
||||
- jmethodID* jmeths = methods_jmethod_ids_acquire();
|
||||
- if (jmeths != (jmethodID*)NULL) {
|
||||
- release_set_methods_jmethod_ids(NULL);
|
||||
- FreeHeap(jmeths);
|
||||
- }
|
||||
- }
|
||||
// do array classes also.
|
||||
array_klasses_do(remove_unshareable_in_class);
|
||||
// These are not allocated from metaspace. They are safe to set to NULL.
|
||||
@@ -2489,6 +2474,9 @@ void InstanceKlass::remove_unshareable_info() {
|
||||
_member_names = NULL;
|
||||
_osr_nmethods_head = NULL;
|
||||
_init_thread = NULL;
|
||||
+ _oop_map_cache = NULL;
|
||||
+ _jni_ids = NULL;
|
||||
+ _methods_jmethod_ids = NULL;
|
||||
}
|
||||
|
||||
void InstanceKlass::remove_java_mirror() {
|
||||
diff --git a/hotspot/test/runtime/Thread/TestThreadDumpClassInitMonitor.java b/hotspot/test/runtime/Thread/TestThreadDumpClassInitMonitor.java
|
||||
index 8aa218efb..a2111c362 100644
|
||||
--- a/hotspot/test/runtime/Thread/TestThreadDumpClassInitMonitor.java
|
||||
+++ b/hotspot/test/runtime/Thread/TestThreadDumpClassInitMonitor.java
|
||||
@@ -148,34 +148,41 @@ public class TestThreadDumpClassInitMonitor {
|
||||
throw new Error("Unexpected thread state line: " + line);
|
||||
}
|
||||
if (isProduct) {
|
||||
- foundLines += 3;
|
||||
+ foundLines += 4;
|
||||
} else {
|
||||
foundLines++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 2: { // Debug build
|
||||
+ if (!line.trim().equals(JAVATHREAD_STATE)) {
|
||||
+ throw new Error("Unexpected JavaThread state line: " + line);
|
||||
+ }
|
||||
+ foundLines++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ case 3: { // Debug build
|
||||
if (!line.startsWith(THREAD_INFO)) {
|
||||
throw new Error("Unexpected thread info line: " + line);
|
||||
}
|
||||
foundLines++;
|
||||
continue;
|
||||
}
|
||||
- case 3: { // Debug build
|
||||
+ case 4: { // Debug build
|
||||
if (!line.trim().equals(JAVATHREAD_STATE)) {
|
||||
throw new Error("Unexpected JavaThread state line: " + line);
|
||||
}
|
||||
foundLines++;
|
||||
continue;
|
||||
}
|
||||
- case 4: {
|
||||
+ case 5: {
|
||||
if (!line.trim().startsWith(CURRENT_METHOD)) {
|
||||
throw new Error("Unexpected current method line: " + line);
|
||||
}
|
||||
foundLines++;
|
||||
continue;
|
||||
}
|
||||
- case 5: {
|
||||
+ case 6: {
|
||||
if (!line.trim().equals(WAIT_INFO)) {
|
||||
throw new Error("Unexpected monitor information line: " + line);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
62
Huawei-improve-GCTR-performance.patch
Normal file
62
Huawei-improve-GCTR-performance.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From ac1502ff943911bd4d7332bd6531ed0a2454cf05 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 27 May 2024 12:06:03 +0800
|
||||
Subject: [PATCH 2/2] improve GCTR performance
|
||||
---
|
||||
.../classes/com/sun/crypto/provider/GCTR.java | 21 +++++++++++++++++--
|
||||
1 file changed, 19 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java b/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java
|
||||
index 1ab0f63db..12af359b0 100644
|
||||
--- a/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java
|
||||
+++ b/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java
|
||||
@@ -29,6 +29,10 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
+import com.sun.management.HotSpotDiagnosticMXBean;
|
||||
+import com.sun.management.VMOption;
|
||||
+import sun.management.ManagementFactoryHelper;
|
||||
+
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
@@ -54,13 +58,26 @@ import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE;
|
||||
*/
|
||||
final class GCTR extends CounterMode {
|
||||
|
||||
+ private static final String AES_CTR_INTRINSICS_PARAM = "UseAESCTRIntrinsics";
|
||||
+ private static boolean aesctrIntrinsicEnabled = false;
|
||||
+
|
||||
+ static {
|
||||
+ HotSpotDiagnosticMXBean diagnostic
|
||||
+ = ManagementFactoryHelper.getDiagnosticMXBean();
|
||||
+ VMOption vmOption;
|
||||
+ try {
|
||||
+ vmOption = diagnostic.getVMOption(AES_CTR_INTRINSICS_PARAM);
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ vmOption = null;
|
||||
+ }
|
||||
+ aesctrIntrinsicEnabled = Boolean.valueOf(vmOption == null ? null : vmOption.getValue());
|
||||
+ }
|
||||
GCTR(SymmetricCipher cipher, byte[] initialCounterBlk) {
|
||||
super(cipher);
|
||||
if (initialCounterBlk.length != AES_BLOCK_SIZE) {
|
||||
throw new RuntimeException("length of initial counter block (" + initialCounterBlk.length +
|
||||
") not equal to AES_BLOCK_SIZE (" + AES_BLOCK_SIZE + ")");
|
||||
}
|
||||
-
|
||||
iv = initialCounterBlk;
|
||||
reset();
|
||||
}
|
||||
@@ -93,7 +110,7 @@ final class GCTR extends CounterMode {
|
||||
|
||||
long blocksLeft = blocksUntilRollover();
|
||||
int numOfCompleteBlocks = inLen / AES_BLOCK_SIZE;
|
||||
- if (numOfCompleteBlocks >= blocksLeft) {
|
||||
+ if (!aesctrIntrinsicEnabled || numOfCompleteBlocks >= blocksLeft) {
|
||||
// Counter Mode encryption cannot be used because counter will
|
||||
// roll over incorrectly. Use GCM-specific code instead.
|
||||
byte[] encryptedCntr = new byte[AES_BLOCK_SIZE];
|
||||
--
|
||||
2.19.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,82 @@
|
||||
From c4fd69c76c41b7b6168f1071d50143566f7d269e Mon Sep 17 00:00:00 2001
|
||||
From c4fd69c76c41b7b6168f1071d50143566f7d269e
|
||||
Date: Fri, 22 Sep 2023 14:48:33 +0800
|
||||
Subject: [PATCH] add Fix-aarch64-runtime-thread-signal-transfer-bug
|
||||
|
||||
---
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.hpp | 7 ++
|
||||
hotspot/src/os/linux/vm/os_linux.cpp | 3 +
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.cpp | 69 +++++++++++++++++++
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.hpp | 2 +
|
||||
4 files changed, 82 insertions(+), 5 deletions(-)
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.cpp | 47 +++++----
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.hpp | 8 ++
|
||||
hotspot/src/os/linux/vm/os_linux.cpp | 7 ++
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.cpp | 97 +++++++++++++++++++
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.hpp | 3 +
|
||||
5 files changed, 141 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
index 27ab00dd..839df4a3 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
@@ -169,27 +169,7 @@ void VM_Version::get_processor_features() {
|
||||
_features_str = strdup(buf);
|
||||
_cpuFeatures = auxv;
|
||||
|
||||
- int cpu_lines = 0;
|
||||
- if (FILE *f = fopen("/proc/cpuinfo", "r")) {
|
||||
- char buf[128], *p;
|
||||
- while (fgets(buf, sizeof (buf), f) != NULL) {
|
||||
- if ((p = strchr(buf, ':')) != NULL) {
|
||||
- long v = strtol(p+1, NULL, 0);
|
||||
- if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
|
||||
- _cpu = v;
|
||||
- cpu_lines++;
|
||||
- } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
|
||||
- _variant = v;
|
||||
- } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) {
|
||||
- if (_model != v) _model2 = _model;
|
||||
- _model = v;
|
||||
- } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) {
|
||||
- _revision = v;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- fclose(f);
|
||||
- }
|
||||
+ int cpu_lines = get_cpu_model();
|
||||
|
||||
// Enable vendor specific features
|
||||
if (_cpu == CPU_CAVIUM) {
|
||||
@@ -346,6 +326,31 @@ void VM_Version::get_processor_features() {
|
||||
#endif
|
||||
}
|
||||
|
||||
+int VM_Version::get_cpu_model() {
|
||||
+ int cpu_lines = 0;
|
||||
+ if (FILE *f = fopen("/proc/cpuinfo", "r")) {
|
||||
+ char buf[128], *p;
|
||||
+ while (fgets(buf, sizeof (buf), f) != NULL) {
|
||||
+ if ((p = strchr(buf, ':')) != NULL) {
|
||||
+ long v = strtol(p+1, NULL, 0);
|
||||
+ if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
|
||||
+ _cpu = v;
|
||||
+ cpu_lines++;
|
||||
+ } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
|
||||
+ _variant = v;
|
||||
+ } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) {
|
||||
+ if (_model != v) _model2 = _model;
|
||||
+ _model = v;
|
||||
+ } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) {
|
||||
+ _revision = v;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+ return cpu_lines;
|
||||
+}
|
||||
+
|
||||
void VM_Version::initialize() {
|
||||
ResourceMark rm;
|
||||
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
index 7f3a53262..9dfc3465e 100644
|
||||
index 7f3a5326..47353df9 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
@ -21,7 +87,14 @@ index 7f3a53262..9dfc3465e 100644
|
||||
CPU_INFINEON = 'I',
|
||||
CPU_MOTOROLA = 'M',
|
||||
CPU_NVIDIA = 'N',
|
||||
@@ -93,6 +94,12 @@ public:
|
||||
@@ -87,12 +88,19 @@ public:
|
||||
CPU_DMB_ATOMICS = (1 << 31),
|
||||
} cpuFeatureFlags;
|
||||
|
||||
+ static int get_cpu_model();
|
||||
static const char* cpu_features() { return _features_str; }
|
||||
static int cpu_family() { return _cpu; }
|
||||
static int cpu_model() { return _model; }
|
||||
static int cpu_variant() { return _variant; }
|
||||
static int cpu_revision() { return _revision; }
|
||||
static int cpu_cpuFeatures() { return _cpuFeatures; }
|
||||
@ -35,10 +108,21 @@ index 7f3a53262..9dfc3465e 100644
|
||||
static ByteSize ctr_el0_offset() { return byte_offset_of(PsrInfo, ctr_el0); }
|
||||
static bool is_zva_enabled() {
|
||||
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
index 197b5c193..3ed8cde6b 100644
|
||||
index 2dde2587..647ef582 100644
|
||||
--- a/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
@@ -5754,6 +5754,9 @@ void os::set_native_thread_name(const char *name) {
|
||||
@@ -5576,6 +5576,10 @@ jint os::init_2(void)
|
||||
Linux::is_floating_stack() ? "floating stack" : "fixed stack");
|
||||
}
|
||||
|
||||
+#ifdef AARCH64
|
||||
+ JavaThread::os_linux_aarch64_options(active_processor_count(), argv_for_execvp);
|
||||
+#endif
|
||||
+
|
||||
if (UseNUMA) {
|
||||
if (!Linux::libnuma_init()) {
|
||||
UseNUMA = false;
|
||||
@@ -5760,6 +5764,9 @@ void os::set_native_thread_name(const char *name) {
|
||||
const int rc = Linux::_pthread_setname_np(pthread_self(), buf);
|
||||
// ERANGE should not happen; all other errors should just be ignored.
|
||||
assert(rc != ERANGE, "pthread_setname_np failed");
|
||||
@ -49,7 +133,7 @@ index 197b5c193..3ed8cde6b 100644
|
||||
}
|
||||
|
||||
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
index 87e42318a..bc4b03561 100644
|
||||
index 87e42318..8b0e2c98 100644
|
||||
--- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
@ -60,7 +144,7 @@ index 87e42318a..bc4b03561 100644
|
||||
|
||||
// For Forte Analyzer AsyncGetCallTrace profiling support - thread is
|
||||
// currently interrupted by SIGPROF
|
||||
@@ -39,6 +40,74 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext,
|
||||
@@ -39,6 +40,102 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext,
|
||||
return pd_get_top_frame(fr_addr, ucontext, isInJava);
|
||||
}
|
||||
|
||||
@ -131,23 +215,52 @@ index 87e42318a..bc4b03561 100644
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void JavaThread::os_linux_aarch64_options(int apc, char **name) {
|
||||
+ if (name == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ VM_Version::get_cpu_model();
|
||||
+ if (VM_Version::is_hisi_enabled()) {
|
||||
+ int i = 0;
|
||||
+ int step = 0;
|
||||
+ while (name[i] != NULL) {
|
||||
+ if (stringHash(name[i]) == 1396789436) {
|
||||
+ if (FLAG_IS_DEFAULT(ActiveProcessorCount) && (UseG1GC || UseParallelGC) && apc > 8)
|
||||
+ FLAG_SET_DEFAULT(ActiveProcessorCount, 8);
|
||||
+ break;
|
||||
+ } else if (stringHash(name[i]) == 1594786418) {
|
||||
+ step = 1;
|
||||
+ } else if (step == 1 && stringHash(name[i]) == 237006690) {
|
||||
+ if (name[i+1] != NULL) {
|
||||
+ int cores = atoi(name[i+1]);
|
||||
+ if (FLAG_IS_DEFAULT(ActiveProcessorCount) && cores > 0)
|
||||
+ FLAG_SET_DEFAULT(ActiveProcessorCount, cores);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) {
|
||||
assert(this->is_Java_thread(), "must be JavaThread");
|
||||
JavaThread* jt = (JavaThread *)this;
|
||||
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
index a2f0135c2..251e523df 100644
|
||||
index a2f0135c..f14ace0d 100644
|
||||
--- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
@@ -66,6 +66,8 @@
|
||||
@@ -66,6 +66,9 @@
|
||||
bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext,
|
||||
bool isInJava);
|
||||
|
||||
+ void os_linux_aarch64_options(const char *name);
|
||||
+ static void os_linux_aarch64_options(int apc, char **name);
|
||||
+
|
||||
bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava);
|
||||
private:
|
||||
bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava);
|
||||
--
|
||||
2.22.0
|
||||
2.19.1
|
||||
|
||||
|
||||
@ -48,8 +48,8 @@ index f3581c163..a405eb336 100644
|
||||
# improving the quality of crash log stack traces involving jvm.dll.
|
||||
|
||||
# These are always used in all compiles
|
||||
-CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX
|
||||
+CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /GS
|
||||
-CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /wd4800
|
||||
+CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /wd4800 /GS
|
||||
|
||||
# Let's add debug information when Full Debug Symbols is enabled
|
||||
!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
|
||||
|
||||
@ -149,7 +149,7 @@ index a405eb336..e5aed4418 100644
|
||||
@@ -54,6 +54,9 @@ CXX=cl.exe
|
||||
|
||||
# These are always used in all compiles
|
||||
CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /GS
|
||||
CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /WX /wd4800 /GS
|
||||
+!if "$(MSC_VER)" > "1910"
|
||||
+CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 /GS /arch:IA32
|
||||
+!endif
|
||||
|
||||
@ -40,13 +40,13 @@ index 54e1bfa0d..c1423dc5b 100644
|
||||
|
||||
// The numbers of certs now.
|
||||
- private static final int COUNT = 83;
|
||||
+ private static final int COUNT = 102;
|
||||
+ private static final int COUNT = 104;
|
||||
|
||||
// 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
|
||||
- = "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";
|
||||
+ = "2F:92:41:50:3B:2B:F2:AD:86:54:AB:2B:D4:AB:A2:92:8B:B6:1C:2B:58:A1:E3:1A:CE:43:43:FB:3E:94:2E:7E";
|
||||
+ = "1C:10:89:F9:32:8C:05:D1:10:90:27:7F:66:21:28:71:79:8F:55:44:6C:08:BA:00:48:C0:D4:7A:0D:3B:9C:45";
|
||||
|
||||
// map of cert alias to SHA-256 fingerprint
|
||||
@SuppressWarnings("serial")
|
||||
|
||||
Binary file not shown.
@ -132,6 +132,12 @@
|
||||
%global stapinstall powerpc64le
|
||||
%endif
|
||||
|
||||
# Need to support noarch for srpm build
|
||||
%ifarch noarch
|
||||
%global archinstall %{nil}
|
||||
%global stapinstall %{nil}
|
||||
%endif
|
||||
|
||||
%ifarch %{jit_arches}
|
||||
%global with_systemtap 1
|
||||
%else
|
||||
@ -166,13 +172,13 @@
|
||||
%global origin_nice OpenJDK
|
||||
%global top_level_dir_name %{origin}
|
||||
%global repo jdk8u
|
||||
%global revision jdk8u412-b08
|
||||
%global revision jdk8u422-b05
|
||||
%global full_revision %{repo}-%{revision}
|
||||
# Define IcedTea version used for SystemTap tapsets and desktop files
|
||||
%global icedteaver 3.15.0
|
||||
|
||||
%global updatever 412
|
||||
%global buildver b08
|
||||
%global updatever 422
|
||||
%global buildver b05
|
||||
# priority must be 7 digits in total. The expression is workarounding tip
|
||||
%global priority 1800%{updatever}
|
||||
|
||||
@ -613,6 +619,7 @@ exit 0
|
||||
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libunpack.so
|
||||
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libverify.so
|
||||
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libzip.so
|
||||
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libz.so
|
||||
%{_jvmdir}/%{jredir -- %{?1}}/lib/charsets.jar
|
||||
%{_jvmdir}/%{jredir -- %{?1}}/lib/classlist
|
||||
%{_jvmdir}/%{jredir -- %{?1}}/lib/content-types.properties
|
||||
@ -936,7 +943,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
|
||||
|
||||
Name: java-%{javaver}-%{origin}
|
||||
Version: %{javaver}.%{updatever}.%{buildver}
|
||||
Release: 5
|
||||
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
|
||||
@ -1322,6 +1329,17 @@ Patch428: 8223486-split-if-update_uses-accesses-stale-idom-dat.patch
|
||||
Patch429: 8256488-Use-ldpq-stpq-instead-of-ld4-st4-for-small-c.patch
|
||||
Patch430: DependencyContext-mark_dependent_nmethods-crash-in-Dynamic-cds-mode.patch
|
||||
Patch431: 8138922-StubCodeDesc-constructor-publishes-partially-constructed.patch
|
||||
Patch432: support-KAE-zip.patch
|
||||
Patch433: Backport-6956385-URLConnection.getLastModified-leaks-file-han.patch
|
||||
Patch434: Backport-8068864-C2-failed-modified-node-is-not-on-IGVN._work.patch
|
||||
Patch435: Huawei-improve-GCTR-performance.patch
|
||||
Patch436: Backport-8209362-sun-security-ssl-SSLSocketImpl-ReuseAddr.jav.patch
|
||||
Patch437: Backport-7036144-GZIPInputStream-readTrailer-uses-faulty-avai.patch
|
||||
Patch438: Huawei-Add-Aggressive-CDS.patch
|
||||
Patch439: Backport-8151845-Comment-in-globals.hpp-for-MetaspaceSize-is-.patch
|
||||
Patch440: Backport-8210706-G1-may-deadlock-when-starting-a-concurrent-c.patch
|
||||
Patch441: Backport-8318889-Backport-Important-Fixed-Issues-in-Later-Ver.patch
|
||||
Patch442: Huawei-Keep-objects-when-remove-unshareable-info.patch
|
||||
#############################################
|
||||
#
|
||||
# Upstreamable patches
|
||||
@ -1966,6 +1984,17 @@ pushd %{top_level_dir_name}
|
||||
%patch429 -p1
|
||||
%patch430 -p1
|
||||
%patch431 -p1
|
||||
%patch432 -p1
|
||||
%patch433 -p1
|
||||
%patch434 -p1
|
||||
%patch435 -p1
|
||||
%patch436 -p1
|
||||
%patch437 -p1
|
||||
%patch438 -p1
|
||||
%patch439 -p1
|
||||
%patch440 -p1
|
||||
%patch441 -p1
|
||||
%patch442 -p1
|
||||
%endif
|
||||
|
||||
%ifarch loongarch64
|
||||
@ -2624,6 +2653,39 @@ cjc.mainProgram(arg)
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Tue 16 2024 Autistic_boyya <wangzhongyi7@huawei.com> -1:1.8.0.422-b05.rolling
|
||||
- modified 8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch
|
||||
- modified 8136577_Make_AbortVMOnException_available_in_product_builds.patch
|
||||
- modified Dynamic-CDS-Archive.patch
|
||||
- modified add-safe-compilation-flags.patch
|
||||
- modified fix-log-bug-enhance-aes-hmac-performance.patch
|
||||
- modified fix_X509TrustManagerImpl_symantec_distrust.patch
|
||||
- modified openjdk-1.8.0.spec
|
||||
- modified update-cacerts-and-VerifyCACerts.java-test.patch
|
||||
- Add Backport-6956385-URLConnection.getLastModified-leaks-file-han.patch
|
||||
- Add Backport-7036144-GZIPInputStream-readTrailer-uses-faulty-avai.patch
|
||||
- Add Backport-8068864-C2-failed-modified-node-is-not-on-IGVN._work.patch
|
||||
- Add Backport-8151845-Comment-in-globals.hpp-for-MetaspaceSize-is-.patch
|
||||
- Add Backport-8209362-sun-security-ssl-SSLSocketImpl-ReuseAddr.jav.patch
|
||||
- Add Backport-8210706-G1-may-deadlock-when-starting-a-concurrent-c.patch
|
||||
- Add Backport-8318889-Backport-Important-Fixed-Issues-in-Later-Ver.patch
|
||||
- Add Huawei-Add-Aggressive-CDS.patch
|
||||
- Add Huawei-Keep-objects-when-remove-unshareable-info.patch
|
||||
- Add Huawei-improve-GCTR-performance.patch
|
||||
|
||||
* Thu Jul 4 2024 Autistic_boyya <wangzhongyi7@huawei.com> -1:1.8.0.412-b08.9
|
||||
- Add support-KAE-zip.patch
|
||||
|
||||
* Fri Jun 21 2024 songliyang <songliyang@kylinos.cn> -1:1.8.0.412-b08.8
|
||||
- Add noarch support for srpm build
|
||||
- null the arg to solve openjdk-headless install error
|
||||
|
||||
* Thu Jun 20 2024 aoqi <aoqi@loongson.cn> -1:1.8.0.412-b08.7
|
||||
- update LoongArch64 port to 8u412
|
||||
|
||||
* Wed Jun 19 2024 neu-mobi <liuyulong35@huawei.com> -1:1.8.0.412-b08.6
|
||||
- Fix aarch64 runtime thread signal transfer bug
|
||||
|
||||
* Thu May 23 2024 Dingli Zhang <dingli@iscas.ac.cn> -1:1.8.0.412-b08.5
|
||||
- Fix build on riscv64 in prep stage
|
||||
|
||||
|
||||
717
support-KAE-zip.patch
Normal file
717
support-KAE-zip.patch
Normal file
@ -0,0 +1,717 @@
|
||||
Subject: [PATCH] [Huawei]support KAE-zip
|
||||
|
||||
---
|
||||
jdk/make/CompileLaunchers.gmk | 34 ++++---
|
||||
jdk/make/lib/CoreLibraries.gmk | 71 ++++++++++++++
|
||||
jdk/make/mapfiles/libzip/mapfile-vers | 3 +
|
||||
.../share/classes/java/util/zip/Deflater.java | 10 +-
|
||||
.../java/util/zip/GZIPInputStream.java | 14 +++
|
||||
.../java/util/zip/GZIPOutputStream.java | 20 ++++
|
||||
.../share/classes/java/util/zip/Inflater.java | 14 ++-
|
||||
.../java/util/zip/InflaterOutputStream.java | 24 ++---
|
||||
jdk/src/share/lib/security/java.policy | 2 +
|
||||
jdk/src/share/native/java/util/zip/Deflater.c | 37 +++++++
|
||||
jdk/src/share/native/java/util/zip/Inflater.c | 98 +++++++++++++++++++
|
||||
.../java/util/zip/DeflateIn_InflateOut.java | 74 +++++++++++++-
|
||||
12 files changed, 367 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/jdk/make/CompileLaunchers.gmk b/jdk/make/CompileLaunchers.gmk
|
||||
index de1ea9f4b..513e2ee1b 100644
|
||||
--- a/jdk/make/CompileLaunchers.gmk
|
||||
+++ b/jdk/make/CompileLaunchers.gmk
|
||||
@@ -474,17 +474,29 @@ ifeq ($(USE_EXTERNAL_LIBZ), true)
|
||||
UNPACKEXE_ZIPOBJS := -lz
|
||||
else
|
||||
UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
|
||||
- UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
|
||||
- $(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
|
||||
-
|
||||
+ ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
+ UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
|
||||
+ else
|
||||
+ UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libz/zcrc32$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/deflate$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/trees$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/zadler32$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/compress$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/zutil$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/inflate$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/infback$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/inftrees$(OBJ_SUFFIX) \
|
||||
+ $(JDK_OUTPUTDIR)/objs/libz/inffast$(OBJ_SUFFIX)
|
||||
+ endif
|
||||
endif
|
||||
|
||||
UNPACKEXE_LANG := C
|
||||
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
|
||||
index d1cd1d3de..1af991693 100644
|
||||
--- a/jdk/make/lib/CoreLibraries.gmk
|
||||
+++ b/jdk/make/lib/CoreLibraries.gmk
|
||||
@@ -261,11 +261,76 @@ $(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
|
||||
|
||||
##########################################################################################
|
||||
|
||||
+ifneq ($(USE_EXTERNAL_LIBZ), true)
|
||||
+ ifneq ($(OPENJDK_TARGET_OS), windows)
|
||||
+ BUILD_LIBZ_EXCLUDES :=
|
||||
+
|
||||
+ ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
|
||||
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
+ ZLIB_CPPFLAGS += -DHAVE_UNISTD_H
|
||||
+ endif
|
||||
+
|
||||
+ BUILD_LIBZ_REORDER :=
|
||||
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
+ ifneq ($(OPENJDK_TARGET_CPU), x86_64)
|
||||
+ BUILD_LIBZ_REORDER := $(JDK_TOPDIR)/make/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
|
||||
+ endif
|
||||
+ endif
|
||||
+
|
||||
+ ifeq ($(LIBZ_CAN_USE_MMAP), true)
|
||||
+ BUILD_LIBZ_MMAP := -DUSE_MMAP
|
||||
+ endif
|
||||
+
|
||||
+ $(eval $(call SetupNativeCompilation,BUILD_LIBZ, \
|
||||
+ LIBRARY := z, \
|
||||
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
+ LANG := C, \
|
||||
+ OPTIMIZATION := LOW, \
|
||||
+ SRC := $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib, \
|
||||
+ EXCLUDES := $(LIBZ_EXCLUDES), \
|
||||
+ CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
+ $(ZLIB_CPPFLAGS) \
|
||||
+ -I$(JDK_TOPDIR)/src/share/native/java/io \
|
||||
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io, \
|
||||
+ CFLAGS_posix := $(BUILD_LIBZ_MMAP) -UDEBUG, \
|
||||
+ MAPFILE := , \
|
||||
+ REORDER := $(BUILD_LIBZ_REORDER), \
|
||||
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
|
||||
+ $(EXPORT_Z_FUNCS), \
|
||||
+ LDFLAGS_windows := jvm.lib \
|
||||
+ $(WIN_JAVA_LIB), \
|
||||
+ LDFLAGS_SUFFIX_linux := , \
|
||||
+ LDFLAGS_SUFFIX_solaris := , \
|
||||
+ LDFLAGS_SUFFIX_aix := ,\
|
||||
+ LDFLAGS_SUFFIX_macosx := , \
|
||||
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
|
||||
+ RC_FLAGS := $(RC_FLAGS) \
|
||||
+ -D "JDK_FNAME=z.dll" \
|
||||
+ -D "JDK_INTERNAL_NAME=z" \
|
||||
+ -D "JDK_FTYPE=0x2L", \
|
||||
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libz, \
|
||||
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
|
||||
+
|
||||
+
|
||||
+ $(BUILD_LIBZ): $(BUILD_LIBJAVA)
|
||||
+
|
||||
+ BUILD_LIBRARIES += $(BUILD_LIBZ)
|
||||
+ endif
|
||||
+endif
|
||||
+
|
||||
+##########################################################################################
|
||||
+
|
||||
BUILD_LIBZIP_EXCLUDES :=
|
||||
ifeq ($(USE_EXTERNAL_LIBZ), true)
|
||||
+ BUILD_LIBZIP_SRC :=
|
||||
LIBZ := -lz
|
||||
LIBZIP_EXCLUDES += zlib
|
||||
else
|
||||
+ ifneq ($(OPENJDK_TARGET_OS), windows)
|
||||
+ BUILD_LIBZIP_SRC := Adler32.c CRC32.c Deflater.c Inflater.c zip_util.c ZipFile.c
|
||||
+ LIBZ := -lz
|
||||
+ endif
|
||||
ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
ZLIB_CPPFLAGS += -DHAVE_UNISTD_H
|
||||
@@ -289,6 +354,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := LOW, \
|
||||
SRC := $(JDK_TOPDIR)/src/share/native/java/util/zip, \
|
||||
+ INCLUDE_FILES := $(BUILD_LIBZIP_SRC), \
|
||||
EXCLUDES := $(LIBZIP_EXCLUDES), \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
$(ZLIB_CPPFLAGS) \
|
||||
@@ -315,9 +381,14 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
|
||||
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libzip, \
|
||||
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
|
||||
|
||||
+ifneq ($(USE_EXTERNAL_LIBZ), true)
|
||||
+ LIBZ :=
|
||||
+endif
|
||||
|
||||
$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
|
||||
|
||||
+$(BUILD_LIBZIP): $(BUILD_LIBZ)
|
||||
+
|
||||
BUILD_LIBRARIES += $(BUILD_LIBZIP)
|
||||
|
||||
##########################################################################################
|
||||
diff --git a/jdk/make/mapfiles/libzip/mapfile-vers b/jdk/make/mapfiles/libzip/mapfile-vers
|
||||
index 5d33990c3..5c6d27d0d 100644
|
||||
--- a/jdk/make/mapfiles/libzip/mapfile-vers
|
||||
+++ b/jdk/make/mapfiles/libzip/mapfile-vers
|
||||
@@ -38,13 +38,16 @@ SUNWprivate_1.1 {
|
||||
Java_java_util_zip_Deflater_end;
|
||||
Java_java_util_zip_Deflater_getAdler;
|
||||
Java_java_util_zip_Deflater_init;
|
||||
+ Java_java_util_zip_Deflater_initKae;
|
||||
Java_java_util_zip_Deflater_initIDs;
|
||||
Java_java_util_zip_Deflater_reset;
|
||||
Java_java_util_zip_Deflater_setDictionary;
|
||||
Java_java_util_zip_Inflater_end;
|
||||
Java_java_util_zip_Inflater_getAdler;
|
||||
Java_java_util_zip_Inflater_inflateBytes;
|
||||
+ Java_java_util_zip_Inflater_inflateBytesKAE;
|
||||
Java_java_util_zip_Inflater_init;
|
||||
+ Java_java_util_zip_Inflater_initKae;
|
||||
Java_java_util_zip_Inflater_initIDs;
|
||||
Java_java_util_zip_Inflater_reset;
|
||||
Java_java_util_zip_Inflater_setDictionary;
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/Deflater.java b/jdk/src/share/classes/java/util/zip/Deflater.java
|
||||
index bffa397d9..a4ea40cf8 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/Deflater.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/Deflater.java
|
||||
@@ -81,6 +81,7 @@ class Deflater {
|
||||
private boolean finish, finished;
|
||||
private long bytesRead;
|
||||
private long bytesWritten;
|
||||
+ private boolean defalterUseKae;
|
||||
|
||||
/**
|
||||
* Compression method for the deflate algorithm (the only one currently
|
||||
@@ -168,7 +169,13 @@ class Deflater {
|
||||
public Deflater(int level, boolean nowrap) {
|
||||
this.level = level;
|
||||
this.strategy = DEFAULT_STRATEGY;
|
||||
- this.zsRef = new ZStreamRef(init(level, DEFAULT_STRATEGY, nowrap));
|
||||
+ if (("true".equals(System.getProperty("GZIP_USE_KAE", "false"))) &&
|
||||
+ ("aarch64".equals(System.getProperty("os.arch")))) {
|
||||
+ this.defalterUseKae = true;
|
||||
+ }
|
||||
+ this.zsRef = defalterUseKae ?
|
||||
+ new ZStreamRef(initKae(level, DEFAULT_STRATEGY)) :
|
||||
+ new ZStreamRef(init(level, DEFAULT_STRATEGY, nowrap));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -571,6 +578,7 @@ class Deflater {
|
||||
|
||||
private static native void initIDs();
|
||||
private native static long init(int level, int strategy, boolean nowrap);
|
||||
+ private native static long initKae(int level, int strategy);
|
||||
private native static void setDictionary(long addr, byte[] b, int off, int len);
|
||||
private native int deflateBytes(long addr, byte[] b, int off, int len,
|
||||
int flush);
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
index 0d57e8ab3..7fb753729 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/GZIPInputStream.java
|
||||
@@ -54,6 +54,11 @@ class GZIPInputStream extends InflaterInputStream {
|
||||
|
||||
private boolean closed = false;
|
||||
|
||||
+ /*
|
||||
+ * GZIP use KAE.
|
||||
+ */
|
||||
+ private boolean gzipUseKae = false;
|
||||
+
|
||||
/**
|
||||
* Check to make sure that this stream has not been closed
|
||||
*/
|
||||
@@ -76,6 +81,12 @@ class GZIPInputStream extends InflaterInputStream {
|
||||
public GZIPInputStream(InputStream in, int size) throws IOException {
|
||||
super(in, new Inflater(true), size);
|
||||
usesDefaultInflater = true;
|
||||
+ if (("true".equals(System.getProperty("GZIP_USE_KAE", "false"))) &&
|
||||
+ ("aarch64".equals(System.getProperty("os.arch")))) {
|
||||
+ gzipUseKae = true;
|
||||
+ }
|
||||
+ // file header will be readed by kae zlib when use kae
|
||||
+ if (gzipUseKae) return;
|
||||
readHeader(in);
|
||||
}
|
||||
|
||||
@@ -209,6 +220,9 @@ class GZIPInputStream extends InflaterInputStream {
|
||||
* data set)
|
||||
*/
|
||||
private boolean readTrailer() throws IOException {
|
||||
+ // file trailer will be readed by kae zlib when use kae
|
||||
+ if (gzipUseKae) return true;
|
||||
+
|
||||
InputStream in = this.in;
|
||||
int n = inf.getRemaining();
|
||||
if (n > 0) {
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java b/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
|
||||
index 1c3f8592e..0f0be98bb 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/GZIPOutputStream.java
|
||||
@@ -52,6 +52,11 @@ class GZIPOutputStream extends DeflaterOutputStream {
|
||||
*/
|
||||
private final static int TRAILER_SIZE = 8;
|
||||
|
||||
+ /*
|
||||
+ * GZIP use KAE.
|
||||
+ */
|
||||
+ private boolean gzipUseKae = false;
|
||||
+
|
||||
/**
|
||||
* Creates a new output stream with the specified buffer size.
|
||||
*
|
||||
@@ -91,6 +96,12 @@ class GZIPOutputStream extends DeflaterOutputStream {
|
||||
size,
|
||||
syncFlush);
|
||||
usesDefaultDeflater = true;
|
||||
+ if (("true".equals(System.getProperty("GZIP_USE_KAE", "false"))) &&
|
||||
+ ("aarch64".equals(System.getProperty("os.arch")))) {
|
||||
+ gzipUseKae = true;
|
||||
+ }
|
||||
+ // file header will be writed by kae zlib when use kae
|
||||
+ if (gzipUseKae) return;
|
||||
writeHeader();
|
||||
crc.reset();
|
||||
}
|
||||
@@ -160,6 +171,11 @@ class GZIPOutputStream extends DeflaterOutputStream {
|
||||
int len = def.deflate(buf, 0, buf.length);
|
||||
if (def.finished() && len <= buf.length - TRAILER_SIZE) {
|
||||
// last deflater buffer. Fit trailer at the end
|
||||
+ // file trailer will be writed by kae zlib when use kae
|
||||
+ if (gzipUseKae) {
|
||||
+ out.write(buf, 0, len);
|
||||
+ return;
|
||||
+ }
|
||||
writeTrailer(buf, len);
|
||||
len = len + TRAILER_SIZE;
|
||||
out.write(buf, 0, len);
|
||||
@@ -168,6 +184,10 @@ class GZIPOutputStream extends DeflaterOutputStream {
|
||||
if (len > 0)
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
+ // file trailer will be writed by kae zlib when use kae
|
||||
+ if (gzipUseKae) {
|
||||
+ return;
|
||||
+ }
|
||||
// if we can't fit the trailer at the end of the last
|
||||
// deflater buffer, we write it separately
|
||||
byte[] trailer = new byte[TRAILER_SIZE];
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/Inflater.java b/jdk/src/share/classes/java/util/zip/Inflater.java
|
||||
index c1eefe122..42e90f525 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/Inflater.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/Inflater.java
|
||||
@@ -80,6 +80,7 @@ class Inflater {
|
||||
private boolean needDict;
|
||||
private long bytesRead;
|
||||
private long bytesWritten;
|
||||
+ private boolean inflaterUseKae;
|
||||
|
||||
private static final byte[] defaultBuf = new byte[0];
|
||||
|
||||
@@ -100,7 +101,11 @@ class Inflater {
|
||||
* @param nowrap if true then support GZIP compatible compression
|
||||
*/
|
||||
public Inflater(boolean nowrap) {
|
||||
- zsRef = new ZStreamRef(init(nowrap));
|
||||
+ if (("true".equals(System.getProperty("GZIP_USE_KAE", "false"))) &&
|
||||
+ ("aarch64".equals(System.getProperty("os.arch")))) {
|
||||
+ inflaterUseKae = true;
|
||||
+ }
|
||||
+ zsRef = inflaterUseKae ? new ZStreamRef(initKae()): new ZStreamRef(init(nowrap));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,7 +261,9 @@ class Inflater {
|
||||
synchronized (zsRef) {
|
||||
ensureOpen();
|
||||
int thisLen = this.len;
|
||||
- int n = inflateBytes(zsRef.address(), b, off, len);
|
||||
+ int n = this.inflaterUseKae ?
|
||||
+ inflateBytesKAE(zsRef.address(), b, off, len) :
|
||||
+ inflateBytes(zsRef.address(), b, off, len);
|
||||
bytesWritten += n;
|
||||
bytesRead += (thisLen - this.len);
|
||||
return n;
|
||||
@@ -397,10 +404,13 @@ class Inflater {
|
||||
|
||||
private native static void initIDs();
|
||||
private native static long init(boolean nowrap);
|
||||
+ private native static long initKae();
|
||||
private native static void setDictionary(long addr, byte[] b, int off,
|
||||
int len);
|
||||
private native int inflateBytes(long addr, byte[] b, int off, int len)
|
||||
throws DataFormatException;
|
||||
+ private native int inflateBytesKAE(long addr, byte[] b, int off, int len)
|
||||
+ throws DataFormatException;
|
||||
private native static int getAdler(long addr);
|
||||
private native static void reset(long addr);
|
||||
private native static void end(long addr);
|
||||
diff --git a/jdk/src/share/classes/java/util/zip/InflaterOutputStream.java b/jdk/src/share/classes/java/util/zip/InflaterOutputStream.java
|
||||
index 02900c741..62c6bb153 100644
|
||||
--- a/jdk/src/share/classes/java/util/zip/InflaterOutputStream.java
|
||||
+++ b/jdk/src/share/classes/java/util/zip/InflaterOutputStream.java
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
+ * Copyright (c) 2006, 2020, 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
|
||||
@@ -236,16 +236,9 @@ public class InflaterOutputStream extends FilterOutputStream {
|
||||
|
||||
// Fill the decompressor buffer with output data
|
||||
if (inf.needsInput()) {
|
||||
- int part;
|
||||
-
|
||||
- if (len < 1) {
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- part = (len < 512 ? len : 512);
|
||||
- inf.setInput(b, off, part);
|
||||
- off += part;
|
||||
- len -= part;
|
||||
+ inf.setInput(b, off, len);
|
||||
+ // Only use input buffer once.
|
||||
+ len = 0;
|
||||
}
|
||||
|
||||
// Decompress and write blocks of output data
|
||||
@@ -256,13 +249,14 @@ public class InflaterOutputStream extends FilterOutputStream {
|
||||
}
|
||||
} while (n > 0);
|
||||
|
||||
- // Check the decompressor
|
||||
- if (inf.finished()) {
|
||||
- break;
|
||||
- }
|
||||
+ // Check for missing dictionary first
|
||||
if (inf.needsDictionary()) {
|
||||
throw new ZipException("ZLIB dictionary missing");
|
||||
}
|
||||
+ // Check the decompressor
|
||||
+ if (inf.finished() || (len == 0) /* no more input */ ) {
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
} catch (DataFormatException ex) {
|
||||
// Improperly formatted compressed (ZIP) data
|
||||
diff --git a/jdk/src/share/lib/security/java.policy b/jdk/src/share/lib/security/java.policy
|
||||
index 8b6289720..baec2ea15 100644
|
||||
--- a/jdk/src/share/lib/security/java.policy
|
||||
+++ b/jdk/src/share/lib/security/java.policy
|
||||
@@ -48,5 +48,7 @@ grant {
|
||||
permission java.util.PropertyPermission "java.vm.name", "read";
|
||||
|
||||
permission java.util.PropertyPermission "sun.security.pkcs11.disableKeyExtraction", "read";
|
||||
+
|
||||
+ permission java.util.PropertyPermission "GZIP_USE_KAE", "read";
|
||||
};
|
||||
|
||||
diff --git a/jdk/src/share/native/java/util/zip/Deflater.c b/jdk/src/share/native/java/util/zip/Deflater.c
|
||||
index c1bd34667..1b048e4f5 100644
|
||||
--- a/jdk/src/share/native/java/util/zip/Deflater.c
|
||||
+++ b/jdk/src/share/native/java/util/zip/Deflater.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "java_util_zip_Deflater.h"
|
||||
|
||||
#define DEF_MEM_LEVEL 8
|
||||
+#define KAE_DEFLATER_WindowBit 31
|
||||
|
||||
static jfieldID levelID;
|
||||
static jfieldID strategyID;
|
||||
@@ -104,6 +105,42 @@ Java_java_util_zip_Deflater_init(JNIEnv *env, jclass cls, jint level,
|
||||
}
|
||||
}
|
||||
|
||||
+JNIEXPORT jlong JNICALL
|
||||
+Java_java_util_zip_Deflater_initKae(JNIEnv *env, jclass cls, jint level,
|
||||
+ jint strategy)
|
||||
+{
|
||||
+ z_stream *strm = calloc(1, sizeof(z_stream));
|
||||
+
|
||||
+ if (strm == 0) {
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ } else {
|
||||
+ const char *msg;
|
||||
+ int ret = deflateInit2(strm, level, Z_DEFLATED, KAE_DEFLATER_WindowBit, DEF_MEM_LEVEL, strategy);
|
||||
+ switch (ret) {
|
||||
+ case Z_OK:
|
||||
+ return ptr_to_jlong(strm);
|
||||
+ case Z_MEM_ERROR:
|
||||
+ free(strm);
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ case Z_STREAM_ERROR:
|
||||
+ free(strm);
|
||||
+ JNU_ThrowIllegalArgumentException(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ default:
|
||||
+ msg = ((strm->msg != NULL) ? strm->msg :
|
||||
+ (ret == Z_VERSION_ERROR) ?
|
||||
+ "zlib returned Z_VERSION_ERROR: "
|
||||
+ "compile time and runtime zlib implementations differ" :
|
||||
+ "unknown error initializing zlib library");
|
||||
+ free(strm);
|
||||
+ JNU_ThrowInternalError(env, msg);
|
||||
+ return jlong_zero;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_util_zip_Deflater_setDictionary(JNIEnv *env, jclass cls, jlong addr,
|
||||
jarray b, jint off, jint len)
|
||||
diff --git a/jdk/src/share/native/java/util/zip/Inflater.c b/jdk/src/share/native/java/util/zip/Inflater.c
|
||||
index 79bcdd5b6..fca207215 100644
|
||||
--- a/jdk/src/share/native/java/util/zip/Inflater.c
|
||||
+++ b/jdk/src/share/native/java/util/zip/Inflater.c
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#define ThrowDataFormatException(env, msg) \
|
||||
JNU_ThrowByName(env, "java/util/zip/DataFormatException", msg)
|
||||
+#define KAE_INFLATER_WindowBit 31
|
||||
|
||||
static jfieldID needDictID;
|
||||
static jfieldID finishedID;
|
||||
@@ -94,6 +95,39 @@ Java_java_util_zip_Inflater_init(JNIEnv *env, jclass cls, jboolean nowrap)
|
||||
}
|
||||
}
|
||||
|
||||
+JNIEXPORT jlong JNICALL
|
||||
+Java_java_util_zip_Inflater_initKae(JNIEnv *env, jclass cls)
|
||||
+{
|
||||
+ z_stream *strm = calloc(1, sizeof(z_stream));
|
||||
+
|
||||
+ if (strm == NULL) {
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ } else {
|
||||
+ const char *msg;
|
||||
+ int ret = inflateInit2(strm, KAE_INFLATER_WindowBit);
|
||||
+ switch (ret) {
|
||||
+ case Z_OK:
|
||||
+ return ptr_to_jlong(strm);
|
||||
+ case Z_MEM_ERROR:
|
||||
+ free(strm);
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return jlong_zero;
|
||||
+ default:
|
||||
+ msg = ((strm->msg != NULL) ? strm->msg :
|
||||
+ (ret == Z_VERSION_ERROR) ?
|
||||
+ "zlib returned Z_VERSION_ERROR: "
|
||||
+ "compile time and runtime zlib implementations differ" :
|
||||
+ (ret == Z_STREAM_ERROR) ?
|
||||
+ "inflateInit2 returned Z_STREAM_ERROR" :
|
||||
+ "unknown error initializing zlib library");
|
||||
+ free(strm);
|
||||
+ JNU_ThrowInternalError(env, msg);
|
||||
+ return jlong_zero;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_util_zip_Inflater_setDictionary(JNIEnv *env, jclass cls, jlong addr,
|
||||
jarray b, jint off, jint len)
|
||||
@@ -181,6 +215,70 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
|
||||
}
|
||||
}
|
||||
|
||||
+JNIEXPORT jint JNICALL
|
||||
+Java_java_util_zip_Inflater_inflateBytesKAE(JNIEnv *env, jobject this, jlong addr,
|
||||
+ jarray b, jint off, jint len)
|
||||
+{
|
||||
+ z_stream *strm = jlong_to_ptr(addr);
|
||||
+ jarray this_buf = (jarray)(*env)->GetObjectField(env, this, bufID);
|
||||
+ jint this_off = (*env)->GetIntField(env, this, offID);
|
||||
+ jint this_len = (*env)->GetIntField(env, this, lenID);
|
||||
+
|
||||
+ jbyte *in_buf;
|
||||
+ jbyte *out_buf;
|
||||
+ int ret;
|
||||
+
|
||||
+ in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
|
||||
+ if (in_buf == NULL) {
|
||||
+ if (this_len != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
|
||||
+ if (out_buf == NULL) {
|
||||
+ (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
|
||||
+ if (len != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ strm->next_in = (Bytef *) (in_buf + this_off);
|
||||
+ strm->next_out = (Bytef *) (out_buf + off);
|
||||
+ strm->avail_in = this_len;
|
||||
+ strm->avail_out = len;
|
||||
+ ret = inflate(strm, Z_SYNC_FLUSH);
|
||||
+ (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
|
||||
+ (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
|
||||
+
|
||||
+ switch (ret) {
|
||||
+ case Z_STREAM_END:
|
||||
+ (*env)->SetBooleanField(env, this, finishedID, JNI_TRUE);
|
||||
+ /* fall through */
|
||||
+ case Z_OK:
|
||||
+ this_off += this_len - strm->avail_in;
|
||||
+ (*env)->SetIntField(env, this, offID, this_off);
|
||||
+ (*env)->SetIntField(env, this, lenID, strm->avail_in);
|
||||
+ return (jint) (len - strm->avail_out);
|
||||
+ case Z_NEED_DICT:
|
||||
+ (*env)->SetBooleanField(env, this, needDictID, JNI_TRUE);
|
||||
+ /* Might have consumed some input here! */
|
||||
+ this_off += this_len - strm->avail_in;
|
||||
+ (*env)->SetIntField(env, this, offID, this_off);
|
||||
+ (*env)->SetIntField(env, this, lenID, strm->avail_in);
|
||||
+ return 0;
|
||||
+ case Z_BUF_ERROR:
|
||||
+ return 0;
|
||||
+ case Z_DATA_ERROR:
|
||||
+ ThrowDataFormatException(env, strm->msg);
|
||||
+ return 0;
|
||||
+ case Z_MEM_ERROR:
|
||||
+ JNU_ThrowOutOfMemoryError(env, 0);
|
||||
+ return 0;
|
||||
+ default:
|
||||
+ JNU_ThrowInternalError(env, strm->msg);
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_java_util_zip_Inflater_getAdler(JNIEnv *env, jclass cls, jlong addr)
|
||||
{
|
||||
diff --git a/jdk/test/java/util/zip/DeflateIn_InflateOut.java b/jdk/test/java/util/zip/DeflateIn_InflateOut.java
|
||||
index dd69a7773..048d8e34c 100644
|
||||
--- a/jdk/test/java/util/zip/DeflateIn_InflateOut.java
|
||||
+++ b/jdk/test/java/util/zip/DeflateIn_InflateOut.java
|
||||
@@ -41,14 +41,31 @@ public class DeflateIn_InflateOut {
|
||||
private static ByteArrayOutputStream baos;
|
||||
private static InflaterOutputStream ios;
|
||||
|
||||
- private static void reset() {
|
||||
+ private static Inflater reset(byte[] dict) {
|
||||
new Random(new Date().getTime()).nextBytes(data);
|
||||
|
||||
bais = new ByteArrayInputStream(data);
|
||||
- dis = new DeflaterInputStream(bais);
|
||||
+ if (dict == null) {
|
||||
+ dis = new DeflaterInputStream(bais);
|
||||
+ } else {
|
||||
+ Deflater def = new Deflater();
|
||||
+ def.setDictionary(dict);
|
||||
+ dis = new DeflaterInputStream(bais, def);
|
||||
+ }
|
||||
|
||||
baos = new ByteArrayOutputStream();
|
||||
- ios = new InflaterOutputStream(baos);
|
||||
+ if (dict == null) {
|
||||
+ ios = new InflaterOutputStream(baos);
|
||||
+ return null;
|
||||
+ } else {
|
||||
+ Inflater inf = new Inflater();
|
||||
+ ios = new InflaterOutputStream(baos, inf);
|
||||
+ return inf;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void reset() {
|
||||
+ reset(null);
|
||||
}
|
||||
|
||||
/** Check byte arrays read/write. */
|
||||
@@ -216,6 +233,44 @@ public class DeflateIn_InflateOut {
|
||||
check(numNotSkipped + numSkipBytes == numReadable);
|
||||
}
|
||||
|
||||
+ /** Check "needsDictionary()". */
|
||||
+ private static void NeedsDictionary() throws Throwable {
|
||||
+ byte[] dict = {1, 2, 3, 4};
|
||||
+ Adler32 adler32 = new Adler32();
|
||||
+ adler32.update(dict);
|
||||
+ long checksum = adler32.getValue();
|
||||
+ byte[] buf = new byte[512];
|
||||
+
|
||||
+ Inflater inf = reset(dict);
|
||||
+ check(dis.available() == 1);
|
||||
+ boolean dictSet = false;
|
||||
+ for (;;) {
|
||||
+ int len = dis.read(buf, 0, buf.length);
|
||||
+ if (len < 0) {
|
||||
+ break;
|
||||
+ } else {
|
||||
+ try {
|
||||
+ ios.write(buf, 0, len);
|
||||
+ if (dictSet == false) {
|
||||
+ check(false, "Must throw ZipException without dictionary");
|
||||
+ return;
|
||||
+ }
|
||||
+ } catch (ZipException ze) {
|
||||
+ check(dictSet == false, "Dictonary must be set only once");
|
||||
+ check(checksum == inf.getAdler(), "Incorrect dictionary");
|
||||
+ inf.setDictionary(dict);
|
||||
+ // After setting the dictionary, we have to flush the
|
||||
+ // InflaterOutputStream now in order to consume all the
|
||||
+ // pending input data from the last, failed call to "write()".
|
||||
+ ios.flush();
|
||||
+ dictSet = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ check(dis.available() == 0);
|
||||
+ ios.close();
|
||||
+ check(Arrays.equals(data, baos.toByteArray()));
|
||||
+ }
|
||||
|
||||
public static void realMain(String[] args) throws Throwable {
|
||||
ArrayReadWrite();
|
||||
@@ -227,15 +282,24 @@ public class DeflateIn_InflateOut {
|
||||
ByteReadByteWrite();
|
||||
|
||||
SkipBytes();
|
||||
+
|
||||
+ NeedsDictionary();
|
||||
}
|
||||
|
||||
//--------------------- Infrastructure ---------------------------
|
||||
static volatile int passed = 0, failed = 0;
|
||||
static void pass() {passed++;}
|
||||
- static void fail() {failed++; Thread.dumpStack();}
|
||||
- static void fail(String msg) {System.out.println(msg); fail();}
|
||||
+ static void fail() { fail(null); }
|
||||
+ static void fail(String msg) {
|
||||
+ failed++;
|
||||
+ if (msg != null) {
|
||||
+ System.err.println(msg);
|
||||
+ }
|
||||
+ Thread.dumpStack();
|
||||
+ }
|
||||
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
|
||||
static void check(boolean cond) {if (cond) pass(); else fail();}
|
||||
+ static void check(boolean cond, String msg) {if (cond) pass(); else fail(msg);}
|
||||
static void equal(Object x, Object y) {
|
||||
if (x == null ? y == null : x.equals(y)) pass();
|
||||
else fail(x + " not equal to " + y);}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -257,13 +257,13 @@ index dd107fc..791ddb6 100644
|
||||
+ File.separator + "security" + File.separator + "cacerts";
|
||||
|
||||
// The numbers of certs now.
|
||||
- private static final int COUNT = 108;
|
||||
- private static final int COUNT = 110;
|
||||
+ private static final int COUNT = 83;
|
||||
|
||||
// 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
|
||||
- = "81:D4:84:F6:92:78:A4:82:25:06:DC:42:25:C9:5D:6C:63:E4:99:CE:BC:ED:66:B3:8C:BA:E6:BA:6B:34:0F:01";
|
||||
- = "C1:68:B4:AC:51:BF:B5:C6:FD:20:69:17:E1:AF:E4:5B:01:9B:AA:3F:C3:9A:80:A8:51:53:74:2C:A2:04:B0:FF";
|
||||
+ = "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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user