diff --git a/8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch b/8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch index 08411fd6f00c8cf19db13e61916c1528e037fbc9..df447e6a35706a27fdfbd2349e2c4258a4914258 100644 --- a/8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch +++ b/8014628-Support-AES-Encryption-with-HMAC-SHA2-for-Ke.patch @@ -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 diff --git a/8136577_Make_AbortVMOnException_available_in_product_builds.patch b/8136577_Make_AbortVMOnException_available_in_product_builds.patch index 1aa04c7bc9b4677cd2536ad44905707ee88616df..1b13af19532753e32e6a9f3c55ea29944f59ad65 100755 --- a/8136577_Make_AbortVMOnException_available_in_product_builds.patch +++ b/8136577_Make_AbortVMOnException_available_in_product_builds.patch @@ -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)); diff --git a/Backport-6956385-URLConnection.getLastModified-leaks-file-han.patch b/Backport-6956385-URLConnection.getLastModified-leaks-file-han.patch new file mode 100644 index 0000000000000000000000000000000000000000..d05b7ff7eae5ade774ed6192303350f978148bf9 --- /dev/null +++ b/Backport-6956385-URLConnection.getLastModified-leaks-file-han.patch @@ -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) 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 + diff --git a/Backport-7036144-GZIPInputStream-readTrailer-uses-faulty-avai.patch b/Backport-7036144-GZIPInputStream-readTrailer-uses-faulty-avai.patch new file mode 100644 index 0000000000000000000000000000000000000000..f7ec9900fcbeaad2198169e78c1bb0e79a9f82be --- /dev/null +++ b/Backport-7036144-GZIPInputStream-readTrailer-uses-faulty-avai.patch @@ -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 + diff --git a/Backport-8068864-C2-failed-modified-node-is-not-on-IGVN._work.patch b/Backport-8068864-C2-failed-modified-node-is-not-on-IGVN._work.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ca64dec638048a8d02bb7231e931b8fdcdcc7c3 --- /dev/null +++ b/Backport-8068864-C2-failed-modified-node-is-not-on-IGVN._work.patch @@ -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 + diff --git a/Backport-8151845-Comment-in-globals.hpp-for-MetaspaceSize-is-.patch b/Backport-8151845-Comment-in-globals.hpp-for-MetaspaceSize-is-.patch new file mode 100644 index 0000000000000000000000000000000000000000..e0638156a16827ddea03904c162c2cf08b016f96 --- /dev/null +++ b/Backport-8151845-Comment-in-globals.hpp-for-MetaspaceSize-is-.patch @@ -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 + diff --git a/Backport-8209362-sun-security-ssl-SSLSocketImpl-ReuseAddr.jav.patch b/Backport-8209362-sun-security-ssl-SSLSocketImpl-ReuseAddr.jav.patch new file mode 100644 index 0000000000000000000000000000000000000000..30b6c933a076edb71729d1c4915383f9095e05f7 --- /dev/null +++ b/Backport-8209362-sun-security-ssl-SSLSocketImpl-ReuseAddr.jav.patch @@ -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 + diff --git a/Backport-8210706-G1-may-deadlock-when-starting-a-concurrent-c.patch b/Backport-8210706-G1-may-deadlock-when-starting-a-concurrent-c.patch new file mode 100644 index 0000000000000000000000000000000000000000..c5b688c088f58066b253b8f32b58ef176ec97d28 --- /dev/null +++ b/Backport-8210706-G1-may-deadlock-when-starting-a-concurrent-c.patch @@ -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 + diff --git a/Backport-8318889-Backport-Important-Fixed-Issues-in-Later-Ver.patch b/Backport-8318889-Backport-Important-Fixed-Issues-in-Later-Ver.patch new file mode 100644 index 0000000000000000000000000000000000000000..38c47b873035d7be7f5cb5c5c15c37f0fe687162 --- /dev/null +++ b/Backport-8318889-Backport-Important-Fixed-Issues-in-Later-Ver.patch @@ -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 "":"()V" ++ stack 1 locals 1 ++ { ++ aload_0; ++ invokespecial Method java/lang/Object."":"()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 ++#include ++#include ++ ++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 + diff --git a/DependencyContext-mark_dependent_nmethods-crash-in-Dynamic-cds-mode.patch b/DependencyContext-mark_dependent_nmethods-crash-in-Dynamic-cds-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..a0a9115b822c1d8a81b356121410107277c8f207 --- /dev/null +++ b/DependencyContext-mark_dependent_nmethods-crash-in-Dynamic-cds-mode.patch @@ -0,0 +1,29 @@ +DependencyContext::mark_dependent_nmethods crash in Dynamic cds mode +--- + hotspot/src/share/vm/oops/instanceKlass.cpp | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp +index df44e5319..833cf9afe 100644 +--- a/hotspot/src/share/vm/oops/instanceKlass.cpp ++++ b/hotspot/src/share/vm/oops/instanceKlass.cpp +@@ -2462,8 +2462,6 @@ void InstanceKlass::remove_unshareable_info() { + + constants()->remove_unshareable_info(); + +- assert(_dep_context == DependencyContext::EMPTY, "dependency context is not shareable"); +- + for (int i = 0; i < methods()->length(); i++) { + Method* m = methods()->at(i); + m->remove_unshareable_info(); +@@ -2487,6 +2485,7 @@ void InstanceKlass::remove_unshareable_info() { + // do array classes also. + array_klasses_do(remove_unshareable_in_class); + // These are not allocated from metaspace. They are safe to set to NULL. ++ _dep_context = DependencyContext::EMPTY; + _member_names = NULL; + _osr_nmethods_head = NULL; + _init_thread = NULL; +-- +2.22.0 + diff --git a/Dynamic-CDS-Archive.patch b/Dynamic-CDS-Archive.patch index 30a6ff8169def8d3ed47633f5431a0b3a19d72dd..ebeb75b4dc1d0728436d76fb24b392d380f8f398 100644 --- a/Dynamic-CDS-Archive.patch +++ b/Dynamic-CDS-Archive.patch @@ -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; diff --git a/Huawei-Add-Aggressive-CDS.patch b/Huawei-Add-Aggressive-CDS.patch new file mode 100644 index 0000000000000000000000000000000000000000..b6085e33d4f2d9d972b214dd0b34a1b6d1f92924 --- /dev/null +++ b/Huawei-Add-Aggressive-CDS.patch @@ -0,0 +1,1316 @@ +From a7acbdd7c7885a92e3e62d485c0ceaa95923806f Mon Sep 17 00:00:00 2001 +Date: Mon, 27 May 2024 16:14:55 +0800 +Subject: [PATCH] [Huawei]Add Aggressive CDS +--- + hotspot/make/bsd/makefiles/mapfile-vers-debug | 1 + + .../make/bsd/makefiles/mapfile-vers-product | 1 + + .../make/linux/makefiles/mapfile-vers-debug | 1 + + .../make/linux/makefiles/mapfile-vers-product | 1 + + hotspot/src/share/vm/cds/archiveBuilder.cpp | 5 + + hotspot/src/share/vm/cds/dynamicArchive.cpp | 20 + + .../share/vm/classfile/classFileParser.cpp | 32 ++ + .../vm/classfile/systemDictionaryShared.cpp | 375 ++++++++++++++++++ + .../vm/classfile/systemDictionaryShared.hpp | 13 + + hotspot/src/share/vm/classfile/vmSymbols.hpp | 2 + + hotspot/src/share/vm/memory/filemap.cpp | 53 ++- + hotspot/src/share/vm/memory/filemap.hpp | 11 + + hotspot/src/share/vm/prims/jvm.cpp | 30 ++ + hotspot/src/share/vm/prims/jvm.h | 6 + + hotspot/src/share/vm/runtime/arguments.cpp | 16 + + hotspot/src/share/vm/runtime/arguments.hpp | 4 + + hotspot/src/share/vm/runtime/globals.hpp | 8 + + hotspot/src/share/vm/utilities/macros.hpp | 9 + + jdk/make/mapfiles/libjava/mapfile-linux | 1 + + jdk/make/mapfiles/libjava/mapfile-vers | 1 + + .../share/classes/java/lang/ClassLoader.java | 35 ++ + .../classes/java/net/AggressiveCDSPlugin.java | 45 +++ + .../classes/java/net/URLClassLoader.java | 27 ++ + .../java/security/ProtectionDomain.java | 16 + + .../java/security/SecureClassLoader.java | 12 + + .../share/classes/sun/misc/URLClassPath.java | 18 + + jdk/src/share/javavm/export/jvm.h | 5 + + jdk/src/share/native/java/lang/ClassLoader.c | 25 ++ + 28 files changed, 772 insertions(+), 1 deletion(-) + create mode 100644 jdk/src/share/classes/java/net/AggressiveCDSPlugin.java + +diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-debug b/hotspot/make/bsd/makefiles/mapfile-vers-debug +index c60ad3e00..86af8a1be 100644 +--- a/hotspot/make/bsd/makefiles/mapfile-vers-debug ++++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug +@@ -233,6 +233,7 @@ + _JVM_AdaptiveHeapGetG1PeriodicGCInterval + _JVM_AdaptiveHeapSetG1PeriodicGCLoadThreshold + _JVM_AdaptiveHeapGetG1PeriodicGCLoadThreshold ++ _JVM_DefineTrustedSharedClass + _JVM_Sleep + _JVM_Socket + _JVM_SocketAvailable +diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-product b/hotspot/make/bsd/makefiles/mapfile-vers-product +index 94d123c9f..69cd3f962 100644 +--- a/hotspot/make/bsd/makefiles/mapfile-vers-product ++++ b/hotspot/make/bsd/makefiles/mapfile-vers-product +@@ -233,6 +233,7 @@ + _JVM_AdaptiveHeapGetG1PeriodicGCLoadThreshold + _JVM_AdaptiveHeapSetG1PeriodicGCInterval + _JVM_AdaptiveHeapSetG1PeriodicGCLoadThreshold ++ _JVM_DefineTrustedSharedClass + _JVM_Sleep + _JVM_Socket + _JVM_SocketAvailable +diff --git a/hotspot/make/linux/makefiles/mapfile-vers-debug b/hotspot/make/linux/makefiles/mapfile-vers-debug +index 1ebe436cb..b006a84c2 100644 +--- a/hotspot/make/linux/makefiles/mapfile-vers-debug ++++ b/hotspot/make/linux/makefiles/mapfile-vers-debug +@@ -237,6 +237,7 @@ SUNWprivate_1.1 { + JVM_AdaptiveHeapGetG1PeriodicGCInterval; + JVM_AdaptiveHeapSetG1PeriodicGCLoadThreshold; + JVM_AdaptiveHeapGetG1PeriodicGCLoadThreshold; ++ JVM_DefineTrustedSharedClass; + JVM_Sleep; + JVM_Socket; + JVM_SocketAvailable; +diff --git a/hotspot/make/linux/makefiles/mapfile-vers-product b/hotspot/make/linux/makefiles/mapfile-vers-product +index 75e527894..64ccc47fb 100644 +--- a/hotspot/make/linux/makefiles/mapfile-vers-product ++++ b/hotspot/make/linux/makefiles/mapfile-vers-product +@@ -237,6 +237,7 @@ SUNWprivate_1.1 { + JVM_AdaptiveHeapGetG1PeriodicGCInterval; + JVM_AdaptiveHeapSetG1PeriodicGCLoadThreshold; + JVM_AdaptiveHeapGetG1PeriodicGCLoadThreshold; ++ JVM_DefineTrustedSharedClass; + JVM_Sleep; + JVM_Socket; + JVM_SocketAvailable; +diff --git a/hotspot/src/share/vm/cds/archiveBuilder.cpp b/hotspot/src/share/vm/cds/archiveBuilder.cpp +index 13a620028..decd638e0 100644 +--- a/hotspot/src/share/vm/cds/archiveBuilder.cpp ++++ b/hotspot/src/share/vm/cds/archiveBuilder.cpp +@@ -772,7 +772,12 @@ void ArchiveBuilder::clean_up_src_obj_table() { + } + + void ArchiveBuilder::write_archive(FileMapInfo* mapinfo) { ++#if INCLUDE_AGGRESSIVE_CDS ++ assert(mapinfo->header()->magic() == (UseAggressiveCDS ? ++ CDS_AGGRESSIVE_ARCHIVE_MAGIC : CDS_DYNAMIC_ARCHIVE_MAGIC), "Dynamic CDS or Aggressive CDS calls only"); ++#else + assert(mapinfo->header()->magic() == CDS_DYNAMIC_ARCHIVE_MAGIC, "Dynamic CDS calls only"); ++#endif // INCLUDE_AGGRESSIVE_CDS + + mapinfo->write_dynamic_header(); + +diff --git a/hotspot/src/share/vm/cds/dynamicArchive.cpp b/hotspot/src/share/vm/cds/dynamicArchive.cpp +index a623c5b00..2e5ab9385 100644 +--- a/hotspot/src/share/vm/cds/dynamicArchive.cpp ++++ b/hotspot/src/share/vm/cds/dynamicArchive.cpp +@@ -165,6 +165,16 @@ void DynamicArchiveBuilder::init_header() { + + FileMapInfo* base_info = FileMapInfo::current_info(); + _header->set_base_header_crc(base_info->header()->crc()); ++ ++#if INCLUDE_AGGRESSIVE_CDS ++ if (UseAggressiveCDS) { ++ int crc = FileMapInfo::DynamicArchiveHeader::get_current_program_crc(); ++ _header->set_program_crc(crc); ++ } else { ++ _header->set_program_crc(0); ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + for (int i = 0; i < MetaspaceShared::n_regions; i++) { + _header->set_base_region_crc(i, base_info->header()->space_crc(i)); + } +@@ -401,6 +411,16 @@ bool DynamicArchive::validate(FileMapInfo* dynamic_info) { + return false; + } + ++#if INCLUDE_AGGRESSIVE_CDS ++ // Check the program crc ++ if (UseAggressiveCDS) { ++ if (dynamic_header->program_crc() != FileMapInfo::DynamicArchiveHeader::get_current_program_crc()) { ++ FileMapInfo::fail_continue("Aggressive Dynamic archive cannot be used: program crc verification failed."); ++ return false; ++ } ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + // Check each space's crc + for (int i = 0; i < MetaspaceShared::n_regions; i++) { + if (dynamic_header->base_region_crc(i) != base_info->space_crc(i)) { +diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp +index b9fde38dc..8f1b2d47a 100644 +--- a/hotspot/src/share/vm/classfile/classFileParser.cpp ++++ b/hotspot/src/share/vm/classfile/classFileParser.cpp +@@ -4416,6 +4416,38 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, + if (DynamicDumpSharedSpaces && !SystemDictionary::is_builtin_loader(class_loader)) { + this_klass->set_shared_classpath_index(UNREGISTERED_INDEX); + SystemDictionaryShared::set_shared_class_misc_info(this_klass(), cfs); ++#if INCLUDE_AGGRESSIVE_CDS ++ if (UseAggressiveCDS && protection_domain() != NULL) { ++ ResourceMark rm(THREAD); ++ KlassHandle protectionDomain_klass(THREAD, SystemDictionary::ProtectionDomain_klass()); ++ JavaValue result(T_OBJECT); ++ JavaCalls::call_virtual(&result, ++ protection_domain, ++ protectionDomain_klass, ++ vmSymbols::getLocationNoFragString_name(), ++ vmSymbols::void_string_signature(), ++ THREAD); ++ if (!HAS_PENDING_EXCEPTION) { ++ oop res_oop = (oop) result.get_jobject(); ++ if (res_oop != NULL) { ++ char* string_value = java_lang_String::as_utf8_string(res_oop); ++ if (strlen(string_value) != 0) { ++ SystemDictionaryShared::set_url_string(this_klass(), string_value); ++ SystemDictionaryShared::save_timestamp(this_klass(), string_value); ++ } ++ } ++ } else { ++ char* ex_msg = const_cast(""); ++ oop message = java_lang_Throwable::message(PENDING_EXCEPTION); ++ if (message != NULL) { ++ ex_msg = java_lang_String::as_utf8_string(message); ++ } ++ dynamic_cds_log->print_cr("get LocationNoFragString from protection_domain has encountered exception: %s %s", ++ PENDING_EXCEPTION->klass()->external_name(), ex_msg); ++ CLEAR_PENDING_EXCEPTION; ++ } ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS + } + #endif // INCLUDE_CDS + +diff --git a/hotspot/src/share/vm/classfile/systemDictionaryShared.cpp b/hotspot/src/share/vm/classfile/systemDictionaryShared.cpp +index 3a601ee37..7707d6ac6 100644 +--- a/hotspot/src/share/vm/classfile/systemDictionaryShared.cpp ++++ b/hotspot/src/share/vm/classfile/systemDictionaryShared.cpp +@@ -35,6 +35,10 @@ + #include "utilities/resourceHash.hpp" + #include "runtime/mutexLocker.hpp" + #include "utilities/ostream.hpp" ++#if INCLUDE_AGGRESSIVE_CDS ++#include "memory/oopFactory.hpp" ++#include "runtime/javaCalls.hpp" ++#endif // INCLUDE_AGGRESSIVE_CDS + + DEBUG_ONLY(bool SystemDictionaryShared::_no_class_loading_should_happen = false;) + bool SystemDictionaryShared::_dump_in_progress = false; +@@ -68,6 +72,14 @@ public: + } + }; + ++#if INCLUDE_AGGRESSIVE_CDS ++ struct DTSharedClassFile { ++ int length; ++ u1 data[1]; ++ int obj_size() { return ((int)sizeof(length)) + length; } ++ }; ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + InstanceKlass* _klass; + InstanceKlass* _nest_host; + bool _failed_verification; +@@ -78,6 +90,10 @@ public: + GrowableArray* _verifier_constraints; + GrowableArray* _verifier_constraint_flags; + GrowableArray* _loader_constraints; ++#if INCLUDE_AGGRESSIVE_CDS ++ DTSharedClassFile* _url_string; ++ int64_t _classfile_timestamp; ++#endif // INCLUDE_AGGRESSIVE_CDS + + DumpTimeSharedClassInfo() { + _klass = NULL; +@@ -92,6 +108,10 @@ public: + _verifier_constraints = NULL; + _verifier_constraint_flags = NULL; + _loader_constraints = NULL; ++#if INCLUDE_AGGRESSIVE_CDS ++ _url_string = NULL; ++ _classfile_timestamp = 0; ++#endif // INCLUDE_AGGRESSIVE_CDS + } + + void add_verification_constraint(InstanceKlass* k, Symbol* name, +@@ -149,6 +169,44 @@ public: + void set_failed_verification() { _failed_verification = true; } + InstanceKlass* nest_host() const { return _nest_host; } + void set_nest_host(InstanceKlass* nest_host) { _nest_host = nest_host; } ++ ++#if INCLUDE_AGGRESSIVE_CDS ++ DTSharedClassFile* url_string() { ++ return _url_string; ++ } ++ ++ size_t url_string_size() { ++ if (_url_string != NULL) { ++ return (size_t)(_url_string->obj_size()); ++ } ++ return (size_t)0; ++ } ++ ++ void copy_url_string(char* string_value) { ++ assert(strlen(string_value) != 0, "sanity"); ++ size_t string_len = strlen(string_value) + (size_t)1; ++ size_t size = offset_of(DTSharedClassFile, data) + string_len; ++ _url_string = (DTSharedClassFile*) NEW_C_HEAP_ARRAY(u1, size, mtInternal); ++ _url_string->length = (int)string_len; ++ memcpy(_url_string->data, string_value, string_len); ++ assert((int)size == _url_string->obj_size(), "sanity"); ++ } ++ ++ void free_url_string() { ++ if (_url_string != NULL) { ++ FREE_C_HEAP_ARRAY(u1, _url_string, mtInternal); ++ _url_string = NULL; ++ } ++ } ++ ++ int64_t classfile_timestamp() { ++ return _classfile_timestamp; ++ } ++ ++ void set_classfile_timestamp(int64_t classfile_timestamp) { ++ _classfile_timestamp = classfile_timestamp; ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS + }; + + inline unsigned DumpTimeSharedClassTable_hash(InstanceKlass* const& k) { +@@ -245,7 +303,18 @@ public: + } + }; + ++#if INCLUDE_AGGRESSIVE_CDS ++ struct RTSharedClassFile { ++ int length; ++ u1 data[1]; ++ }; ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + InstanceKlass* _klass; ++#if INCLUDE_AGGRESSIVE_CDS ++ RTSharedClassFile* _url_string; ++ int64_t _classfile_timestamp; ++#endif // INCLUDE_AGGRESSIVE_CDS + int _num_verifier_constraints; + int _num_loader_constraints; + +@@ -294,6 +363,17 @@ public: + verifier_constraint_flags_size(num_verifier_constraints); + } + ++#if INCLUDE_AGGRESSIVE_CDS ++ static size_t byte_size(DumpTimeSharedClassInfo& info) { ++ size_t previous_size = byte_size(info._klass, info.num_verifier_constraints(), info.num_loader_constraints()); ++ if (UseAggressiveCDS) { ++ size_t cf_size = info.url_string_size(); ++ if (cf_size != 0) return align_up(previous_size, sizeof(int)) + cf_size; ++ } ++ return previous_size; ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + private: + size_t crc_offset() const { + return header_size_size(); +@@ -321,6 +401,13 @@ private: + assert(0 <= i && i < _num_loader_constraints, "sanity"); + } + ++#if INCLUDE_AGGRESSIVE_CDS ++ size_t url_string_offset() const { ++ return align_up(verifier_constraint_flags_offset() + verifier_constraint_flags_size(_num_verifier_constraints), ++ sizeof(int)); ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + public: + CrcInfo* crc() const { + assert(crc_size(_klass) > 0, "must be"); +@@ -350,6 +437,20 @@ public: + return loader_constraints() + i; + } + ++#if INCLUDE_AGGRESSIVE_CDS ++ RTSharedClassFile* url_string() { ++ return (RTSharedClassFile*)(address(this) + url_string_offset()); ++ } ++ ++ int64_t classfile_timestamp() { ++ return _classfile_timestamp; ++ } ++ ++ void set_classfile_timestamp(int64_t classfile_timestamp) { ++ _classfile_timestamp = classfile_timestamp; ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + void init(DumpTimeSharedClassInfo& info) { + ArchiveBuilder* builder = ArchiveBuilder::current(); + assert(builder->is_in_buffer_space(info._klass), "must be"); +@@ -383,6 +484,18 @@ public: + } + } + ++#if INCLUDE_AGGRESSIVE_CDS ++ if (info.url_string_size() != 0) { ++ _url_string = url_string(); ++ memcpy(_url_string, info.url_string(), info.url_string_size()); ++ ArchivePtrMarker::mark_pointer(&_url_string); ++ info.free_url_string(); ++ } else { ++ _url_string = NULL; ++ } ++ set_classfile_timestamp(info.classfile_timestamp()); ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + ArchivePtrMarker::mark_pointer(&_klass); + } + +@@ -426,6 +539,69 @@ public: + const RunTimeSharedClassInfo* value, Symbol* key, int len_unused) { + return (value->_klass->name() == key); + } ++ ++#if INCLUDE_AGGRESSIVE_CDS ++ // check timestamp in the load time when UseAggressiveCDS. ++ // regular_file(*.class): need to check timestamp. ++ // jar_file(*.jar): no need to check timestamp here,already check programe_crc ++ // somewhere else, see DynamicArchive::validate. ++ // other_file: not supported when UseAggressiveCDS. ++ bool check_classfile_timestamp(char* url_string, TRAPS) { ++ if (SystemDictionaryShared::is_regular_file(url_string)) { ++ ResourceMark rm(THREAD); ++ char* dir = SystemDictionaryShared::get_filedir(url_string); ++ if (dir == NULL) { ++ return false; ++ } ++ int64_t timestamp = SystemDictionaryShared::get_timestamp(dir, _klass->name()); ++ if (timestamp != _classfile_timestamp) { ++ dynamic_cds_log->print_cr("%s, timestamp mismatch: " INT64_FORMAT " -> " INT64_FORMAT, _klass->name()->as_C_string(), _classfile_timestamp, timestamp); ++ return false; ++ } ++ } else if (!SystemDictionaryShared::is_jar_file(url_string)) { ++ dynamic_cds_log->print_cr("Unsupported URL:%s", url_string); ++ return false; ++ } ++ return true; ++ } ++ ++ Handle get_protection_domain(Handle class_loader, TRAPS) { ++ if (_url_string == NULL) { ++ return Handle(); ++ } ++ char* data_ptr = (char*)(_url_string->data); ++ ++ if (CheckClassFileTimeStamp) { ++ if (!check_classfile_timestamp(data_ptr, THREAD)) { ++ return Handle(); ++ } ++ } ++ ++ Handle url_string = java_lang_String::create_from_str(data_ptr, THREAD); ++ JavaValue result(T_OBJECT); ++ JavaCalls::call_virtual(&result, ++ class_loader, ++ class_loader->klass(), ++ vmSymbols::getProtectionDomainByURLString_name(), ++ vmSymbols::getProtectionDomainInternal_signature(), ++ url_string, THREAD); ++ if (!HAS_PENDING_EXCEPTION) { ++ oop pd = (oop) result.get_jobject(); ++ return Handle(THREAD, pd); ++ } else { ++ ResourceMark rm(THREAD); ++ char* ex_msg = const_cast(""); ++ oop message = java_lang_Throwable::message(PENDING_EXCEPTION); ++ if (message != NULL) { ++ ex_msg = java_lang_String::as_utf8_string(message); ++ } ++ dynamic_cds_log->print_cr("get protection_domain has encountered exception: %s %s", ++ PENDING_EXCEPTION->klass()->external_name(), ex_msg); ++ CLEAR_PENDING_EXCEPTION; ++ } ++ return Handle(); ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS + }; + + class RunTimeSharedDictionary : public OffsetCompactHashtable< +@@ -710,7 +886,11 @@ public: + + bool do_entry(InstanceKlass* k, DumpTimeSharedClassInfo& info) { + if (!info.is_excluded()) { ++#if INCLUDE_AGGRESSIVE_CDS ++ size_t byte_size = RunTimeSharedClassInfo::byte_size(info); ++#else + size_t byte_size = RunTimeSharedClassInfo::byte_size(info._klass, info.num_verifier_constraints(), info.num_loader_constraints()); ++#endif // INCLUDE_AGGRESSIVE_CDS + _shared_class_info_size += align_up(byte_size, KlassAlignmentInBytes); + } + return true; // keep on iterating +@@ -746,6 +926,38 @@ unsigned int SystemDictionaryShared::hash_for_shared_dictionary(address ptr) { + } + } + ++#if INCLUDE_AGGRESSIVE_CDS ++class ExcludeDuplicateKlass : StackObj { ++public: ++ static const int INITIAL_TABLE_SIZE = 15889; ++ ++ ExcludeDuplicateKlass(int size) : _has_been_visited(size) {} ++ ++ bool do_entry(InstanceKlass* k, DumpTimeSharedClassInfo& info) { ++ if (!info.is_excluded()) { ++ bool created; ++ Symbol* name = info._klass->name(); ++ address* info_ptr = _has_been_visited.add_if_absent((address)name, (address)&info, &created); ++ if (!created) { ++ info.set_excluded(); ++ DumpTimeSharedClassInfo* first_info = (DumpTimeSharedClassInfo*)(*info_ptr); ++ if (!first_info->is_excluded()) { ++ first_info->set_excluded(); ++ } ++ if (TraceDynamicCDS) { ++ ResourceMark rm; ++ dynamic_cds_log->print_cr("[AggressiveCDS] Skipping duplicate class (excluded): %s", name->as_C_string()); ++ } ++ } ++ } ++ return true; ++ } ++ ++private: ++ KVHashtable _has_been_visited; ++}; ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + class CopySharedClassInfoToArchive : StackObj { + CompactHashtableWriter* _writer; + bool _is_builtin; +@@ -757,7 +969,11 @@ public: + + bool do_entry(InstanceKlass* k, DumpTimeSharedClassInfo& info) { + if (!info.is_excluded() && info.is_builtin() == _is_builtin) { ++#if INCLUDE_AGGRESSIVE_CDS ++ size_t byte_size = RunTimeSharedClassInfo::byte_size(info); ++#else + size_t byte_size = RunTimeSharedClassInfo::byte_size(info._klass, info.num_verifier_constraints(), info.num_loader_constraints()); ++#endif // INCLUDE_AGGRESSIVE_CDS + RunTimeSharedClassInfo* record; + record = (RunTimeSharedClassInfo*)ArchiveBuilder::ro_region_alloc(byte_size); + record->init(info); +@@ -787,6 +1003,12 @@ void SystemDictionaryShared::write_dictionary(RunTimeSharedDictionary* dictionar + bool is_builtin) { + CompactHashtableStats stats; + dictionary->reset(); ++#if INCLUDE_AGGRESSIVE_CDS ++ if (UseAggressiveCDS && !is_builtin) { ++ ExcludeDuplicateKlass dup(ExcludeDuplicateKlass::INITIAL_TABLE_SIZE); ++ _dumptime_table->iterate(&dup); ++ } ++#endif // INCLUDE_AGGRESSIVE_CDS + CompactHashtableWriter writer(_dumptime_table->count_of(is_builtin), &stats); + CopySharedClassInfoToArchive copy(&writer, is_builtin); + assert_lock_strong(DumpTimeTable_lock); +@@ -909,3 +1131,156 @@ InstanceKlass* SystemDictionaryShared::find_dynamic_builtin_class(Symbol* name) + return NULL; + } + } ++ ++#if INCLUDE_AGGRESSIVE_CDS ++static const char* JAR_FILE_PREFIX = "jar://file:"; ++static const char* FILE_SEPARATOR = "file://"; ++static const char* CLASSFILE_SUFFIX = ".class"; ++ ++static bool start_with(char* str, const char* prefix) { ++ if (str == NULL || prefix == NULL || strlen(str) < strlen(prefix)) { ++ return false; ++ } ++ if (strncmp(str, prefix, strlen(prefix)) == 0) { ++ return true; ++ } ++ return false; ++} ++ ++bool SystemDictionaryShared::is_jar_file(char* url_string) { ++ if (start_with(url_string, JAR_FILE_PREFIX)) { ++ return true; ++ } ++ return false; ++} ++ ++bool SystemDictionaryShared::is_regular_file(char* url_string) { ++ if (start_with(url_string, FILE_SEPARATOR)) { ++ return true; ++ } ++ return false; ++} ++ ++char* SystemDictionaryShared::get_filedir(char* url_string) { ++ if (!is_regular_file(url_string)) { ++ return NULL; ++ } ++ char* dir = url_string + strlen(FILE_SEPARATOR); ++ struct stat st; ++ if (os::stat(dir, &st) == 0) { ++ if ((st.st_mode & S_IFDIR) == S_IFDIR) { ++ return dir; ++ } ++ } ++ return NULL; ++} ++ ++int64_t SystemDictionaryShared::get_timestamp(char* dir, Symbol* class_name) { ++ char* name = class_name->as_C_string(); ++ size_t name_len = strlen(name); ++ size_t dir_len = strlen(dir); ++ size_t classfile_suffix_len = strlen(CLASSFILE_SUFFIX); ++ char* file_path = NEW_RESOURCE_ARRAY(char, dir_len + name_len + classfile_suffix_len + 1); ++ memcpy(file_path, dir, dir_len); ++ memcpy(file_path + dir_len, name, name_len); ++ memcpy(file_path + dir_len + name_len, CLASSFILE_SUFFIX, classfile_suffix_len + 1); ++ assert(strlen(file_path) == dir_len + name_len + classfile_suffix_len, "sanity"); ++ struct stat st; ++ if (os::stat(file_path, &st) == 0) { ++ return st.st_mtime; ++ } ++ dynamic_cds_log->print_cr("get timestamp failed:%s", file_path); ++ return 0; ++} ++ ++Handle SystemDictionaryShared::get_protection_domain(InstanceKlass* k, Handle class_loader, TRAPS) { ++ assert(UseAggressiveCDS, "sanity"); ++ RunTimeSharedClassInfo* info = RunTimeSharedClassInfo::get_for(k); ++ assert(!is_builtin_loader(class_loader), "sanity"); ++ return info->get_protection_domain(class_loader, THREAD); ++} ++ ++void SystemDictionaryShared::set_url_string(InstanceKlass* k, char* string_value) { ++ assert(UseAggressiveCDS, "sanity"); ++ Arguments::assert_is_dumping_archive(); ++ assert(!is_builtin(k), "must be unregistered class"); ++ DumpTimeSharedClassInfo* info = find_or_allocate_info_for(k); ++ if (info != NULL && info->_url_string == NULL) { ++ info->copy_url_string(string_value); ++ } ++} ++ ++void SystemDictionaryShared::save_timestamp(InstanceKlass* k, char* string_value) { ++ if (SystemDictionaryShared::is_regular_file(string_value)) { ++ char* dir = SystemDictionaryShared::get_filedir(string_value); ++ if (dir != NULL) { ++ int64_t timestamp = SystemDictionaryShared::get_timestamp(dir, k->name()); ++ SystemDictionaryShared::set_classfile_timestamp(k, timestamp); ++ } ++ } else if (!SystemDictionaryShared::is_jar_file(string_value)) { ++ dynamic_cds_log->print_cr("Unsupported URL:%s", string_value); ++ } ++} ++ ++void SystemDictionaryShared::set_classfile_timestamp(InstanceKlass* k, int64_t classfile_timestamp) { ++ assert(UseAggressiveCDS, "sanity"); ++ Arguments::assert_is_dumping_archive(); ++ assert(!is_builtin(k), "must be unregistered class"); ++ DumpTimeSharedClassInfo* info = find_or_allocate_info_for(k); ++ if (info != NULL) { ++ info->set_classfile_timestamp(classfile_timestamp); ++ } ++} ++ ++InstanceKlass* SystemDictionaryShared::lookup_trusted_share_class(Symbol* class_name, ++ Handle class_loader, ++ TRAPS) { ++ assert(UseAggressiveCDS, "sanity"); ++ if (!UseSharedSpaces) { ++ return NULL; ++ } ++ if (class_name == NULL) { // don't do this for hidden classes ++ return NULL; ++ } ++ if (SystemDictionary::is_builtin_loader(class_loader)) { ++ // Do nothing for the BUILTIN loaders. ++ return NULL; ++ } ++ ++ // Classloaders that support parallelism, e.g. bootstrap classloader, ++ // or all classloaders with UnsyncloadClass do not acquire lock here ++ bool DoObjectLock = true; ++ if (is_parallelCapable(class_loader)) { ++ DoObjectLock = false; ++ } ++ ++ register_loader(class_loader, CHECK_NULL); ++ ++ // Make sure we are synchronized on the class loader before we proceed ++ Handle lockObject = compute_loader_lock_object(class_loader, THREAD); ++ check_loader_lock_contention(lockObject, THREAD); ++ ObjectLocker ol(lockObject, THREAD, DoObjectLock); ++ ++ const RunTimeSharedClassInfo* record = find_record(&_dynamic_unregistered_dictionary, class_name); ++ if (record == NULL) { ++ return NULL; ++ } ++ ++ Handle protection_domain = SystemDictionaryShared::get_protection_domain(record->_klass, class_loader, CHECK_NULL); ++ ++ if (protection_domain.is_null()) { ++ // URL not matched, which means should not be loaded by this classloader ++ return NULL; ++ } ++ ++ instanceKlassHandle k = acquire_class_for_current_thread(record->_klass, class_loader, protection_domain, NULL, THREAD); ++ if (!HAS_PENDING_EXCEPTION && k() != NULL) { ++ if (is_parallelCapable(class_loader)) { ++ k = find_or_define_instance_class(class_name, class_loader, k, THREAD); ++ } else { ++ define_instance_class(k, THREAD); ++ } ++ } ++ return k(); ++} ++#endif // INCLUDE_AGGRESSIVE_CDS +\ No newline at end of file +diff --git a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp +index fb9583d4e..3025e7350 100644 +--- a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp ++++ b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp +@@ -238,6 +238,19 @@ public: + TRAPS); + + static InstanceKlass* find_dynamic_builtin_class(Symbol* name); ++ ++#if INCLUDE_AGGRESSIVE_CDS ++ static bool is_jar_file(char* url_string); ++ static bool is_regular_file(char* url_string); ++ static char* get_filedir(char* url_string); ++ static int64_t get_timestamp(char* dir, Symbol* class_name); ++ static Handle get_protection_domain(InstanceKlass* k, Handle class_loader, TRAPS); ++ static void set_url_string(InstanceKlass* k, char* string_value); ++ static void save_timestamp(InstanceKlass* k, char* string_value); ++ static void set_classfile_timestamp(InstanceKlass* k, int64_t classfile_timestamp); ++ static int64_t get_classfile_timestamp(InstanceKlass* k); ++ static InstanceKlass* lookup_trusted_share_class(Symbol* class_name, Handle class_loader, TRAPS); ++#endif // INCLUDE_AGGRESSIVE_CDS + }; + + #endif // SHARE_VM_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP +diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp +index 79f15589f..2ddc6581e 100644 +--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp ++++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp +@@ -421,6 +421,8 @@ + template(definePackageInternal_signature, "(Ljava/lang/String;Ljava/util/jar/Manifest;Ljava/net/URL;)V") \ + template(getProtectionDomainInternal_name, "getProtectionDomainInternal") \ + template(getProtectionDomainInternal_signature, "(Ljava/lang/String;)Ljava/security/ProtectionDomain;") \ ++ template(getProtectionDomainByURLString_name, "getProtectionDomainByURLString") \ ++ template(getLocationNoFragString_name, "getLocationNoFragString") \ + template(url_code_signer_array_void_signature, "(Ljava/net/URL;[Ljava/security/CodeSigner;)V") \ + template(resolved_references_name, "") \ + template(referencequeue_null_name, "NULL") \ +diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp +index 166fe2b80..b60d77be6 100644 +--- a/hotspot/src/share/vm/memory/filemap.cpp ++++ b/hotspot/src/share/vm/memory/filemap.cpp +@@ -208,7 +208,11 @@ size_t FileMapInfo::DynamicArchiveHeader::data_size() { + } + + bool FileMapInfo::DynamicArchiveHeader::validate() { ++#if INCLUDE_AGGRESSIVE_CDS ++ if (_magic != (UseAggressiveCDS ? CDS_AGGRESSIVE_ARCHIVE_MAGIC : CDS_DYNAMIC_ARCHIVE_MAGIC)) { ++#else + if (_magic != CDS_DYNAMIC_ARCHIVE_MAGIC) { ++#endif // INCLUDE_AGGRESSIVE_CDS + FileMapInfo::fail_continue("The shared archive file has a bad magic number."); + return false; + } +@@ -243,9 +247,48 @@ bool FileMapInfo::DynamicArchiveHeader::validate() { + return true; + } + ++#if INCLUDE_AGGRESSIVE_CDS ++int FileMapInfo::DynamicArchiveHeader::get_current_program_crc() { ++ int cur_crc = 0; ++ const char* full_cmd = Arguments::java_command(); ++ if (full_cmd == NULL) { ++ return 0; ++ } ++ const char* main_path = Arguments::get_appclasspath(); ++ int main_path_len = strlen(main_path); ++ bool is_jar_file = strncmp(full_cmd, main_path, main_path_len) == 0; ++ if (is_jar_file) { ++ fio_fd fd = os::open(main_path, O_RDONLY | O_BINARY, 0); ++ assert(fd >= 0, "sanity"); ++ ++ uint32_t file_size = (uint32_t) os::lseek(fd, 0, SEEK_END); ++ os::lseek(fd, 0, SEEK_SET); ++ uint32_t max_size = 40 * 1024 * 1024; // 40M ++ ++ ResourceMark rm; ++ char* buf = NEW_RESOURCE_ARRAY(char, max_size); ++ ++ while(file_size) { ++ uint32_t size = MIN2(max_size, file_size); ++ size_t n = os::read(fd, buf, (unsigned int)size); ++ file_size -= n; ++ cur_crc = ClassLoader::crc32(cur_crc, buf, n); ++ } ++ } ++ return cur_crc; ++} ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment) { + if (DynamicDumpSharedSpaces) { +- _magic = CDS_DYNAMIC_ARCHIVE_MAGIC; ++#if INCLUDE_AGGRESSIVE_CDS ++ if (UseAggressiveCDS) { ++ _magic = CDS_AGGRESSIVE_ARCHIVE_MAGIC; ++ } else ++#endif // INCLUDE_AGGRESSIVE_CDS ++ { ++ _magic = CDS_DYNAMIC_ARCHIVE_MAGIC; ++ } + } else { + _magic = CDS_ARCHIVE_MAGIC; + } +@@ -434,7 +477,11 @@ bool FileMapInfo::get_base_archive_name_from_header(const char* archive_name, + os::close(fd); + return false; + } ++#if INCLUDE_AGGRESSIVE_CDS ++ if (dynamic_header->magic() != (UseAggressiveCDS ? CDS_AGGRESSIVE_ARCHIVE_MAGIC : CDS_DYNAMIC_ARCHIVE_MAGIC)) { ++#else + if (dynamic_header->magic() != CDS_DYNAMIC_ARCHIVE_MAGIC) { ++#endif // INCLUDE_AGGRESSIVE_CDS + // Not a dynamic header, no need to proceed further. + *size = 0; + delete dynamic_header; +@@ -499,7 +546,11 @@ bool FileMapInfo::check_archive(const char* archive_name, bool is_static) { + } + } else { + DynamicArchiveHeader* dynamic_header = (DynamicArchiveHeader*)header; ++#if INCLUDE_AGGRESSIVE_CDS ++ if (dynamic_header->magic() != (UseAggressiveCDS ? CDS_AGGRESSIVE_ARCHIVE_MAGIC : CDS_DYNAMIC_ARCHIVE_MAGIC)) { ++#else + if (dynamic_header->magic() != CDS_DYNAMIC_ARCHIVE_MAGIC) { ++#endif // INCLUDE_AGGRESSIVE_CDS + delete header; + os::close(fd); + vm_exit_during_initialization("Not a top shared archive", archive_name); +diff --git a/hotspot/src/share/vm/memory/filemap.hpp b/hotspot/src/share/vm/memory/filemap.hpp +index f6cf43a64..c246f0367 100644 +--- a/hotspot/src/share/vm/memory/filemap.hpp ++++ b/hotspot/src/share/vm/memory/filemap.hpp +@@ -41,6 +41,7 @@ + + #define CDS_ARCHIVE_MAGIC 0xf00baba2 + #define CDS_DYNAMIC_ARCHIVE_MAGIC 0xf00baba8 ++#define CDS_AGGRESSIVE_ARCHIVE_MAGIC 0xf00baba4 + + static const int JVM_IDENT_MAX = 256; + +@@ -168,6 +169,9 @@ public: + struct DynamicArchiveHeader : FileMapHeader { + private: + int _base_header_crc; ++#if INCLUDE_AGGRESSIVE_CDS ++ int _program_crc; ++#endif // INCLUDE_AGGRESSIVE_CDS + int _base_region_crc[MetaspaceShared::n_regions]; + char* _requested_base_address; // Archive relocation is not necessary if we map with this base address. + size_t _ptrmap_size_in_bits; // Size of pointer relocation bitmap +@@ -186,6 +190,11 @@ public: + _base_region_crc[i] = c; + } + ++#if INCLUDE_AGGRESSIVE_CDS ++ int program_crc() const { return _program_crc; } ++ void set_program_crc(int c) { _program_crc = c; } ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + void set_requested_base(char* b) { + _requested_base_address = b; + } +@@ -199,6 +208,8 @@ public: + char* serialized_data() const { return from_mapped_offset(_serialized_data_offset); } + + virtual bool validate(); ++ ++ static int get_current_program_crc(); + }; + + FileMapHeader * _header; +diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp +index 55667ac32..2cc38cf66 100644 +--- a/hotspot/src/share/vm/prims/jvm.cpp ++++ b/hotspot/src/share/vm/prims/jvm.cpp +@@ -3321,6 +3321,36 @@ JVM_ENTRY(jint, JVM_AdaptiveHeapGetG1PeriodicGCLoadThreshold(JNIEnv *env, jclass + #endif + JVM_END + ++JVM_ENTRY(jclass, JVM_DefineTrustedSharedClass(JNIEnv *env, const char *name, jobject loader)) ++#if INCLUDE_AGGRESSIVE_CDS ++ assert(UseAggressiveCDS, "sanity"); ++ ++ TempNewSymbol class_name = NULL; ++ if (name != NULL) { ++ const int str_len = (int)strlen(name); ++ if (str_len > Symbol::max_length()) { ++ // It's impossible to create this class; the name cannot fit ++ // into the constant pool. ++ THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name); ++ } ++ class_name = SymbolTable::new_symbol(name, str_len, CHECK_NULL); ++ } ++ ++ ResourceMark rm(THREAD); ++ Handle class_loader (THREAD, JNIHandles::resolve(loader)); ++ InstanceKlass* k = SystemDictionaryShared::lookup_trusted_share_class(class_name, ++ class_loader, ++ CHECK_NULL); ++ if (k == NULL) { ++ return NULL; ++ } ++ ++ return (jclass) JNIHandles::make_local(THREAD, k->java_mirror()); ++#else ++ return NULL; ++#endif // INCLUDE_AGGRESSIVE_CDS ++JVM_END ++ + JVM_ENTRY(void, JVM_Yield(JNIEnv *env, jclass threadClass)) + JVMWrapper("JVM_Yield"); + if (os::dont_yield()) return; +diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h +index 0f22f7b12..46a65604c 100644 +--- a/hotspot/src/share/vm/prims/jvm.h ++++ b/hotspot/src/share/vm/prims/jvm.h +@@ -1598,6 +1598,12 @@ JNIEXPORT jint JNICALL + JVM_AdaptiveHeapGetG1PeriodicGCLoadThreshold(JNIEnv *env, jclass clazz); + + ++/** ++ * Define the trusted shared class. ++ */ ++JNIEXPORT jclass JNICALL ++JVM_DefineTrustedSharedClass(JNIEnv *env, const char *name, jobject loader); ++ + /* ========================================================================= + * The following defines a private JVM interface that the JDK can query + * for the JVM version and capabilities. sun.misc.Version defines +diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp +index 45fbc1423..557695791 100644 +--- a/hotspot/src/share/vm/runtime/arguments.cpp ++++ b/hotspot/src/share/vm/runtime/arguments.cpp +@@ -4356,6 +4356,11 @@ jint Arguments::apply_ergo() { + + ArgumentsExt::set_gc_specific_flags(); + ++#if INCLUDE_AGGRESSIVE_CDS ++ result = init_aggressive_cds_properties(); ++ if (result != JNI_OK) return result; ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + // Initialize Metaspace flags and alignments. + Metaspace::ergo_initialize(); + +@@ -4640,3 +4645,14 @@ bool Arguments::copy_expand_pid(const char* src, size_t srclen, + *b = '\0'; + return (p == src_end); // return false if not all of the source was copied + } ++ ++#if INCLUDE_AGGRESSIVE_CDS ++jint Arguments::init_aggressive_cds_properties() { ++ if (!is_dumping_archive() && SharedDynamicArchivePath != NULL && UseAggressiveCDS) { ++ bool added = false; ++ added = add_property("jdk.jbooster.aggressivecds.load=true"); ++ if (!added) return JNI_ENOMEM; ++ } ++ return JNI_OK; ++} ++#endif // INCLUDE_AGGRESSIVE_CDS +\ No newline at end of file +diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp +index 4f7232e48..fdd1d14b0 100644 +--- a/hotspot/src/share/vm/runtime/arguments.hpp ++++ b/hotspot/src/share/vm/runtime/arguments.hpp +@@ -576,6 +576,10 @@ class Arguments : AllStatic { + assert(Arguments::is_dumping_archive(), "dump time only"); + } + ++#if INCLUDE_AGGRESSIVE_CDS ++ static jint init_aggressive_cds_properties(); ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + static bool CompileMethod(char* className, char* methodName) { + return + methodExists( +diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp +index 77a4ff0b2..6aa53d2d2 100644 +--- a/hotspot/src/share/vm/runtime/globals.hpp ++++ b/hotspot/src/share/vm/runtime/globals.hpp +@@ -4119,6 +4119,14 @@ class CommandLineFlags { + product(bool, UseAppCDS, false, \ + "Enable Application Class Data Sharing (AppCDS)") \ + \ ++ experimental(bool, UseAggressiveCDS, false, \ ++ "An aggressive stratage to improve start-up " \ ++ "because we avoid decoding the classfile.") \ ++ \ ++ experimental(bool, CheckClassFileTimeStamp, true, \ ++ "Check whether the modification time of the" \ ++ "class file is changed during UseAggressiveCDS.") \ ++ \ + product(bool, EnableSplitVerifierForAppCDS, false, \ + "Enable Type Check (AppCDS)") \ + \ +diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp +index 599e1074d..f631c94c4 100644 +--- a/hotspot/src/share/vm/utilities/macros.hpp ++++ b/hotspot/src/share/vm/utilities/macros.hpp +@@ -106,6 +106,7 @@ + + #ifndef INCLUDE_CDS + #define INCLUDE_CDS 1 ++#define INCLUDE_AGGRESSIVE_CDS 1 + #endif + + #if INCLUDE_CDS +@@ -120,6 +121,14 @@ + #define NOT_CDS_RETURN_(code) { return code; } + #endif // INCLUDE_CDS + ++#if INCLUDE_AGGRESSIVE_CDS ++#define AGGRESSIVE_CDS_ONLY(x) x ++#define NOT_AGGRESSIVE_CDS(x) ++#else ++#define AGGRESSIVE_CDS_ONLY(x) ++#define NOT_AGGRESSIVE_CDS(x) x ++#endif // INCLUDE_AGGRESSIVE_CDS ++ + #ifndef INCLUDE_MANAGEMENT + #define INCLUDE_MANAGEMENT 1 + #endif // INCLUDE_MANAGEMENT +diff --git a/jdk/make/mapfiles/libjava/mapfile-linux b/jdk/make/mapfiles/libjava/mapfile-linux +index ae118af70..61ec28513 100644 +--- a/jdk/make/mapfiles/libjava/mapfile-linux ++++ b/jdk/make/mapfiles/libjava/mapfile-linux +@@ -129,6 +129,7 @@ SUNWprivate_1.1 { + Java_java_lang_ClassLoader_defineClass0; + Java_java_lang_ClassLoader_defineClass1; + Java_java_lang_ClassLoader_defineClass2; ++ Java_java_lang_ClassLoader_defineClass3; + Java_java_lang_ClassLoader_findBuiltinLib; + Java_java_lang_ClassLoader_findLoadedClass0; + Java_java_lang_ClassLoader_resolveClass0; +diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers +index 896db04f2..abfde04a9 100644 +--- a/jdk/make/mapfiles/libjava/mapfile-vers ++++ b/jdk/make/mapfiles/libjava/mapfile-vers +@@ -129,6 +129,7 @@ SUNWprivate_1.1 { + Java_java_lang_ClassLoader_defineClass0; + Java_java_lang_ClassLoader_defineClass1; + Java_java_lang_ClassLoader_defineClass2; ++ Java_java_lang_ClassLoader_defineClass3; + Java_java_lang_ClassLoader_findBuiltinLib; + Java_java_lang_ClassLoader_findLoadedClass0; + Java_java_lang_ClassLoader_resolveClass0; +diff --git a/jdk/src/share/classes/java/lang/ClassLoader.java b/jdk/src/share/classes/java/lang/ClassLoader.java +index f305c1e36..d659eff0f 100644 +--- a/jdk/src/share/classes/java/lang/ClassLoader.java ++++ b/jdk/src/share/classes/java/lang/ClassLoader.java +@@ -682,6 +682,20 @@ public abstract class ClassLoader { + } + } + ++ /** ++ * Determine protection domain, and check it. ++ * This method is only for AggressiveCDS. ++ * ++ * @param name the name of the class ++ * @param c the class ++ * @param pd the ProtectionDomain of the class ++ */ ++ private void defineClassProtectionDomain(String name, Class c, ProtectionDomain pd) ++ { ++ pd = preDefineClass(name, pd); ++ postDefineClass(c, pd); ++ } ++ + /** + * Converts an array of bytes into an instance of class Class, + * with an optional ProtectionDomain. If the domain is +@@ -857,6 +871,27 @@ public abstract class ClassLoader { + int off, int len, ProtectionDomain pd, + String source); + ++ /** ++ * This method is only invoked when java.net.AggressiveCDSPlugin enabled. ++ */ ++ private native Class defineClass3(String name); ++ ++ protected final Class defineClass(String name) { ++ Class trustedClass = defineClass3(name); ++ if (trustedClass != null) { ++ ProtectionDomain pd = AccessController.doPrivileged( ++ new PrivilegedAction() { ++ @Override ++ public ProtectionDomain run() { ++ return trustedClass.getProtectionDomain(); ++ } ++ } ++ ); ++ defineClassProtectionDomain(name, trustedClass, pd); ++ } ++ return trustedClass; ++ } ++ + // true if the name is null or has the potential to be a valid binary name + private boolean checkName(String name) { + if ((name == null) || (name.length() == 0)) +diff --git a/jdk/src/share/classes/java/net/AggressiveCDSPlugin.java b/jdk/src/share/classes/java/net/AggressiveCDSPlugin.java +new file mode 100644 +index 000000000..90d1cd78a +--- /dev/null ++++ b/jdk/src/share/classes/java/net/AggressiveCDSPlugin.java +@@ -0,0 +1,45 @@ ++/* ++ * Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++package java.net; ++ ++import java.security.AccessController; ++import sun.security.action.GetBooleanAction; ++ ++/** ++ * The Aggressive CDS plugin for {@link java.net.URLClassLoader}. ++ */ ++final class AggressiveCDSPlugin { ++ private static final boolean IS_ENABLED = ++ AccessController.doPrivileged( ++ new GetBooleanAction("jdk.jbooster.aggressivecds.load")); ++ ++ /** ++ * Check whether Aggressive CDS is enabled. ++ * ++ * @return Is Aggressive CDS enabled ++ */ ++ public static boolean isEnabled() { ++ return IS_ENABLED; ++ } ++} +\ No newline at end of file +diff --git a/jdk/src/share/classes/java/net/URLClassLoader.java b/jdk/src/share/classes/java/net/URLClassLoader.java +index 876a88842..495964ee7 100644 +--- a/jdk/src/share/classes/java/net/URLClassLoader.java ++++ b/jdk/src/share/classes/java/net/URLClassLoader.java +@@ -382,6 +382,17 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { + result = AccessController.doPrivileged( + new PrivilegedExceptionAction>() { + public Class run() throws ClassNotFoundException { ++ if (AggressiveCDSPlugin.isEnabled()) { ++ Class trustedClass = defineClass(name); ++ if (trustedClass != null) { ++ int i = name.lastIndexOf('.'); ++ if (i != -1) { ++ String pkgname = name.substring(0, i); ++ definePackageInternal(pkgname, null, null); ++ } ++ return trustedClass; ++ } ++ } + String path = name.replace('.', '/').concat(".class"); + Resource res = ucp.getResource(path, false); + if (res != null) { +@@ -409,6 +420,22 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { + return result; + } + ++ /** ++ * get ProtectionDomain By URL String. ++ * This method is invoked only in C++ for AggressiveCDS. ++ * ++ * @param urlNoFragString the URL String. ++ * ++ * @return ProtectionDomain create from URL. ++ */ ++ protected ProtectionDomain getProtectionDomainByURLString(String urlNoFragString) { ++ URL url = ucp.getURL(urlNoFragString); ++ if (url != null) { ++ return getProtectionDomainFromURL(url); ++ } ++ return null; ++ } ++ + /* + * Retrieve the package using the specified package name. + * If non-null, verify the package using the specified code +diff --git a/jdk/src/share/classes/java/security/ProtectionDomain.java b/jdk/src/share/classes/java/security/ProtectionDomain.java +index 7a86115e2..727dc4427 100644 +--- a/jdk/src/share/classes/java/security/ProtectionDomain.java ++++ b/jdk/src/share/classes/java/security/ProtectionDomain.java +@@ -25,6 +25,7 @@ + + package java.security; + ++import java.net.URL; + import java.util.ArrayList; + import java.util.Collections; + import java.util.Enumeration; +@@ -35,6 +36,7 @@ import sun.misc.JavaSecurityAccess; + import sun.misc.JavaSecurityProtectionDomainAccess; + import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache; + import sun.misc.SharedSecrets; ++import sun.net.util.URLUtil; + import sun.security.util.Debug; + import sun.security.util.SecurityConstants; + +@@ -206,6 +208,20 @@ public class ProtectionDomain { + return this.codesource; + } + ++ /** ++ * Returns a URL String. ++ * ++ * @return URL String. ++ */ ++ public String getLocationNoFragString() { ++ if (codesource != null) { ++ URL url = codesource.getLocation(); ++ if (url != null) { ++ return URLUtil.urlNoFragString(url); ++ } ++ } ++ return null; ++ } + + /** + * Returns the ClassLoader of this domain. +diff --git a/jdk/src/share/classes/java/security/SecureClassLoader.java b/jdk/src/share/classes/java/security/SecureClassLoader.java +index cb5f017ba..4b0570104 100644 +--- a/jdk/src/share/classes/java/security/SecureClassLoader.java ++++ b/jdk/src/share/classes/java/security/SecureClassLoader.java +@@ -215,6 +215,18 @@ public class SecureClassLoader extends ClassLoader { + return pd; + } + ++ /** ++ * get ProtectionDomain From URL. ++ * This method is only for AggressiveCDS. ++ * ++ * @param url the URL. ++ * ++ * @return ProtectionDomain create from URL. ++ */ ++ protected ProtectionDomain getProtectionDomainFromURL(URL url) { ++ CodeSource cs = new CodeSource(url, (CodeSigner[]) null); ++ return getProtectionDomain(cs); ++ } + + /* + * Check to make sure the class loader has been initialized. +diff --git a/jdk/src/share/classes/sun/misc/URLClassPath.java b/jdk/src/share/classes/sun/misc/URLClassPath.java +index 70a194f50..6b4987cf3 100644 +--- a/jdk/src/share/classes/sun/misc/URLClassPath.java ++++ b/jdk/src/share/classes/sun/misc/URLClassPath.java +@@ -255,6 +255,24 @@ public class URLClassPath { + return null; + } + ++ /** ++ * Finds the URL which has the specified name. ++ * This method is only for AggressiveCDS. ++ * ++ * @param urlNoFragString the name of URL ++ * @return the URL, or null if not found ++ */ ++ public URL getURL(String urlNoFragString) { ++ if (!urls.isEmpty()) { ++ int index = loaders.size(); ++ while(getLoader(index) != null) { ++ index++; ++ } ++ } ++ Loader loader = lmap.get(urlNoFragString); ++ return loader != null ? loader.getBaseURL() : null; ++ } ++ + /** + * Finds all resources on the URL search path with the given name. + * Returns an enumeration of the URL objects. +diff --git a/jdk/src/share/javavm/export/jvm.h b/jdk/src/share/javavm/export/jvm.h +index d27055622..c37f2ad34 100644 +--- a/jdk/src/share/javavm/export/jvm.h ++++ b/jdk/src/share/javavm/export/jvm.h +@@ -1441,6 +1441,11 @@ JVM_AdaptiveHeapSetG1PeriodicGCLoadThreshold(JNIEnv *env, jclass clazz, jint loa + JNIEXPORT jint JNICALL + JVM_AdaptiveHeapGetG1PeriodicGCLoadThreshold(JNIEnv *env, jclass clazz); + ++/** ++ * Define the trusted shared class. ++ */ ++JNIEXPORT jclass JNICALL ++JVM_DefineTrustedSharedClass(JNIEnv *env, const char *name, jobject loader); + + /* ========================================================================= + * The following defines a private JVM interface that the JDK can query +diff --git a/jdk/src/share/native/java/lang/ClassLoader.c b/jdk/src/share/native/java/lang/ClassLoader.c +index 40b0b85bc..a5515f72f 100644 +--- a/jdk/src/share/native/java/lang/ClassLoader.c ++++ b/jdk/src/share/native/java/lang/ClassLoader.c +@@ -224,6 +224,31 @@ Java_java_lang_ClassLoader_defineClass2(JNIEnv *env, + return result; + } + ++JNIEXPORT jclass JNICALL ++Java_java_lang_ClassLoader_defineClass3(JNIEnv *env, ++ jobject loader, ++ jstring name) ++{ ++ char *utfName; ++ jclass result = 0; ++ char buf[128]; ++ ++ if (name != NULL) { ++ utfName = getUTF(env, name, buf, sizeof(buf)); ++ if (utfName == NULL) { ++ JNU_ThrowOutOfMemoryError(env, NULL); ++ return result; ++ } ++ VerifyFixClassname(utfName); ++ } else { ++ utfName = NULL; ++ } ++ ++ result = JVM_DefineTrustedSharedClass(env, utfName, loader); ++ ++ return result; ++} ++ + JNIEXPORT void JNICALL + Java_java_lang_ClassLoader_resolveClass0(JNIEnv *env, jobject this, + jclass cls) +-- +2.23.0 + diff --git a/Huawei-Keep-objects-when-remove-unshareable-info.patch b/Huawei-Keep-objects-when-remove-unshareable-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..a6be5d65cec746c71616456ce6d3599365b2db8b --- /dev/null +++ b/Huawei-Keep-objects-when-remove-unshareable-info.patch @@ -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 + diff --git a/Huawei-improve-GCTR-performance.patch b/Huawei-improve-GCTR-performance.patch new file mode 100644 index 0000000000000000000000000000000000000000..cbd1992ed09b1e753190af22e5d175bbd739f458 --- /dev/null +++ b/Huawei-improve-GCTR-performance.patch @@ -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 + diff --git a/LoongArch64-support.patch b/LoongArch64-support.patch index e88f15f1da195c1ccfdee460aaaba4e26bb9f605..42052d7cfaef59af38f83a321e5dbd100fab6e55 100644 --- a/LoongArch64-support.patch +++ b/LoongArch64-support.patch @@ -1,7 +1,8 @@ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/common/autoconf/build-aux/autoconf-config.guess b/common/autoconf/build-aux/autoconf-config.guess ---- a/common/autoconf/build-aux/autoconf-config.guess 2024-01-11 09:53:23.000000000 +0800 -+++ b/common/autoconf/build-aux/autoconf-config.guess 2023-12-20 09:23:19.571483804 +0800 -@@ -977,6 +977,9 @@ +diff --git a/common/autoconf/build-aux/autoconf-config.guess b/common/autoconf/build-aux/autoconf-config.guess +index 15ee438926..3d7555b52d 100644 +--- a/common/autoconf/build-aux/autoconf-config.guess ++++ b/common/autoconf/build-aux/autoconf-config.guess +@@ -977,6 +977,9 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; @@ -11,10 +12,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/common/autoconf/build-aux/autoconf-config.sub b/common/autoconf/build-aux/autoconf-config.sub ---- a/common/autoconf/build-aux/autoconf-config.sub 2024-01-11 09:53:23.000000000 +0800 -+++ b/common/autoconf/build-aux/autoconf-config.sub 2023-12-20 09:23:19.574817100 +0800 -@@ -275,6 +275,7 @@ +diff --git a/common/autoconf/build-aux/autoconf-config.sub b/common/autoconf/build-aux/autoconf-config.sub +index 1aab2b303e..bd910bddbe 100644 +--- a/common/autoconf/build-aux/autoconf-config.sub ++++ b/common/autoconf/build-aux/autoconf-config.sub +@@ -275,6 +275,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ @@ -22,10 +24,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/common/autoconf/build-aux/config.guess b/common/autoconf/build-aux/config.guess ---- a/common/autoconf/build-aux/config.guess 2024-01-11 09:53:23.000000000 +0800 -+++ b/common/autoconf/build-aux/config.guess 2023-12-20 09:23:19.574817100 +0800 -@@ -86,4 +86,15 @@ +diff --git a/common/autoconf/build-aux/config.guess b/common/autoconf/build-aux/config.guess +index 288edb6e0e..13cd94bf1d 100644 +--- a/common/autoconf/build-aux/config.guess ++++ b/common/autoconf/build-aux/config.guess +@@ -86,6 +86,17 @@ if [ "x$OUT" = x ]; then fi fi @@ -40,10 +43,13 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo + fi +fi + - echo $OUT -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/common/autoconf/configure.ac b/common/autoconf/configure.ac ---- a/common/autoconf/configure.ac 2024-01-11 09:53:23.000000000 +0800 -+++ b/common/autoconf/configure.ac 2023-12-20 09:23:19.574817100 +0800 + # Test and fix LoongArch64. + if [ "x$OUT" = x ]; then + if [ `uname -s` = Linux ]; then +diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac +index 151e5a109f..5072409dd4 100644 +--- a/common/autoconf/configure.ac ++++ b/common/autoconf/configure.ac @@ -23,6 +23,12 @@ # questions. # @@ -57,7 +63,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo ############################################################################### # # Includes and boilerplate -@@ -186,6 +192,7 @@ +@@ -186,6 +192,7 @@ FLAGS_SETUP_INIT_FLAGS # Now we can test some aspects on the target using configure macros. PLATFORM_SETUP_OPENJDK_TARGET_BITS PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS @@ -65,10 +71,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo # Configure flags for the tools FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh ---- a/common/autoconf/generated-configure.sh 2024-01-11 09:53:23.000000000 +0800 -+++ b/common/autoconf/generated-configure.sh 2024-01-30 13:54:24.742709461 +0800 -@@ -716,6 +716,9 @@ +diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh +index 85eb8a16a2..86a533fe1f 100644 +--- a/common/autoconf/generated-configure.sh ++++ b/common/autoconf/generated-configure.sh +@@ -716,6 +716,9 @@ SET_EXECUTABLE_ORIGIN SHARED_LIBRARY_FLAGS CXX_FLAG_REORDER C_FLAG_REORDER @@ -78,7 +85,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo SYSROOT_LDFLAGS SYSROOT_CFLAGS RC_FLAGS -@@ -4069,6 +4072,12 @@ +@@ -4081,6 +4084,12 @@ fi # questions. # @@ -91,7 +98,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. # Converts autoconf style CPU name to OpenJDK style, into # VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN. -@@ -13918,6 +13927,18 @@ +@@ -13930,6 +13939,12 @@ test -n "$target_alias" && VAR_CPU_BITS=64 VAR_CPU_ENDIAN=big ;; @@ -101,16 +108,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; -+ loongarch64) -+ VAR_CPU=loongarch64 -+ VAR_CPU_ARCH=loongarch -+ VAR_CPU_BITS=64 -+ VAR_CPU_ENDIAN=little -+ ;; - *) - as_fn_error $? "unsupported cpu $build_cpu" "$LINENO" 5 - ;; -@@ -14056,6 +14077,18 @@ + loongarch64) + VAR_CPU=loongarch64 + VAR_CPU_ARCH=loongarch +@@ -14074,6 +14089,12 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; } VAR_CPU_BITS=64 VAR_CPU_ENDIAN=big ;; @@ -120,16 +121,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; -+ loongarch64) -+ VAR_CPU=loongarch64 -+ VAR_CPU_ARCH=loongarch -+ VAR_CPU_BITS=64 -+ VAR_CPU_ENDIAN=little -+ ;; - *) - as_fn_error $? "unsupported cpu $host_cpu" "$LINENO" 5 - ;; -@@ -14178,6 +14211,8 @@ + loongarch64) + VAR_CPU=loongarch64 + VAR_CPU_ARCH=loongarch +@@ -14202,6 +14223,8 @@ $as_echo "$COMPILE_TYPE" >&6; } OPENJDK_TARGET_CPU_LEGACY_LIB="i386" elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then OPENJDK_TARGET_CPU_LEGACY_LIB="amd64" @@ -138,7 +133,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo fi -@@ -14211,6 +14246,9 @@ +@@ -14235,6 +14258,9 @@ $as_echo "$COMPILE_TYPE" >&6; } elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then # On all platforms except macosx, we replace x86_64 with amd64. OPENJDK_TARGET_CPU_OSARCH="amd64" @@ -148,7 +143,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo fi -@@ -14220,6 +14258,8 @@ +@@ -14244,6 +14270,8 @@ $as_echo "$COMPILE_TYPE" >&6; } elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then # On all platforms except macosx, we replace x86_64 with amd64. OPENJDK_TARGET_CPU_JLI="amd64" @@ -157,7 +152,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo fi # Now setup the -D flags for building libjli. OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'" -@@ -14232,6 +14272,9 @@ +@@ -14256,6 +14284,9 @@ $as_echo "$COMPILE_TYPE" >&6; } elif test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$TOOLCHAIN_TYPE" = xclang ; then OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -stdlib=libc++ -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" fi @@ -167,7 +162,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. -@@ -42412,6 +42455,47 @@ +@@ -42436,6 +42467,47 @@ $as_echo "$ac_cv_c_bigendian" >&6; } fi @@ -215,9 +210,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo # Configure flags for the tools ############################################################################### -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 ---- a/common/autoconf/platform.m4 2024-01-11 09:53:23.000000000 +0800 -+++ b/common/autoconf/platform.m4 2023-12-20 09:23:19.581483690 +0800 +diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 +index f54942acf2..51cc28c312 100644 +--- a/common/autoconf/platform.m4 ++++ b/common/autoconf/platform.m4 @@ -23,6 +23,12 @@ # questions. # @@ -231,7 +227,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. # Converts autoconf style CPU name to OpenJDK style, into # VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN. -@@ -96,6 +102,18 @@ +@@ -96,6 +102,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], VAR_CPU_BITS=64 VAR_CPU_ENDIAN=big ;; @@ -241,16 +237,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; -+ loongarch64) -+ VAR_CPU=loongarch64 -+ VAR_CPU_ARCH=loongarch -+ VAR_CPU_BITS=64 -+ VAR_CPU_ENDIAN=little -+ ;; - *) - AC_MSG_ERROR([unsupported cpu $1]) - ;; -@@ -283,6 +301,8 @@ + loongarch64) + VAR_CPU=loongarch64 + VAR_CPU_ARCH=loongarch +@@ -289,6 +301,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], OPENJDK_TARGET_CPU_LEGACY_LIB="i386" elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then OPENJDK_TARGET_CPU_LEGACY_LIB="amd64" @@ -259,7 +249,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo fi AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB) -@@ -316,6 +336,9 @@ +@@ -322,6 +336,9 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then # On all platforms except macosx, we replace x86_64 with amd64. OPENJDK_TARGET_CPU_OSARCH="amd64" @@ -269,7 +259,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo fi AC_SUBST(OPENJDK_TARGET_CPU_OSARCH) -@@ -325,6 +348,8 @@ +@@ -331,6 +348,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then # On all platforms except macosx, we replace x86_64 with amd64. OPENJDK_TARGET_CPU_JLI="amd64" @@ -278,7 +268,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo fi # Now setup the -D flags for building libjli. OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'" -@@ -337,6 +362,9 @@ +@@ -343,6 +362,9 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], elif test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$TOOLCHAIN_TYPE" = xclang ; then OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -stdlib=libc++ -mmacosx-version-min=\$(MACOSX_VERSION_MIN)" fi @@ -288,7 +278,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS) # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. -@@ -550,3 +578,46 @@ +@@ -556,3 +578,46 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS], AC_MSG_ERROR([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)]) fi ]) @@ -335,23 +325,24 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo +AC_SUBST(BUILDER_NAME) +AC_SUBST(HOST_NAME) +]) -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in ---- a/common/autoconf/spec.gmk.in 2024-01-11 09:53:23.000000000 +0800 -+++ b/common/autoconf/spec.gmk.in 2024-01-30 13:54:24.742709461 +0800 +diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in +index 9573bb2cbd..57a903229a 100644 +--- a/common/autoconf/spec.gmk.in ++++ b/common/autoconf/spec.gmk.in @@ -23,6 +23,12 @@ # questions. # +# -+# This file has been modified by Loongson Technology in 2023. These -+# modifications are Copyright (c) 2018, 2023, Loongson Technology, and are made ++# This file has been modified by Loongson Technology in 2024. These ++# modifications are Copyright (c) 2018, 2024, Loongson Technology, and are made +# available on the same license terms set forth above. +# + # Configured @DATE_WHEN_CONFIGURED@ to build # for target system @OPENJDK_TARGET_OS@-@OPENJDK_TARGET_CPU@ # (called @OPENJDK_TARGET_AUTOCONF_NAME@ by autoconf) -@@ -219,6 +225,23 @@ +@@ -219,6 +225,23 @@ else endif JRE_RELEASE_VERSION:=$(FULL_VERSION) @@ -361,7 +352,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo +HOST_NAME:=@HOST_NAME@ + +# Loongson OpenJDK Version info -+VER=8.1.18 ++VER=8.1.19 +ifeq ($(HOST_NAME), ) + HOST_NAME=unknown +endif @@ -375,9 +366,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/commo # How to compile the code: release, fastdebug or slowdebug DEBUG_LEVEL:=@DEBUG_LEVEL@ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/make/saenv.sh b/hotspot/agent/make/saenv.sh ---- a/hotspot/agent/make/saenv.sh 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/make/saenv.sh 2023-12-20 09:23:19.681482545 +0800 +diff --git a/hotspot/agent/make/saenv.sh b/hotspot/agent/make/saenv.sh +index ab9a0a431c..a2de3fc329 100644 +--- a/hotspot/agent/make/saenv.sh ++++ b/hotspot/agent/make/saenv.sh @@ -23,6 +23,12 @@ # # @@ -391,7 +383,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # This file sets common environment variables for all SA scripts OS=`uname` -@@ -42,6 +48,14 @@ +@@ -42,6 +48,14 @@ if [ "$OS" = "Linux" ]; then SA_LIBPATH=$STARTDIR/../src/os/linux/amd64:$STARTDIR/linux/amd64 OPTIONS="-Dsa.library.path=$SA_LIBPATH" CPU=amd64 @@ -406,48 +398,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp else SA_LIBPATH=$STARTDIR/../src/os/linux/i386:$STARTDIR/linux/i386 OPTIONS="-Dsa.library.path=$SA_LIBPATH" -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/os/linux/libproc.h b/hotspot/agent/src/os/linux/libproc.h ---- a/hotspot/agent/src/os/linux/libproc.h 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/os/linux/libproc.h 2023-12-20 09:23:19.684815841 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2022. These -+ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #ifndef _LIBPROC_H_ - #define _LIBPROC_H_ - -@@ -36,7 +42,7 @@ - - #include - --#if defined(aarch64) -+#if defined(aarch64) || defined(loongarch64) - #include "asm/ptrace.h" - #endif - -@@ -76,7 +82,12 @@ - #include - #define user_regs_struct pt_regs - #endif --#if defined(aarch64) -+ -+#if defined(mips) || defined(mipsel) || defined(mips64) || defined(mips64el) -+#include -+#define user_regs_struct pt_regs -+#endif -+#if defined(aarch64) || defined(loongarch64) - #define user_regs_struct user_pt_regs - #endif - -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c b/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c ---- a/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c 2023-12-20 09:23:19.684815841 +0800 +diff --git a/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c b/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c +index d6a0c7d9a9..b3b1380b29 100644 +--- a/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c ++++ b/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c @@ -22,6 +22,13 @@ * */ @@ -481,7 +435,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp static jfieldID p_ps_prochandle_ID = 0; static jfieldID threadList_ID = 0; static jfieldID loadObjectList_ID = 0; -@@ -337,7 +352,7 @@ +@@ -337,7 +352,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo return (err == PS_OK)? array : 0; } @@ -490,20 +444,20 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0 (JNIEnv *env, jobject this_obj, jint lwp_id) { -@@ -365,6 +380,12 @@ +@@ -364,6 +379,12 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo + #endif #if defined(sparc) || defined(sparcv9) #define NPRGREG sun_jvm_hotspot_debugger_sparc_SPARCThreadContext_NPRGREG - #endif ++#endif +#ifdef loongarch64 +#define NPRGREG sun_jvm_hotspot_debugger_loongarch64_LOONGARCH64ThreadContext_NPRGREG +#endif +#if defined(mips64) || defined(mips64el) +#define NPRGREG sun_jvm_hotspot_debugger_mips64_MIPS64ThreadContext_NPRGREG -+#endif + #endif array = (*env)->NewLongArray(env, NPRGREG); - CHECK_EXCEPTION_(0); -@@ -470,6 +491,55 @@ +@@ -470,6 +491,55 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLo } #endif /* aarch64 */ @@ -559,9 +513,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp (*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT); return array; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/os/linux/Makefile b/hotspot/agent/src/os/linux/Makefile ---- a/hotspot/agent/src/os/linux/Makefile 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/os/linux/Makefile 2023-12-20 09:23:19.684815841 +0800 +diff --git a/hotspot/agent/src/os/linux/Makefile b/hotspot/agent/src/os/linux/Makefile +index c0b5c869c1..2cc50b6fab 100644 +--- a/hotspot/agent/src/os/linux/Makefile ++++ b/hotspot/agent/src/os/linux/Makefile @@ -22,7 +22,13 @@ # # @@ -577,7 +532,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp GCC = gcc JAVAH = ${JAVA_HOME}/bin/javah -@@ -53,6 +59,8 @@ +@@ -53,6 +59,8 @@ $(ARCH)/LinuxDebuggerLocal.o: LinuxDebuggerLocal.c $(JAVAH) -jni -classpath ../../../build/classes -d $(ARCH) \ sun.jvm.hotspot.debugger.x86.X86ThreadContext \ sun.jvm.hotspot.debugger.sparc.SPARCThreadContext \ @@ -586,9 +541,50 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext \ sun.jvm.hotspot.debugger.aarch64.AARCH64ThreadContext $(GCC) $(CFLAGS) $< -o $@ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/os/linux/ps_proc.c b/hotspot/agent/src/os/linux/ps_proc.c ---- a/hotspot/agent/src/os/linux/ps_proc.c 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/os/linux/ps_proc.c 2023-12-20 09:23:19.684815841 +0800 +diff --git a/hotspot/agent/src/os/linux/libproc.h b/hotspot/agent/src/os/linux/libproc.h +index 6b6e41cab4..5eb8211aa9 100644 +--- a/hotspot/agent/src/os/linux/libproc.h ++++ b/hotspot/agent/src/os/linux/libproc.h +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2022. These ++ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #ifndef _LIBPROC_H_ + #define _LIBPROC_H_ + +@@ -36,7 +42,7 @@ + + #include + +-#if defined(aarch64) ++#if defined(aarch64) || defined(loongarch64) + #include "asm/ptrace.h" + #endif + +@@ -76,7 +82,12 @@ combination of ptrace and /proc calls. + #include + #define user_regs_struct pt_regs + #endif +-#if defined(aarch64) ++ ++#if defined(mips) || defined(mipsel) || defined(mips64) || defined(mips64el) ++#include ++#define user_regs_struct pt_regs ++#endif ++#if defined(aarch64) || defined(loongarch64) + #define user_regs_struct user_pt_regs + #endif + +diff --git a/hotspot/agent/src/os/linux/ps_proc.c b/hotspot/agent/src/os/linux/ps_proc.c +index c4d6a9ecc5..7000e92723 100644 +--- a/hotspot/agent/src/os/linux/ps_proc.c ++++ b/hotspot/agent/src/os/linux/ps_proc.c @@ -22,6 +22,12 @@ * */ @@ -602,7 +598,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include #include #include -@@ -141,7 +147,7 @@ +@@ -141,7 +147,7 @@ static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct use #define PTRACE_GETREGS_REQ PT_GETREGS #endif @@ -611,10 +607,48 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp if (ptrace_getregs(PTRACE_GETREGS_REQ, pid, user, NULL) < 0) { print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid); return false; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java 2023-12-20 09:23:19.691482431 +0800 -@@ -94,6 +94,12 @@ +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java +index c963350591..20e6f35b9c 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2020. These ++ * modifications are Copyright (c) 2018, 2020, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ * ++ */ + package sun.jvm.hotspot; + + import java.rmi.RemoteException; +@@ -37,6 +43,8 @@ import sun.jvm.hotspot.debugger.MachineDescriptionIA64; + import sun.jvm.hotspot.debugger.MachineDescriptionIntelX86; + import sun.jvm.hotspot.debugger.MachineDescriptionSPARC32Bit; + import sun.jvm.hotspot.debugger.MachineDescriptionSPARC64Bit; ++import sun.jvm.hotspot.debugger.MachineDescriptionMIPS64; ++import sun.jvm.hotspot.debugger.MachineDescriptionLOONGARCH64; + import sun.jvm.hotspot.debugger.NoSuchSymbolException; + import sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal; + import sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal; +@@ -594,6 +602,10 @@ public class HotSpotAgent { + } else { + machDesc = new MachineDescriptionSPARC32Bit(); + } ++ } else if (cpu.equals("mips64")) { ++ machDesc = new MachineDescriptionMIPS64(); ++ } else if (cpu.equals("loongarch64")) { ++ machDesc = new MachineDescriptionLOONGARCH64(); + } else { + try { + machDesc = (MachineDescription) +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java +index 993bf7bb47..1e075aa57e 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java +@@ -94,6 +94,12 @@ public class Disassembler { } else if (arch.equals("amd64") || arch.equals("x86_64")) { path.append(sep + "lib" + sep + "amd64" + sep); libname += "-amd64.so"; @@ -627,10 +661,105 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } else { path.append(sep + "lib" + sep + arch + sep); libname += "-" + arch + ".so"; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java 2023-12-20 09:23:19.704815613 +0800 -@@ -32,11 +32,15 @@ +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionLOONGARCH64.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionLOONGARCH64.java +new file mode 100644 +index 0000000000..0531427dab +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionLOONGARCH64.java +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2018, 2020, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++package sun.jvm.hotspot.debugger; ++ ++public class MachineDescriptionLOONGARCH64 extends MachineDescriptionTwosComplement implements MachineDescription { ++ public long getAddressSize() { ++ return 8; ++ } ++ ++ ++ public boolean isBigEndian() { ++ return false; ++ } ++ ++ public boolean isLP64() { ++ return true; ++ } ++} +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionMIPS64.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionMIPS64.java +new file mode 100644 +index 0000000000..1b49efd201 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionMIPS64.java +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2018, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++package sun.jvm.hotspot.debugger; ++ ++public class MachineDescriptionMIPS64 extends MachineDescriptionTwosComplement implements MachineDescription { ++ public long getAddressSize() { ++ return 8; ++ } ++ ++ ++ public boolean isBigEndian() { ++ return "big".equals(System.getProperty("sun.cpu.endian")); ++ } ++ ++ public boolean isLP64() { ++ return true; ++ } ++} +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java +index f178d6a6e7..019e794bbb 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java +@@ -32,11 +32,15 @@ import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.x86.*; import sun.jvm.hotspot.debugger.amd64.*; import sun.jvm.hotspot.debugger.sparc.*; @@ -646,7 +775,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp import sun.jvm.hotspot.utilities.*; class LinuxCDebugger implements CDebugger { -@@ -106,6 +110,20 @@ +@@ -106,6 +110,20 @@ class LinuxCDebugger implements CDebugger { Address pc = context.getRegisterAsAddress(AARCH64ThreadContext.PC); if (pc == null) return null; return new LinuxAARCH64CFrame(dbg, fp, pc); @@ -667,10 +796,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } else { // Runtime exception thrown by LinuxThreadContextFactory if unknown cpu ThreadContext context = (ThreadContext) thread.getContext(); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java 2023-12-20 09:23:19.704815613 +0800 -@@ -30,6 +30,8 @@ +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java +index 44c2265d7a..3b6747ac0a 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java +@@ -30,6 +30,8 @@ import sun.jvm.hotspot.debugger.linux.amd64.*; import sun.jvm.hotspot.debugger.linux.ia64.*; import sun.jvm.hotspot.debugger.linux.x86.*; import sun.jvm.hotspot.debugger.linux.sparc.*; @@ -679,7 +809,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp class LinuxThreadContextFactory { static ThreadContext createThreadContext(LinuxDebugger dbg) { -@@ -42,6 +44,10 @@ +@@ -42,6 +44,10 @@ class LinuxThreadContextFactory { return new LinuxIA64ThreadContext(dbg); } else if (cpu.equals("sparc")) { return new LinuxSPARCThreadContext(dbg); @@ -690,9 +820,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } else { try { Class tcc = Class.forName("sun.jvm.hotspot.debugger.linux." + -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64CFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64CFrame.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64CFrame.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64CFrame.java 2023-12-20 09:23:19.704815613 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64CFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64CFrame.java +new file mode 100644 +index 0000000000..3b20dbbd87 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64CFrame.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. @@ -774,9 +906,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + private Address fp; + private LinuxDebugger dbg; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64ThreadContext.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64ThreadContext.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64ThreadContext.java 2023-12-20 09:23:19.704815613 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64ThreadContext.java +new file mode 100644 +index 0000000000..9f22133eaf +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/loongarch64/LinuxLOONGARCH64ThreadContext.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. @@ -825,9 +959,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return debugger.newAddress(getRegister(index)); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64CFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64CFrame.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64CFrame.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64CFrame.java 2023-12-20 09:23:19.704815613 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64CFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64CFrame.java +new file mode 100644 +index 0000000000..2e3eb564da +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64CFrame.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. @@ -909,9 +1045,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + private Address ebp; + private LinuxDebugger dbg; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64ThreadContext.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64ThreadContext.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64ThreadContext.java 2023-12-20 09:23:19.704815613 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64ThreadContext.java +new file mode 100644 +index 0000000000..98e0f3f0bc +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/mips64/LinuxMIPS64ThreadContext.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. @@ -960,9 +1098,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return debugger.newAddress(getRegister(index)); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/loongarch64/LOONGARCH64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/loongarch64/LOONGARCH64ThreadContext.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/loongarch64/LOONGARCH64ThreadContext.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/loongarch64/LOONGARCH64ThreadContext.java 2023-12-20 09:23:19.704815613 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/loongarch64/LOONGARCH64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/loongarch64/LOONGARCH64ThreadContext.java +new file mode 100644 +index 0000000000..90b0cf97e3 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/loongarch64/LOONGARCH64ThreadContext.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. @@ -1087,99 +1227,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + tie the implementation to, for example, the debugging system */ + public abstract Address getRegisterAsAddress(int index); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionLOONGARCH64.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionLOONGARCH64.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionLOONGARCH64.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionLOONGARCH64.java 2023-12-20 09:23:19.698149022 +0800 -@@ -0,0 +1,41 @@ -+/* -+ * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2018, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+package sun.jvm.hotspot.debugger; -+ -+public class MachineDescriptionLOONGARCH64 extends MachineDescriptionTwosComplement implements MachineDescription { -+ public long getAddressSize() { -+ return 8; -+ } -+ -+ -+ public boolean isBigEndian() { -+ return false; -+ } -+ -+ public boolean isLP64() { -+ return true; -+ } -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionMIPS64.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionMIPS64.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionMIPS64.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/MachineDescriptionMIPS64.java 2023-12-20 09:23:19.698149022 +0800 -@@ -0,0 +1,41 @@ -+/* -+ * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2018, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+package sun.jvm.hotspot.debugger; -+ -+public class MachineDescriptionMIPS64 extends MachineDescriptionTwosComplement implements MachineDescription { -+ public long getAddressSize() { -+ return 8; -+ } -+ -+ -+ public boolean isBigEndian() { -+ return "big".equals(System.getProperty("sun.cpu.endian")); -+ } -+ -+ public boolean isLP64() { -+ return true; -+ } -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/mips64/MIPS64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/mips64/MIPS64ThreadContext.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/mips64/MIPS64ThreadContext.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/mips64/MIPS64ThreadContext.java 2023-12-20 09:23:19.704815613 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/mips64/MIPS64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/mips64/MIPS64ThreadContext.java +new file mode 100644 +index 0000000000..c57ee9dfc9 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/mips64/MIPS64ThreadContext.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. @@ -1304,10 +1356,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + tie the implementation to, for example, the debugging system */ + public abstract Address getRegisterAsAddress(int index); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/posix/elf/ELFHeader.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/posix/elf/ELFHeader.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/posix/elf/ELFHeader.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/posix/elf/ELFHeader.java 2023-12-20 09:23:19.704815613 +0800 -@@ -63,6 +63,8 @@ +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/posix/elf/ELFHeader.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/posix/elf/ELFHeader.java +index 7113a3a497..24273888c2 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/posix/elf/ELFHeader.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/posix/elf/ELFHeader.java +@@ -63,6 +63,8 @@ public interface ELFHeader { public static final int ARCH_i860 = 7; /** MIPS architecture type. */ public static final int ARCH_MIPS = 8; @@ -1316,9 +1369,143 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp /** Returns a file type which is defined by the file type constants. */ public short getFileType(); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadContext.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadContext.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadContext.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java +index ca1a2575ff..2afa6c55f8 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java +@@ -34,10 +34,14 @@ import sun.jvm.hotspot.debugger.proc.amd64.*; + import sun.jvm.hotspot.debugger.proc.aarch64.*; + import sun.jvm.hotspot.debugger.proc.sparc.*; + import sun.jvm.hotspot.debugger.proc.x86.*; ++import sun.jvm.hotspot.debugger.proc.mips64.*; ++import sun.jvm.hotspot.debugger.proc.loongarch64.*; + import sun.jvm.hotspot.debugger.amd64.*; + import sun.jvm.hotspot.debugger.aarch64.*; + import sun.jvm.hotspot.debugger.sparc.*; + import sun.jvm.hotspot.debugger.x86.*; ++import sun.jvm.hotspot.debugger.mips64.*; ++import sun.jvm.hotspot.debugger.loongarch64.*; + import sun.jvm.hotspot.utilities.*; + + /**

An implementation of the JVMDebugger interface which sits on +@@ -92,6 +96,14 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger { + threadFactory = new ProcAARCH64ThreadFactory(this); + pcRegIndex = AARCH64ThreadContext.PC; + fpRegIndex = AARCH64ThreadContext.FP; ++ } else if (cpu.equals("mips64") || cpu.equals("mips64el")) { ++ threadFactory = new ProcMIPS64ThreadFactory(this); ++ pcRegIndex = MIPS64ThreadContext.PC; ++ fpRegIndex = MIPS64ThreadContext.FP; ++ } else if (cpu.equals("loongarch64")) { ++ threadFactory = new ProcLOONGARCH64ThreadFactory(this); ++ pcRegIndex = LOONGARCH64ThreadContext.PC; ++ fpRegIndex = LOONGARCH64ThreadContext.FP; + } else { + try { + Class tfc = Class.forName("sun.jvm.hotspot.debugger.proc." + +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64Thread.java +new file mode 100644 +index 0000000000..42a31e3486 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64Thread.java +@@ -0,0 +1,92 @@ ++/* ++ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++package sun.jvm.hotspot.debugger.proc.loongarch64; ++ ++import sun.jvm.hotspot.debugger.*; ++import sun.jvm.hotspot.debugger.loongarch64.*; ++import sun.jvm.hotspot.debugger.proc.*; ++import sun.jvm.hotspot.utilities.*; ++ ++public class ProcLOONGARCH64Thread implements ThreadProxy { ++ private ProcDebugger debugger; ++ private int id; ++ ++ public ProcLOONGARCH64Thread(ProcDebugger debugger, Address addr) { ++ this.debugger = debugger; ++ ++ // FIXME: the size here should be configurable. However, making it ++ // so would produce a dependency on the "types" package from the ++ // debugger package, which is not desired. ++ this.id = (int) addr.getCIntegerAt(0, 4, true); ++ } ++ ++ public ProcLOONGARCH64Thread(ProcDebugger debugger, long id) { ++ this.debugger = debugger; ++ this.id = (int) id; ++ } ++ ++ public ThreadContext getContext() throws IllegalThreadStateException { ++ ProcLOONGARCH64ThreadContext context = new ProcLOONGARCH64ThreadContext(debugger); ++ long[] regs = debugger.getThreadIntegerRegisterSet(id); ++ /* ++ _NGREG in reg.h is defined to be 19. Because we have included ++ debug registers LOONGARCH64ThreadContext.NPRGREG is 25. ++ */ ++ ++ if (Assert.ASSERTS_ENABLED) { ++ Assert.that(regs.length <= LOONGARCH64ThreadContext.NPRGREG, "size of register set is greater than " + LOONGARCH64ThreadContext.NPRGREG); ++ } ++ for (int i = 0; i < regs.length; i++) { ++ context.setRegister(i, regs[i]); ++ } ++ return context; ++ } ++ ++ public boolean canSetContext() throws DebuggerException { ++ return false; ++ } ++ ++ public void setContext(ThreadContext context) ++ throws IllegalThreadStateException, DebuggerException { ++ throw new DebuggerException("Unimplemented"); ++ } ++ ++ public String toString() { ++ return "t@" + id; ++ } ++ ++ public boolean equals(Object obj) { ++ if ((obj == null) || !(obj instanceof ProcLOONGARCH64Thread)) { ++ return false; ++ } ++ ++ return (((ProcLOONGARCH64Thread) obj).id == id); ++ } ++ ++ public int hashCode() { ++ return id; ++ } ++} +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadContext.java +new file mode 100644 +index 0000000000..9054f16506 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadContext.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. @@ -1367,9 +1554,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return debugger.newAddress(getRegister(index)); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadFactory.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadFactory.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadFactory.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadFactory.java +new file mode 100644 +index 0000000000..bc64335124 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64ThreadFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. @@ -1416,13 +1605,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return new ProcLOONGARCH64Thread(debugger, id); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64Thread.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64Thread.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/loongarch64/ProcLOONGARCH64Thread.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64Thread.java +new file mode 100644 +index 0000000000..5c1e0be893 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64Thread.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. ++ * Copyright (c) 2015, 2018, Loongson Technology. 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 @@ -1445,18 +1636,18 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+package sun.jvm.hotspot.debugger.proc.loongarch64; ++package sun.jvm.hotspot.debugger.proc.mips64; + +import sun.jvm.hotspot.debugger.*; -+import sun.jvm.hotspot.debugger.loongarch64.*; ++import sun.jvm.hotspot.debugger.mips64.*; +import sun.jvm.hotspot.debugger.proc.*; +import sun.jvm.hotspot.utilities.*; + -+public class ProcLOONGARCH64Thread implements ThreadProxy { ++public class ProcMIPS64Thread implements ThreadProxy { + private ProcDebugger debugger; + private int id; + -+ public ProcLOONGARCH64Thread(ProcDebugger debugger, Address addr) { ++ public ProcMIPS64Thread(ProcDebugger debugger, Address addr) { + this.debugger = debugger; + + // FIXME: the size here should be configurable. However, making it @@ -1465,21 +1656,21 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + this.id = (int) addr.getCIntegerAt(0, 4, true); + } + -+ public ProcLOONGARCH64Thread(ProcDebugger debugger, long id) { ++ public ProcMIPS64Thread(ProcDebugger debugger, long id) { + this.debugger = debugger; + this.id = (int) id; + } + + public ThreadContext getContext() throws IllegalThreadStateException { -+ ProcLOONGARCH64ThreadContext context = new ProcLOONGARCH64ThreadContext(debugger); ++ ProcMIPS64ThreadContext context = new ProcMIPS64ThreadContext(debugger); + long[] regs = debugger.getThreadIntegerRegisterSet(id); + /* + _NGREG in reg.h is defined to be 19. Because we have included -+ debug registers LOONGARCH64ThreadContext.NPRGREG is 25. ++ debug registers MIPS64ThreadContext.NPRGREG is 25. + */ + + if (Assert.ASSERTS_ENABLED) { -+ Assert.that(regs.length <= LOONGARCH64ThreadContext.NPRGREG, "size of register set is greater than " + LOONGARCH64ThreadContext.NPRGREG); ++ Assert.that(regs.length <= MIPS64ThreadContext.NPRGREG, "size of register set is greater than " + MIPS64ThreadContext.NPRGREG); + } + for (int i = 0; i < regs.length; i++) { + context.setRegister(i, regs[i]); @@ -1501,20 +1692,22 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } + + public boolean equals(Object obj) { -+ if ((obj == null) || !(obj instanceof ProcLOONGARCH64Thread)) { ++ if ((obj == null) || !(obj instanceof ProcMIPS64Thread)) { + return false; + } + -+ return (((ProcLOONGARCH64Thread) obj).id == id); ++ return (((ProcMIPS64Thread) obj).id == id); + } + + public int hashCode() { + return id; + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadContext.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadContext.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadContext.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadContext.java +new file mode 100644 +index 0000000000..d44223d768 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadContext.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. @@ -1563,9 +1756,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return debugger.newAddress(getRegister(index)); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadFactory.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadFactory.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadFactory.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadFactory.java +new file mode 100644 +index 0000000000..bad478fc5c +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64ThreadFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. @@ -1612,13 +1807,45 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return new ProcMIPS64Thread(debugger, id); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64Thread.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64Thread.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/mips64/ProcMIPS64Thread.java 2023-12-20 09:23:19.708148906 +0800 -@@ -0,0 +1,92 @@ +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java +index ffa61b548e..9cf3ee2da3 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java +@@ -33,6 +33,8 @@ import sun.jvm.hotspot.debugger.cdbg.*; + import sun.jvm.hotspot.debugger.remote.sparc.*; + import sun.jvm.hotspot.debugger.remote.x86.*; + import sun.jvm.hotspot.debugger.remote.amd64.*; ++import sun.jvm.hotspot.debugger.remote.mips64.*; ++import sun.jvm.hotspot.debugger.remote.loongarch64.*; + + /** An implementation of Debugger which wraps a + RemoteDebugger, providing remote debugging via RMI. +@@ -70,6 +72,16 @@ public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger { + cachePageSize = 4096; + cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); + unalignedAccessesOkay = true; ++ } else if (cpu.equals("mips64") || cpu.equals("mips64el")) { ++ threadFactory = new RemoteMIPS64ThreadFactory(this); ++ cachePageSize = 4096; ++ cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); ++ unalignedAccessesOkay = true; ++ } else if (cpu.equals("loongarch64")) { ++ threadFactory = new RemoteLOONGARCH64ThreadFactory(this); ++ cachePageSize = 4096; ++ cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); ++ unalignedAccessesOkay = true; + } else { + try { + Class tf = Class.forName("sun.jvm.hotspot.debugger.remote." + +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64Thread.java +new file mode 100644 +index 0000000000..01e3f8954b +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64Thread.java +@@ -0,0 +1,54 @@ +/* -+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2018, Loongson Technology. All rights reserved. ++ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. 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 @@ -1641,109 +1868,40 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+package sun.jvm.hotspot.debugger.proc.mips64; ++package sun.jvm.hotspot.debugger.remote.loongarch64; + +import sun.jvm.hotspot.debugger.*; -+import sun.jvm.hotspot.debugger.mips64.*; -+import sun.jvm.hotspot.debugger.proc.*; ++import sun.jvm.hotspot.debugger.loongarch64.*; ++import sun.jvm.hotspot.debugger.remote.*; +import sun.jvm.hotspot.utilities.*; + -+public class ProcMIPS64Thread implements ThreadProxy { -+ private ProcDebugger debugger; -+ private int id; -+ -+ public ProcMIPS64Thread(ProcDebugger debugger, Address addr) { -+ this.debugger = debugger; -+ -+ // FIXME: the size here should be configurable. However, making it -+ // so would produce a dependency on the "types" package from the -+ // debugger package, which is not desired. -+ this.id = (int) addr.getCIntegerAt(0, 4, true); ++public class RemoteLOONGARCH64Thread extends RemoteThread { ++ public RemoteLOONGARCH64Thread(RemoteDebuggerClient debugger, Address addr) { ++ super(debugger, addr); + } + -+ public ProcMIPS64Thread(ProcDebugger debugger, long id) { -+ this.debugger = debugger; -+ this.id = (int) id; ++ public RemoteLOONGARCH64Thread(RemoteDebuggerClient debugger, long id) { ++ super(debugger, id); + } + + public ThreadContext getContext() throws IllegalThreadStateException { -+ ProcMIPS64ThreadContext context = new ProcMIPS64ThreadContext(debugger); -+ long[] regs = debugger.getThreadIntegerRegisterSet(id); -+ /* -+ _NGREG in reg.h is defined to be 19. Because we have included -+ debug registers MIPS64ThreadContext.NPRGREG is 25. -+ */ -+ ++ RemoteLOONGARCH64ThreadContext context = new RemoteLOONGARCH64ThreadContext(debugger); ++ long[] regs = (addr != null)? debugger.getThreadIntegerRegisterSet(addr) : ++ debugger.getThreadIntegerRegisterSet(id); + if (Assert.ASSERTS_ENABLED) { -+ Assert.that(regs.length <= MIPS64ThreadContext.NPRGREG, "size of register set is greater than " + MIPS64ThreadContext.NPRGREG); ++ Assert.that(regs.length == LOONGARCH64ThreadContext.NPRGREG, "size of register set must match"); + } + for (int i = 0; i < regs.length; i++) { + context.setRegister(i, regs[i]); + } + return context; + } -+ -+ public boolean canSetContext() throws DebuggerException { -+ return false; -+ } -+ -+ public void setContext(ThreadContext context) -+ throws IllegalThreadStateException, DebuggerException { -+ throw new DebuggerException("Unimplemented"); -+ } -+ -+ public String toString() { -+ return "t@" + id; -+ } -+ -+ public boolean equals(Object obj) { -+ if ((obj == null) || !(obj instanceof ProcMIPS64Thread)) { -+ return false; -+ } -+ -+ return (((ProcMIPS64Thread) obj).id == id); -+ } -+ -+ public int hashCode() { -+ return id; -+ } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java 2023-12-20 09:23:19.708148906 +0800 -@@ -34,10 +34,14 @@ - import sun.jvm.hotspot.debugger.proc.aarch64.*; - import sun.jvm.hotspot.debugger.proc.sparc.*; - import sun.jvm.hotspot.debugger.proc.x86.*; -+import sun.jvm.hotspot.debugger.proc.mips64.*; -+import sun.jvm.hotspot.debugger.proc.loongarch64.*; - import sun.jvm.hotspot.debugger.amd64.*; - import sun.jvm.hotspot.debugger.aarch64.*; - import sun.jvm.hotspot.debugger.sparc.*; - import sun.jvm.hotspot.debugger.x86.*; -+import sun.jvm.hotspot.debugger.mips64.*; -+import sun.jvm.hotspot.debugger.loongarch64.*; - import sun.jvm.hotspot.utilities.*; - - /**

An implementation of the JVMDebugger interface which sits on -@@ -92,6 +96,14 @@ - threadFactory = new ProcAARCH64ThreadFactory(this); - pcRegIndex = AARCH64ThreadContext.PC; - fpRegIndex = AARCH64ThreadContext.FP; -+ } else if (cpu.equals("mips64") || cpu.equals("mips64el")) { -+ threadFactory = new ProcMIPS64ThreadFactory(this); -+ pcRegIndex = MIPS64ThreadContext.PC; -+ fpRegIndex = MIPS64ThreadContext.FP; -+ } else if (cpu.equals("loongarch64")) { -+ threadFactory = new ProcLOONGARCH64ThreadFactory(this); -+ pcRegIndex = LOONGARCH64ThreadContext.PC; -+ fpRegIndex = LOONGARCH64ThreadContext.FP; - } else { - try { - Class tfc = Class.forName("sun.jvm.hotspot.debugger.proc." + -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadContext.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadContext.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadContext.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadContext.java +new file mode 100644 +index 0000000000..ad25bccc8d +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadContext.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. @@ -1796,9 +1954,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return debugger.newAddress(getRegister(index)); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadFactory.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadFactory.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadFactory.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadFactory.java +new file mode 100644 +index 0000000000..d8bf50ea5b +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64ThreadFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. @@ -1845,13 +2005,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return new RemoteLOONGARCH64Thread(debugger, id); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64Thread.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64Thread.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/loongarch64/RemoteLOONGARCH64Thread.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64Thread.java +new file mode 100644 +index 0000000000..a9285a3b94 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64Thread.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. ++ * Copyright (c) 2015, 2018, Loongson Technology. 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 @@ -1874,28 +2036,28 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+package sun.jvm.hotspot.debugger.remote.loongarch64; ++package sun.jvm.hotspot.debugger.remote.mips64; + +import sun.jvm.hotspot.debugger.*; -+import sun.jvm.hotspot.debugger.loongarch64.*; ++import sun.jvm.hotspot.debugger.mips64.*; +import sun.jvm.hotspot.debugger.remote.*; +import sun.jvm.hotspot.utilities.*; + -+public class RemoteLOONGARCH64Thread extends RemoteThread { -+ public RemoteLOONGARCH64Thread(RemoteDebuggerClient debugger, Address addr) { ++public class RemoteMIPS64Thread extends RemoteThread { ++ public RemoteMIPS64Thread(RemoteDebuggerClient debugger, Address addr) { + super(debugger, addr); + } + -+ public RemoteLOONGARCH64Thread(RemoteDebuggerClient debugger, long id) { ++ public RemoteMIPS64Thread(RemoteDebuggerClient debugger, long id) { + super(debugger, id); + } + + public ThreadContext getContext() throws IllegalThreadStateException { -+ RemoteLOONGARCH64ThreadContext context = new RemoteLOONGARCH64ThreadContext(debugger); ++ RemoteMIPS64ThreadContext context = new RemoteMIPS64ThreadContext(debugger); + long[] regs = (addr != null)? debugger.getThreadIntegerRegisterSet(addr) : + debugger.getThreadIntegerRegisterSet(id); + if (Assert.ASSERTS_ENABLED) { -+ Assert.that(regs.length == LOONGARCH64ThreadContext.NPRGREG, "size of register set must match"); ++ Assert.that(regs.length == MIPS64ThreadContext.NPRGREG, "size of register set must match"); + } + for (int i = 0; i < regs.length; i++) { + context.setRegister(i, regs[i]); @@ -1903,9 +2065,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return context; + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadContext.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadContext.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadContext.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadContext.java +new file mode 100644 +index 0000000000..4d711f9ba7 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadContext.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. @@ -1958,9 +2122,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return debugger.newAddress(getRegister(index)); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadFactory.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadFactory.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadFactory.java 2023-12-20 09:23:19.708148906 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadFactory.java +new file mode 100644 +index 0000000000..020a2f1ff9 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64ThreadFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. @@ -2007,132 +2173,35 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return new RemoteMIPS64Thread(debugger, id); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64Thread.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64Thread.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/mips64/RemoteMIPS64Thread.java 2023-12-20 09:23:19.708148906 +0800 -@@ -0,0 +1,54 @@ -+/* -+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2018, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+package sun.jvm.hotspot.debugger.remote.mips64; -+ -+import sun.jvm.hotspot.debugger.*; -+import sun.jvm.hotspot.debugger.mips64.*; -+import sun.jvm.hotspot.debugger.remote.*; -+import sun.jvm.hotspot.utilities.*; -+ -+public class RemoteMIPS64Thread extends RemoteThread { -+ public RemoteMIPS64Thread(RemoteDebuggerClient debugger, Address addr) { -+ super(debugger, addr); -+ } -+ -+ public RemoteMIPS64Thread(RemoteDebuggerClient debugger, long id) { -+ super(debugger, id); -+ } -+ -+ public ThreadContext getContext() throws IllegalThreadStateException { -+ RemoteMIPS64ThreadContext context = new RemoteMIPS64ThreadContext(debugger); -+ long[] regs = (addr != null)? debugger.getThreadIntegerRegisterSet(addr) : -+ debugger.getThreadIntegerRegisterSet(id); -+ if (Assert.ASSERTS_ENABLED) { -+ Assert.that(regs.length == MIPS64ThreadContext.NPRGREG, "size of register set must match"); -+ } -+ for (int i = 0; i < regs.length; i++) { -+ context.setRegister(i, regs[i]); -+ } -+ return context; -+ } -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java 2023-12-20 09:23:19.708148906 +0800 -@@ -33,6 +33,8 @@ - import sun.jvm.hotspot.debugger.remote.sparc.*; - import sun.jvm.hotspot.debugger.remote.x86.*; - import sun.jvm.hotspot.debugger.remote.amd64.*; -+import sun.jvm.hotspot.debugger.remote.mips64.*; -+import sun.jvm.hotspot.debugger.remote.loongarch64.*; - - /** An implementation of Debugger which wraps a - RemoteDebugger, providing remote debugging via RMI. -@@ -70,6 +72,16 @@ - cachePageSize = 4096; - cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); - unalignedAccessesOkay = true; -+ } else if (cpu.equals("mips64") || cpu.equals("mips64el")) { -+ threadFactory = new RemoteMIPS64ThreadFactory(this); -+ cachePageSize = 4096; -+ cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); -+ unalignedAccessesOkay = true; -+ } else if (cpu.equals("loongarch64")) { -+ threadFactory = new RemoteLOONGARCH64ThreadFactory(this); -+ cachePageSize = 4096; -+ cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); -+ unalignedAccessesOkay = true; - } else { - try { - Class tf = Class.forName("sun.jvm.hotspot.debugger.remote." + -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java 2023-12-20 09:23:19.691482431 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2020. These -+ * modifications are Copyright (c) 2018, 2020, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ * -+ */ - package sun.jvm.hotspot; - - import java.rmi.RemoteException; -@@ -37,6 +43,8 @@ - import sun.jvm.hotspot.debugger.MachineDescriptionIntelX86; - import sun.jvm.hotspot.debugger.MachineDescriptionSPARC32Bit; - import sun.jvm.hotspot.debugger.MachineDescriptionSPARC64Bit; -+import sun.jvm.hotspot.debugger.MachineDescriptionMIPS64; -+import sun.jvm.hotspot.debugger.MachineDescriptionLOONGARCH64; - import sun.jvm.hotspot.debugger.NoSuchSymbolException; - import sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal; - import sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal; -@@ -594,6 +602,10 @@ +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java +index 842a3b357d..81efdd02f8 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java +@@ -34,6 +34,8 @@ import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess; + import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess; + import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess; + import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess; ++import sun.jvm.hotspot.runtime.linux_mips64.LinuxMIPS64JavaThreadPDAccess; ++import sun.jvm.hotspot.runtime.linux_loongarch64.LinuxLOONGARCH64JavaThreadPDAccess; + import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess; + import sun.jvm.hotspot.runtime.linux_aarch64.LinuxAARCH64JavaThreadPDAccess; + import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess; +@@ -90,6 +92,10 @@ public class Threads { + access = new LinuxSPARCJavaThreadPDAccess(); + } else if (cpu.equals("aarch64")) { + access = new LinuxAARCH64JavaThreadPDAccess(); ++ } else if (cpu.equals("mips64")) { ++ access = new LinuxMIPS64JavaThreadPDAccess(); ++ } else if (cpu.equals("loongarch64")) { ++ access = new LinuxLOONGARCH64JavaThreadPDAccess(); } else { - machDesc = new MachineDescriptionSPARC32Bit(); - } -+ } else if (cpu.equals("mips64")) { -+ machDesc = new MachineDescriptionMIPS64(); -+ } else if (cpu.equals("loongarch64")) { -+ machDesc = new MachineDescriptionLOONGARCH64(); - } else { - try { - machDesc = (MachineDescription) -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_loongarch64/LinuxLOONGARCH64JavaThreadPDAccess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_loongarch64/LinuxLOONGARCH64JavaThreadPDAccess.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_loongarch64/LinuxLOONGARCH64JavaThreadPDAccess.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_loongarch64/LinuxLOONGARCH64JavaThreadPDAccess.java 2023-12-20 09:23:19.738148563 +0800 + try { + access = (JavaThreadPDAccess) +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_loongarch64/LinuxLOONGARCH64JavaThreadPDAccess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_loongarch64/LinuxLOONGARCH64JavaThreadPDAccess.java +new file mode 100644 +index 0000000000..77c45c2e99 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_loongarch64/LinuxLOONGARCH64JavaThreadPDAccess.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. @@ -2267,9 +2336,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return debugger.getThreadForIdentifierAddress(threadIdAddr); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_mips64/LinuxMIPS64JavaThreadPDAccess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_mips64/LinuxMIPS64JavaThreadPDAccess.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_mips64/LinuxMIPS64JavaThreadPDAccess.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_mips64/LinuxMIPS64JavaThreadPDAccess.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_mips64/LinuxMIPS64JavaThreadPDAccess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_mips64/LinuxMIPS64JavaThreadPDAccess.java +new file mode 100644 +index 0000000000..a0fd73fa67 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_mips64/LinuxMIPS64JavaThreadPDAccess.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. @@ -2403,9 +2474,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return debugger.getThreadForIdentifierAddress(threadIdAddr); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64CurrentFrameGuess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64CurrentFrameGuess.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64CurrentFrameGuess.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64CurrentFrameGuess.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64CurrentFrameGuess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64CurrentFrameGuess.java +new file mode 100644 +index 0000000000..0208e6e224 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64CurrentFrameGuess.java @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. @@ -2624,9 +2697,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + pcFound = pc; + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64Frame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64Frame.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64Frame.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64Frame.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64Frame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64Frame.java +new file mode 100644 +index 0000000000..fdf0c79c1a +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64Frame.java @@ -0,0 +1,534 @@ +/* + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. @@ -3162,9 +3237,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64JavaCallWrapper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64JavaCallWrapper.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64JavaCallWrapper.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64JavaCallWrapper.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64JavaCallWrapper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64JavaCallWrapper.java +new file mode 100644 +index 0000000000..f7dbbcaacd +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64JavaCallWrapper.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. @@ -3223,9 +3300,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return lastJavaFPField.getValue(addr.addOffsetTo(anchorField.getOffset())); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64RegisterMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64RegisterMap.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64RegisterMap.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64RegisterMap.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64RegisterMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64RegisterMap.java +new file mode 100644 +index 0000000000..021ef523e3 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/loongarch64/LOONGARCH64RegisterMap.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. @@ -3279,9 +3358,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + protected void initializeFromPD(RegisterMap map) {} + protected Address getLocationPD(VMReg reg) { return null; } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64CurrentFrameGuess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64CurrentFrameGuess.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64CurrentFrameGuess.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64CurrentFrameGuess.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64CurrentFrameGuess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64CurrentFrameGuess.java +new file mode 100644 +index 0000000000..21259a4d32 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64CurrentFrameGuess.java @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. @@ -3500,9 +3581,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + pcFound = pc; + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64Frame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64Frame.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64Frame.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64Frame.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64Frame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64Frame.java +new file mode 100644 +index 0000000000..0cc5cf4e7c +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64Frame.java @@ -0,0 +1,547 @@ +/* + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. @@ -4051,9 +4134,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64JavaCallWrapper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64JavaCallWrapper.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64JavaCallWrapper.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64JavaCallWrapper.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64JavaCallWrapper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64JavaCallWrapper.java +new file mode 100644 +index 0000000000..81fcb5b568 +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64JavaCallWrapper.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. @@ -4112,9 +4197,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return lastJavaFPField.getValue(addr.addOffsetTo(anchorField.getOffset())); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64RegisterMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64RegisterMap.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64RegisterMap.java 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64RegisterMap.java 2023-12-20 09:23:19.738148563 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64RegisterMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64RegisterMap.java +new file mode 100644 +index 0000000000..648503792d +--- /dev/null ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/mips64/MIPS64RegisterMap.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. @@ -4168,32 +4255,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + protected void initializeFromPD(RegisterMap map) {} + protected Address getLocationPD(VMReg reg) { return null; } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java 2023-12-20 09:23:19.734815268 +0800 -@@ -34,6 +34,8 @@ - import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess; - import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess; - import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess; -+import sun.jvm.hotspot.runtime.linux_mips64.LinuxMIPS64JavaThreadPDAccess; -+import sun.jvm.hotspot.runtime.linux_loongarch64.LinuxLOONGARCH64JavaThreadPDAccess; - import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess; - import sun.jvm.hotspot.runtime.linux_aarch64.LinuxAARCH64JavaThreadPDAccess; - import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess; -@@ -90,6 +92,10 @@ - access = new LinuxSPARCJavaThreadPDAccess(); - } else if (cpu.equals("aarch64")) { - access = new LinuxAARCH64JavaThreadPDAccess(); -+ } else if (cpu.equals("mips64")) { -+ access = new LinuxMIPS64JavaThreadPDAccess(); -+ } else if (cpu.equals("loongarch64")) { -+ access = new LinuxLOONGARCH64JavaThreadPDAccess(); - } else { - try { - access = (JavaThreadPDAccess) -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java ---- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java 2023-12-20 09:23:19.748148449 +0800 +diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java +index aa69257866..9c97d09bc3 100644 +--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java ++++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java @@ -22,6 +22,13 @@ * */ @@ -4208,7 +4273,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp package sun.jvm.hotspot.utilities; /** Provides canonicalized OS and CPU information for the rest of the -@@ -65,6 +72,10 @@ +@@ -65,6 +72,10 @@ public class PlatformInfo { return cpu; } else if (cpu.equals("aarch64")) { return cpu; @@ -4219,9 +4284,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } else { try { Class pic = Class.forName("sun.jvm.hotspot.utilities.PlatformInfoClosed"); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/defs.make b/hotspot/make/defs.make ---- a/hotspot/make/defs.make 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/defs.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/defs.make b/hotspot/make/defs.make +index a3573da56f..6e93182c92 100644 +--- a/hotspot/make/defs.make ++++ b/hotspot/make/defs.make @@ -22,6 +22,12 @@ # # @@ -4235,7 +4301,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # The common definitions for hotspot builds. # Optionally include SPEC file generated by configure. -@@ -285,7 +291,7 @@ +@@ -285,7 +291,7 @@ ifneq ($(OSNAME),windows) # Use uname output for SRCARCH, but deal with platform differences. If ARCH # is not explicitly listed below, it is treated as x86. @@ -4244,7 +4310,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp ARCH/ = x86 ARCH/sparc = sparc ARCH/sparc64= sparc -@@ -295,6 +301,10 @@ +@@ -295,6 +301,10 @@ ifneq ($(OSNAME),windows) ARCH/ppc64 = ppc ARCH/ppc64le= ppc ARCH/ppc = ppc @@ -4255,7 +4321,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp ARCH/zero = zero ARCH/aarch64 = aarch64 -@@ -317,6 +327,20 @@ +@@ -317,6 +327,20 @@ ifneq ($(OSNAME),windows) BUILDARCH = ppc64 endif endif @@ -4276,7 +4342,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # LIBARCH is 1:1 mapping from BUILDARCH, except for ARCH=ppc64le ifeq ($(ARCH),ppc64le) -@@ -332,9 +356,18 @@ +@@ -332,9 +356,18 @@ ifneq ($(OSNAME),windows) LIBARCH/sparcv9 = sparcv9 LIBARCH/ia64 = ia64 LIBARCH/ppc64 = ppc64 @@ -4296,10 +4362,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp endif # Required make macro settings for all platforms -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/Makefile b/hotspot/make/linux/Makefile ---- a/hotspot/make/linux/Makefile 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/linux/Makefile 2023-12-20 09:23:19.761481629 +0800 -@@ -74,6 +74,10 @@ +diff --git a/hotspot/make/linux/Makefile b/hotspot/make/linux/Makefile +index e8f2010412..5aff01e87d 100644 +--- a/hotspot/make/linux/Makefile ++++ b/hotspot/make/linux/Makefile +@@ -74,6 +74,10 @@ ifneq (,$(findstring $(ARCH), ppc ppc64)) FORCE_TIERED=0 endif endif @@ -4310,9 +4377,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp ifdef LP64 ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make ---- a/hotspot/make/linux/makefiles/defs.make 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/linux/makefiles/defs.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make +index ec414639d2..9ade73ab34 100644 +--- a/hotspot/make/linux/makefiles/defs.make ++++ b/hotspot/make/linux/makefiles/defs.make @@ -22,6 +22,12 @@ # # @@ -4326,7 +4394,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # The common definitions for hotspot linux builds. # Include the top level defs.make under make directory instead of this one. # This file is included into make/defs.make. -@@ -39,6 +45,18 @@ +@@ -39,6 +45,18 @@ ifndef ARCH ARCH := ppc64 endif endif @@ -4345,7 +4413,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp PATH_SEP ?= : -@@ -83,6 +101,36 @@ +@@ -83,6 +101,36 @@ ifneq (,$(findstring $(ARCH), sparc)) HS_ARCH = sparc endif @@ -4382,7 +4450,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # i686/i586 and amd64/x86_64 ifneq (,$(findstring $(ARCH), amd64 x86_64 i686 i586)) ifeq ($(ARCH_DATA_MODEL), 64) -@@ -311,16 +359,24 @@ +@@ -311,16 +359,24 @@ ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ $(EXPORT_LIB_DIR)/sa-jdi.jar ADD_SA_BINARIES/aarch64 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ $(EXPORT_LIB_DIR)/sa-jdi.jar @@ -4407,9 +4475,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp endif endif endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make ---- a/hotspot/make/linux/makefiles/gcc.make 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/linux/makefiles/gcc.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make +index 7dde7f0963..94c6d1d015 100644 +--- a/hotspot/make/linux/makefiles/gcc.make ++++ b/hotspot/make/linux/makefiles/gcc.make @@ -22,6 +22,12 @@ # # @@ -4423,7 +4492,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #------------------------------------------------------------------------ # CC, CXX & AS -@@ -177,6 +183,9 @@ +@@ -177,6 +183,9 @@ ARCHFLAG/aarch64 = ARCHFLAG/ia64 = ARCHFLAG/sparc = -m32 -mcpu=v9 ARCHFLAG/sparcv9 = -m64 -mcpu=v9 @@ -4433,7 +4502,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp ARCHFLAG/zero = $(ZERO_ARCHFLAG) ARCHFLAG/ppc64 = -m64 -@@ -202,7 +211,7 @@ +@@ -202,7 +211,7 @@ else endif # Compiler warnings are treated as errors @@ -4442,9 +4511,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp ifeq ($(USE_CLANG), true) # However we need to clean the code up before we can unrestrictedly enable this option with Clang -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/makefiles/loongarch64.make b/hotspot/make/linux/makefiles/loongarch64.make ---- a/hotspot/make/linux/makefiles/loongarch64.make 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/make/linux/makefiles/loongarch64.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/makefiles/loongarch64.make b/hotspot/make/linux/makefiles/loongarch64.make +new file mode 100644 +index 0000000000..9e3cdb6f23 +--- /dev/null ++++ b/hotspot/make/linux/makefiles/loongarch64.make @@ -0,0 +1,43 @@ +# +# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. @@ -4489,9 +4560,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +CFLAGS += -fno-omit-frame-pointer + +OPT_CFLAGS/compactingPermGenGen.o = -O1 -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/makefiles/mips64.make b/hotspot/make/linux/makefiles/mips64.make ---- a/hotspot/make/linux/makefiles/mips64.make 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/make/linux/makefiles/mips64.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/makefiles/mips64.make b/hotspot/make/linux/makefiles/mips64.make +new file mode 100644 +index 0000000000..d9af3b13ab +--- /dev/null ++++ b/hotspot/make/linux/makefiles/mips64.make @@ -0,0 +1,43 @@ +# +# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. @@ -4536,9 +4609,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +CFLAGS += -fno-omit-frame-pointer + +OPT_CFLAGS/compactingPermGenGen.o = -O1 -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/makefiles/sa.make b/hotspot/make/linux/makefiles/sa.make ---- a/hotspot/make/linux/makefiles/sa.make 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/linux/makefiles/sa.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/makefiles/sa.make b/hotspot/make/linux/makefiles/sa.make +index cdcb16a1a3..34c71bd666 100644 +--- a/hotspot/make/linux/makefiles/sa.make ++++ b/hotspot/make/linux/makefiles/sa.make @@ -22,6 +22,12 @@ # # @@ -4552,7 +4626,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # This makefile (sa.make) is included from the sa.make in the # build directories. -@@ -109,6 +115,8 @@ +@@ -109,6 +115,8 @@ $(GENERATED)/sa-jdi.jar:: $(AGENT_FILES) $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.aarch64.AARCH64ThreadContext @@ -4561,9 +4635,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make ---- a/hotspot/make/linux/makefiles/saproc.make 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/linux/makefiles/saproc.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make +index ffc0ec5ce5..c04a6765df 100644 +--- a/hotspot/make/linux/makefiles/saproc.make ++++ b/hotspot/make/linux/makefiles/saproc.make @@ -21,6 +21,13 @@ # questions. # @@ -4578,7 +4653,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp include $(GAMMADIR)/make/defs.make include $(GAMMADIR)/make/altsrc.make -@@ -81,7 +88,12 @@ +@@ -81,7 +88,12 @@ endif SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) \ $(LDFLAGS_NO_EXEC_STACK) $(EXTRA_LDFLAGS) @@ -4591,9 +4666,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/makefiles/sparcWorks.make b/hotspot/make/linux/makefiles/sparcWorks.make ---- a/hotspot/make/linux/makefiles/sparcWorks.make 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/linux/makefiles/sparcWorks.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/makefiles/sparcWorks.make b/hotspot/make/linux/makefiles/sparcWorks.make +index e39116023c..dbc2ace825 100644 +--- a/hotspot/make/linux/makefiles/sparcWorks.make ++++ b/hotspot/make/linux/makefiles/sparcWorks.make @@ -22,6 +22,12 @@ # # @@ -4607,7 +4683,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #------------------------------------------------------------------------ # CC, CXX & AS -@@ -38,6 +44,7 @@ +@@ -38,6 +44,7 @@ endif ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) ARCHFLAG/i486 = -m32 ARCHFLAG/amd64 = -m64 @@ -4615,9 +4691,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp CFLAGS += $(ARCHFLAG) AOUT_FLAGS += $(ARCHFLAG) -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make ---- a/hotspot/make/linux/makefiles/vm.make 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/linux/makefiles/vm.make 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make +index 04b7c20287..5e428538a0 100644 +--- a/hotspot/make/linux/makefiles/vm.make ++++ b/hotspot/make/linux/makefiles/vm.make @@ -22,6 +22,12 @@ # # @@ -4631,7 +4708,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # Rules to build JVM and related libraries, included from vm.make in the build # directory. -@@ -99,9 +105,22 @@ +@@ -99,9 +105,22 @@ CXXFLAGS = \ ${HS_LIB_ARCH} \ ${VM_DISTRO} @@ -4654,7 +4731,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp CXXFLAGS/vm_version.o += ${JRE_VERSION} ${VERSION_CFLAGS} CXXFLAGS/arguments.o += ${VERSION_CFLAGS} -@@ -211,6 +230,15 @@ +@@ -211,6 +230,15 @@ endif ifeq ($(Platform_arch_model), x86_64) Src_Files_EXCLUDE += \*x86_32\* endif @@ -4670,9 +4747,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # Alternate vm.make # This has to be included here to allow changes to the source -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/platform_loongarch64 b/hotspot/make/linux/platform_loongarch64 ---- a/hotspot/make/linux/platform_loongarch64 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/make/linux/platform_loongarch64 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/platform_loongarch64 b/hotspot/make/linux/platform_loongarch64 +new file mode 100644 +index 0000000000..d704cf389a +--- /dev/null ++++ b/hotspot/make/linux/platform_loongarch64 @@ -0,0 +1,17 @@ +os_family = linux + @@ -4691,9 +4770,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +gnu_dis_arch = loongarch64 + +sysdefs = -DLINUX -D_GNU_SOURCE -DLOONGARCH64 -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/linux/platform_mips64 b/hotspot/make/linux/platform_mips64 ---- a/hotspot/make/linux/platform_mips64 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/make/linux/platform_mips64 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/linux/platform_mips64 b/hotspot/make/linux/platform_mips64 +new file mode 100644 +index 0000000000..c283671f82 +--- /dev/null ++++ b/hotspot/make/linux/platform_mips64 @@ -0,0 +1,17 @@ +os_family = linux + @@ -4712,9 +4793,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +gnu_dis_arch = mips64 + +sysdefs = -DLINUX -D_GNU_SOURCE -DMIPS64 -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/make/sa.files b/hotspot/make/sa.files ---- a/hotspot/make/sa.files 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/make/sa.files 2023-12-20 09:23:19.761481629 +0800 +diff --git a/hotspot/make/sa.files b/hotspot/make/sa.files +index d6e728a9a8..43b08e3ad1 100644 +--- a/hotspot/make/sa.files ++++ b/hotspot/make/sa.files @@ -22,6 +22,12 @@ # # @@ -4728,7 +4810,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # This filelist macro is included in platform specific sa.make # included all packages/*.java. package list can be generated by # $(GAMMADIR)/agent/make/build-pkglist. -@@ -52,14 +58,20 @@ +@@ -52,14 +58,20 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dummy/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \ @@ -4749,7 +4831,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/sparc/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/proc/x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/remote/*.java \ -@@ -94,8 +106,12 @@ +@@ -94,8 +106,12 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_amd64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_aarch64/*.java \ @@ -4762,10 +4844,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/posix/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_amd64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_sparc/*.java \ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp ---- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp 2023-12-20 09:23:19.774814810 +0800 -@@ -1177,7 +1177,9 @@ +diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp +index 35d34a08ea..3b8cf4a11d 100644 +--- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp ++++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp +@@ -1177,7 +1177,9 @@ void LIR_Assembler::emit_opBranch(LIR_OpBranch* op) { } } @@ -4776,7 +4859,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) { LIR_Opr src = op->in_opr(); -@@ -1242,7 +1244,7 @@ +@@ -1242,7 +1244,7 @@ void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) { } case Bytecodes::_d2l: { @@ -4785,7 +4868,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp __ clear_fpsr(); __ fcvtzd(dest->as_register_lo(), src->as_double_reg()); __ get_fpsr(tmp); -@@ -1253,7 +1255,7 @@ +@@ -1253,7 +1255,7 @@ void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) { } case Bytecodes::_f2i: { @@ -4794,7 +4877,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp __ clear_fpsr(); __ fcvtzsw(dest->as_register(), src->as_float_reg()); __ get_fpsr(tmp); -@@ -1264,7 +1266,7 @@ +@@ -1264,7 +1266,7 @@ void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) { } case Bytecodes::_f2l: { @@ -4803,7 +4886,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp __ clear_fpsr(); __ fcvtzs(dest->as_register_lo(), src->as_float_reg()); __ get_fpsr(tmp); -@@ -1275,7 +1277,7 @@ +@@ -1275,7 +1277,7 @@ void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) { } case Bytecodes::_d2i: { @@ -4812,7 +4895,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp __ clear_fpsr(); __ fcvtzdw(dest->as_register(), src->as_double_reg()); __ get_fpsr(tmp); -@@ -1731,6 +1733,11 @@ +@@ -1731,6 +1733,11 @@ void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, L __ csel(result->as_register(), opr1->as_register(), opr2->as_register(), acond); } @@ -4824,10 +4907,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_Assembler::arith_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr dest, CodeEmitInfo* info, bool pop_fpu_stack) { assert(info == NULL, "should never be used, idiv/irem and ldiv/lrem not handled by this method"); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp ---- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp 2023-12-20 09:23:19.774814810 +0800 -@@ -277,18 +277,29 @@ +diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp +index 4f694b1775..c052098323 100644 +--- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp ++++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp +@@ -279,18 +279,29 @@ void LIRGenerator::increment_counter(LIR_Address* addr, int step) { __ store(reg, addr); } @@ -4861,9 +4945,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) { -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.cpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.cpp +new file mode 100644 +index 0000000000..2996ef7aa7 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.cpp @@ -0,0 +1,855 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -5720,9 +5806,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.hpp +new file mode 100644 +index 0000000000..46b57cfe76 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.hpp @@ -0,0 +1,2810 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -8534,9 +8622,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_LOONGARCH_VM_ASSEMBLER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.inline.hpp ---- a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.inline.hpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/assembler_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.inline.hpp +new file mode 100644 +index 0000000000..601f4afe6f +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/assembler_loongarch.inline.hpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -8571,9 +8661,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#include "code/codeCache.hpp" + +#endif // CPU_LOONGARCH_VM_ASSEMBLER_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.hpp +new file mode 100644 +index 0000000000..32775e9bc3 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.hpp @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -8685,9 +8777,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + ((VMJavaVal64*)(addr))->l) + +#endif // CPU_LOONGARCH_VM_BYTECODEINTERPRETER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.inline.hpp ---- a/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.inline.hpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.inline.hpp +new file mode 100644 +index 0000000000..07df527e94 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/bytecodeInterpreter_loongarch.inline.hpp @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -8975,9 +9069,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // CPU_LOONGARCH_VM_BYTECODEINTERPRETER_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.cpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.cpp +new file mode 100644 +index 0000000000..8641090584 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. @@ -9017,9 +9113,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // No LoongArch specific bytecodes + return code; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.hpp +new file mode 100644 +index 0000000000..fbdf531996 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/bytecodes_loongarch.hpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. @@ -9052,9 +9150,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// No Loongson specific bytecodes + +#endif // CPU_LOONGARCH_VM_BYTECODES_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/bytes_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/bytes_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/bytes_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/bytes_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/bytes_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/bytes_loongarch.hpp +new file mode 100644 +index 0000000000..8f766a617e +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/bytes_loongarch.hpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -9131,9 +9231,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#endif + +#endif // CPU_LOONGARCH_VM_BYTES_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_CodeStubs_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_CodeStubs_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/c1_CodeStubs_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_CodeStubs_loongarch_64.cpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/c1_CodeStubs_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_CodeStubs_loongarch_64.cpp +new file mode 100644 +index 0000000000..5166acfa2b +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_CodeStubs_loongarch_64.cpp @@ -0,0 +1,387 @@ +/* + * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. @@ -9522,9 +9624,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +///////////////////////////////////////////////////////////////////////////// + +#undef __ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_Defs_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_Defs_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/c1_Defs_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_Defs_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/c1_Defs_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_Defs_loongarch.hpp +new file mode 100644 +index 0000000000..1140e44431 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_Defs_loongarch.hpp @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. @@ -9605,9 +9709,49 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_LOONGARCH_C1_DEFS_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch_64.cpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch.hpp +new file mode 100644 +index 0000000000..bd8578c72a +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch.hpp +@@ -0,0 +1,32 @@ ++/* ++ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2021, 2022, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_LOONGARCH_C1_FPUSTACKSIM_LOONGARCH_HPP ++#define CPU_LOONGARCH_C1_FPUSTACKSIM_LOONGARCH_HPP ++ ++// No FPU stack on LoongArch ++class FpuStackSim; ++ ++#endif // CPU_LOONGARCH_C1_FPUSTACKSIM_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch_64.cpp +new file mode 100644 +index 0000000000..1a89c437a8 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch_64.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. @@ -9640,13 +9784,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + +// No FPU stack on LoongArch64 +#include "precompiled.hpp" -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_FpuStackSim_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 -@@ -0,0 +1,32 @@ +diff --git a/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch.hpp +new file mode 100644 +index 0000000000..4f0cf05361 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch.hpp +@@ -0,0 +1,143 @@ +/* -+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2021, 2022, Loongson Technology. All rights reserved. ++ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2021, Loongson Technology. 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 @@ -9669,16 +9815,129 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#ifndef CPU_LOONGARCH_C1_FPUSTACKSIM_LOONGARCH_HPP -+#define CPU_LOONGARCH_C1_FPUSTACKSIM_LOONGARCH_HPP ++#ifndef CPU_LOONGARCH_C1_FRAMEMAP_LOONGARCH_HPP ++#define CPU_LOONGARCH_C1_FRAMEMAP_LOONGARCH_HPP + -+// No FPU stack on LoongArch -+class FpuStackSim; ++// On LoongArch64 the frame looks as follows: ++// ++// +-----------------------------+---------+----------------------------------------+----------------+----------- ++// | size_arguments-nof_reg_args | 2 words | size_locals-size_arguments+numreg_args | _size_monitors | spilling . ++// +-----------------------------+---------+----------------------------------------+----------------+----------- + -+#endif // CPU_LOONGARCH_C1_FPUSTACKSIM_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch_64.cpp 2023-12-20 09:23:19.784814696 +0800 ++ public: ++ static const int pd_c_runtime_reserved_arg_size; ++ ++ enum { ++ first_available_sp_in_frame = 0, ++ frame_pad_in_bytes = 16, ++ nof_reg_args = 8 ++ }; ++ ++ public: ++ static LIR_Opr receiver_opr; ++ ++ static LIR_Opr r0_opr; ++ static LIR_Opr ra_opr; ++ static LIR_Opr tp_opr; ++ static LIR_Opr sp_opr; ++ static LIR_Opr a0_opr; ++ static LIR_Opr a1_opr; ++ static LIR_Opr a2_opr; ++ static LIR_Opr a3_opr; ++ static LIR_Opr a4_opr; ++ static LIR_Opr a5_opr; ++ static LIR_Opr a6_opr; ++ static LIR_Opr a7_opr; ++ static LIR_Opr t0_opr; ++ static LIR_Opr t1_opr; ++ static LIR_Opr t2_opr; ++ static LIR_Opr t3_opr; ++ static LIR_Opr t4_opr; ++ static LIR_Opr t5_opr; ++ static LIR_Opr t6_opr; ++ static LIR_Opr t7_opr; ++ static LIR_Opr t8_opr; ++ static LIR_Opr rx_opr; ++ static LIR_Opr fp_opr; ++ static LIR_Opr s0_opr; ++ static LIR_Opr s1_opr; ++ static LIR_Opr s2_opr; ++ static LIR_Opr s3_opr; ++ static LIR_Opr s4_opr; ++ static LIR_Opr s5_opr; ++ static LIR_Opr s6_opr; ++ static LIR_Opr s7_opr; ++ static LIR_Opr s8_opr; ++ ++ static LIR_Opr ra_oop_opr; ++ static LIR_Opr a0_oop_opr; ++ static LIR_Opr a1_oop_opr; ++ static LIR_Opr a2_oop_opr; ++ static LIR_Opr a3_oop_opr; ++ static LIR_Opr a4_oop_opr; ++ static LIR_Opr a5_oop_opr; ++ static LIR_Opr a6_oop_opr; ++ static LIR_Opr a7_oop_opr; ++ static LIR_Opr t0_oop_opr; ++ static LIR_Opr t1_oop_opr; ++ static LIR_Opr t2_oop_opr; ++ static LIR_Opr t3_oop_opr; ++ static LIR_Opr t4_oop_opr; ++ static LIR_Opr t5_oop_opr; ++ static LIR_Opr t6_oop_opr; ++ static LIR_Opr t7_oop_opr; ++ static LIR_Opr t8_oop_opr; ++ static LIR_Opr fp_oop_opr; ++ static LIR_Opr s0_oop_opr; ++ static LIR_Opr s1_oop_opr; ++ static LIR_Opr s2_oop_opr; ++ static LIR_Opr s3_oop_opr; ++ static LIR_Opr s4_oop_opr; ++ static LIR_Opr s5_oop_opr; ++ static LIR_Opr s6_oop_opr; ++ static LIR_Opr s7_oop_opr; ++ static LIR_Opr s8_oop_opr; ++ ++ static LIR_Opr scr1_opr; ++ static LIR_Opr scr2_opr; ++ static LIR_Opr scr1_long_opr; ++ static LIR_Opr scr2_long_opr; ++ ++ static LIR_Opr a0_metadata_opr; ++ static LIR_Opr a1_metadata_opr; ++ static LIR_Opr a2_metadata_opr; ++ static LIR_Opr a3_metadata_opr; ++ static LIR_Opr a4_metadata_opr; ++ static LIR_Opr a5_metadata_opr; ++ ++ static LIR_Opr long0_opr; ++ static LIR_Opr long1_opr; ++ static LIR_Opr fpu0_float_opr; ++ static LIR_Opr fpu0_double_opr; ++ ++ static LIR_Opr as_long_opr(Register r) { ++ return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r)); ++ } ++ static LIR_Opr as_pointer_opr(Register r) { ++ return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r)); ++ } ++ ++ // VMReg name for spilled physical FPU stack slot n ++ static VMReg fpu_regname (int n); ++ ++ static bool is_caller_save_register(LIR_Opr opr) { return true; } ++ static bool is_caller_save_register(Register r) { return true; } ++ ++ static int nof_caller_save_cpu_regs() { return pd_nof_caller_save_cpu_regs_frame_map; } ++ static int last_cpu_reg() { return pd_last_cpu_reg; } ++ static int last_byte_reg() { return pd_last_byte_reg; } ++ ++#endif // CPU_LOONGARCH_C1_FRAMEMAP_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch_64.cpp +new file mode 100644 +index 0000000000..25c90bcf98 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch_64.cpp @@ -0,0 +1,362 @@ +/* + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. @@ -10042,157 +10301,12 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +bool FrameMap::validate_frame() { + return true; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_FrameMap_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 -@@ -0,0 +1,143 @@ -+/* -+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2021, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_C1_FRAMEMAP_LOONGARCH_HPP -+#define CPU_LOONGARCH_C1_FRAMEMAP_LOONGARCH_HPP -+ -+// On LoongArch64 the frame looks as follows: -+// -+// +-----------------------------+---------+----------------------------------------+----------------+----------- -+// | size_arguments-nof_reg_args | 2 words | size_locals-size_arguments+numreg_args | _size_monitors | spilling . -+// +-----------------------------+---------+----------------------------------------+----------------+----------- -+ -+ public: -+ static const int pd_c_runtime_reserved_arg_size; -+ -+ enum { -+ first_available_sp_in_frame = 0, -+ frame_pad_in_bytes = 16, -+ nof_reg_args = 8 -+ }; -+ -+ public: -+ static LIR_Opr receiver_opr; -+ -+ static LIR_Opr r0_opr; -+ static LIR_Opr ra_opr; -+ static LIR_Opr tp_opr; -+ static LIR_Opr sp_opr; -+ static LIR_Opr a0_opr; -+ static LIR_Opr a1_opr; -+ static LIR_Opr a2_opr; -+ static LIR_Opr a3_opr; -+ static LIR_Opr a4_opr; -+ static LIR_Opr a5_opr; -+ static LIR_Opr a6_opr; -+ static LIR_Opr a7_opr; -+ static LIR_Opr t0_opr; -+ static LIR_Opr t1_opr; -+ static LIR_Opr t2_opr; -+ static LIR_Opr t3_opr; -+ static LIR_Opr t4_opr; -+ static LIR_Opr t5_opr; -+ static LIR_Opr t6_opr; -+ static LIR_Opr t7_opr; -+ static LIR_Opr t8_opr; -+ static LIR_Opr rx_opr; -+ static LIR_Opr fp_opr; -+ static LIR_Opr s0_opr; -+ static LIR_Opr s1_opr; -+ static LIR_Opr s2_opr; -+ static LIR_Opr s3_opr; -+ static LIR_Opr s4_opr; -+ static LIR_Opr s5_opr; -+ static LIR_Opr s6_opr; -+ static LIR_Opr s7_opr; -+ static LIR_Opr s8_opr; -+ -+ static LIR_Opr ra_oop_opr; -+ static LIR_Opr a0_oop_opr; -+ static LIR_Opr a1_oop_opr; -+ static LIR_Opr a2_oop_opr; -+ static LIR_Opr a3_oop_opr; -+ static LIR_Opr a4_oop_opr; -+ static LIR_Opr a5_oop_opr; -+ static LIR_Opr a6_oop_opr; -+ static LIR_Opr a7_oop_opr; -+ static LIR_Opr t0_oop_opr; -+ static LIR_Opr t1_oop_opr; -+ static LIR_Opr t2_oop_opr; -+ static LIR_Opr t3_oop_opr; -+ static LIR_Opr t4_oop_opr; -+ static LIR_Opr t5_oop_opr; -+ static LIR_Opr t6_oop_opr; -+ static LIR_Opr t7_oop_opr; -+ static LIR_Opr t8_oop_opr; -+ static LIR_Opr fp_oop_opr; -+ static LIR_Opr s0_oop_opr; -+ static LIR_Opr s1_oop_opr; -+ static LIR_Opr s2_oop_opr; -+ static LIR_Opr s3_oop_opr; -+ static LIR_Opr s4_oop_opr; -+ static LIR_Opr s5_oop_opr; -+ static LIR_Opr s6_oop_opr; -+ static LIR_Opr s7_oop_opr; -+ static LIR_Opr s8_oop_opr; -+ -+ static LIR_Opr scr1_opr; -+ static LIR_Opr scr2_opr; -+ static LIR_Opr scr1_long_opr; -+ static LIR_Opr scr2_long_opr; -+ -+ static LIR_Opr a0_metadata_opr; -+ static LIR_Opr a1_metadata_opr; -+ static LIR_Opr a2_metadata_opr; -+ static LIR_Opr a3_metadata_opr; -+ static LIR_Opr a4_metadata_opr; -+ static LIR_Opr a5_metadata_opr; -+ -+ static LIR_Opr long0_opr; -+ static LIR_Opr long1_opr; -+ static LIR_Opr fpu0_float_opr; -+ static LIR_Opr fpu0_double_opr; -+ -+ static LIR_Opr as_long_opr(Register r) { -+ return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r)); -+ } -+ static LIR_Opr as_pointer_opr(Register r) { -+ return LIR_OprFact::double_cpu(cpu_reg2rnr(r), cpu_reg2rnr(r)); -+ } -+ -+ // VMReg name for spilled physical FPU stack slot n -+ static VMReg fpu_regname (int n); -+ -+ static bool is_caller_save_register(LIR_Opr opr) { return true; } -+ static bool is_caller_save_register(Register r) { return true; } -+ -+ static int nof_caller_save_cpu_regs() { return pd_nof_caller_save_cpu_regs_frame_map; } -+ static int last_cpu_reg() { return pd_last_cpu_reg; } -+ static int last_byte_reg() { return pd_last_byte_reg; } -+ -+#endif // CPU_LOONGARCH_C1_FRAMEMAP_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_globals_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_globals_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/c1_globals_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_globals_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,69 @@ +diff --git a/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch.hpp +new file mode 100644 +index 0000000000..38b0daa025 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch.hpp +@@ -0,0 +1,83 @@ +/* + * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, Loongson Technology. All rights reserved. @@ -10218,164 +10332,69 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#ifndef CPU_LOONGARCH_C1_GLOBALS_LOONGARCH_HPP -+#define CPU_LOONGARCH_C1_GLOBALS_LOONGARCH_HPP -+ -+#include "utilities/globalDefinitions.hpp" -+#include "utilities/macros.hpp" ++#ifndef CPU_LOONGARCH_C1_LIRASSEMBLER_LOONGARCH_HPP ++#define CPU_LOONGARCH_C1_LIRASSEMBLER_LOONGARCH_HPP + -+// Sets the default values for platform dependent flags used by the client compiler. -+// (see c1_globals.hpp) ++// ArrayCopyStub needs access to bailout ++friend class ArrayCopyStub; + -+#ifndef COMPILER2 -+define_pd_global(bool, BackgroundCompilation, true ); -+define_pd_global(bool, InlineIntrinsics, true ); -+define_pd_global(bool, PreferInterpreterNativeStubs, false); -+define_pd_global(bool, ProfileTraps, false); -+define_pd_global(bool, UseOnStackReplacement, true ); -+define_pd_global(bool, TieredCompilation, false); -+define_pd_global(intx, CompileThreshold, 1500 ); ++ private: ++ int array_element_size(BasicType type) const; + -+define_pd_global(intx, OnStackReplacePercentage, 933 ); -+define_pd_global(intx, NewSizeThreadIncrease, 4*K ); -+define_pd_global(intx, InitialCodeCacheSize, 160*K); -+define_pd_global(intx, ReservedCodeCacheSize, 32*M ); -+define_pd_global(intx, NonProfiledCodeHeapSize, 13*M ); -+define_pd_global(intx, ProfiledCodeHeapSize, 14*M ); -+define_pd_global(intx, NonNMethodCodeHeapSize, 5*M ); -+define_pd_global(bool, ProfileInterpreter, false); -+define_pd_global(intx, CodeCacheExpansionSize, 32*K ); -+define_pd_global(uintx, CodeCacheMinBlockLength, 1); -+define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); -+define_pd_global(bool, NeverActAsServerClassMachine, true ); -+define_pd_global(uint64_t,MaxRAM, 1ULL*G); -+define_pd_global(bool, CICompileOSR, true ); -+#endif // !COMPILER2 -+define_pd_global(bool, UseTypeProfile, false); -+define_pd_global(bool, RoundFPResults, true ); ++ void arith_fpu_implementation(LIR_Code code, int left_index, int right_index, ++ int dest_index, bool pop_fpu_stack); + -+define_pd_global(bool, LIRFillDelaySlots, false); -+define_pd_global(bool, OptimizeSinglePrecision, true ); -+define_pd_global(bool, CSEArrayLength, false); -+define_pd_global(bool, TwoOperandLIRForm, false ); ++ // helper functions which checks for overflow and sets bailout if it ++ // occurs. Always returns a valid embeddable pointer but in the ++ // bailout case the pointer won't be to unique storage. ++ address float_constant(float f); ++ address double_constant(double d); + -+define_pd_global(intx, SafepointPollOffset, 0 ); ++ address int_constant(jlong n); + -+#endif // CPU_LOONGARCH_C1_GLOBALS_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch_64.cpp 2023-12-20 09:23:19.784814696 +0800 -@@ -0,0 +1,33 @@ -+/* -+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. All rights reserved. -+ * Copyright (c) 2021, Loongson Technology. 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. -+ * -+ */ ++ bool is_literal_address(LIR_Address* addr); + -+#include "precompiled.hpp" -+#include "c1/c1_Instruction.hpp" -+#include "c1/c1_LinearScan.hpp" -+#include "utilities/bitMap.inline.hpp" ++ // Ensure we have a valid Address (base+offset) to a stack-slot. ++ Address stack_slot_address(int index, uint shift, int adjust = 0); + -+void LinearScan::allocate_fpu_stack() { -+ // No FPU stack on LoongArch64 -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 -@@ -0,0 +1,70 @@ -+/* -+ * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2021, Loongson Technology. 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. -+ * -+ */ ++ // Record the type of the receiver in ReceiverTypeData ++ void type_profile_helper(Register mdo, ciMethodData *md, ciProfileData *data, ++ Register recv, Label* update_done); ++ void add_debug_info_for_branch(address adr, CodeEmitInfo* info); + -+#ifndef CPU_LOONGARCH_C1_LINEARSCAN_LOONGARCH_HPP -+#define CPU_LOONGARCH_C1_LINEARSCAN_LOONGARCH_HPP ++ void casw(Register addr, Register newval, Register cmpval, bool sign); ++ void casl(Register addr, Register newval, Register cmpval); + -+inline bool LinearScan::is_processed_reg_num(int reg_num) { -+ return reg_num <= FrameMap::last_cpu_reg() || reg_num >= pd_nof_cpu_regs_frame_map; -+} ++ void poll_for_safepoint(relocInfo::relocType rtype, CodeEmitInfo* info = NULL); + -+inline int LinearScan::num_physical_regs(BasicType type) { -+ return 1; -+} ++ static const int max_tableswitches = 20; ++ struct tableswitch switches[max_tableswitches]; ++ int tableswitch_count; + -+inline bool LinearScan::requires_adjacent_regs(BasicType type) { -+ return false; -+} ++ void init() { tableswitch_count = 0; } + -+inline bool LinearScan::is_caller_save(int assigned_reg) { -+ assert(assigned_reg >= 0 && assigned_reg < nof_regs, "should call this only for registers"); -+ if (assigned_reg < pd_first_callee_saved_reg) -+ return true; -+ if (assigned_reg > pd_last_callee_saved_reg && assigned_reg < pd_first_callee_saved_fpu_reg) -+ return true; -+ if (assigned_reg > pd_last_callee_saved_fpu_reg && assigned_reg < pd_last_fpu_reg) -+ return true; -+ return false; -+} ++ void deoptimize_trap(CodeEmitInfo *info); + -+inline void LinearScan::pd_add_temps(LIR_Op* op) {} ++public: ++ void store_parameter(Register r, int offset_from_sp_in_words); ++ void store_parameter(jint c, int offset_from_sp_in_words); ++ void store_parameter(jobject c, int offset_from_sp_in_words); + -+// Implementation of LinearScanWalker -+inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) { -+ if (allocator()->gen()->is_vreg_flag_set(cur->reg_num(), LIRGenerator::callee_saved)) { -+ assert(cur->type() != T_FLOAT && cur->type() != T_DOUBLE, "cpu regs only"); -+ _first_reg = pd_first_callee_saved_reg; -+ _last_reg = pd_last_callee_saved_reg; -+ return true; -+ } else if (cur->type() == T_INT || cur->type() == T_LONG || cur->type() == T_OBJECT || -+ cur->type() == T_ADDRESS || cur->type() == T_METADATA) { -+ _first_reg = pd_first_cpu_reg; -+ _last_reg = pd_last_allocatable_cpu_reg; -+ return true; -+ } -+ return false; -+} ++ enum { ++ // call stub: CompiledStaticCall::to_interp_stub_size() + ++ // NativeInstruction::nop_instruction_size + ++ // NativeCallTrampolineStub::instruction_size ++ call_stub_size = 13 * NativeInstruction::nop_instruction_size, ++ exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(175), ++ deopt_handler_size = 7 * NativeInstruction::nop_instruction_size ++ }; + -+#endif // CPU_LOONGARCH_C1_LINEARSCAN_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch_64.cpp 2023-12-20 09:23:19.784814696 +0800 ++#endif // CPU_LOONGARCH_C1_LIRASSEMBLER_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch_64.cpp +new file mode 100644 +index 0000000000..ee48326bec +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch_64.cpp @@ -0,0 +1,3377 @@ +/* + * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. @@ -13754,100 +13773,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#undef __ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_LIRAssembler_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 -@@ -0,0 +1,83 @@ -+/* -+ * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2021, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_C1_LIRASSEMBLER_LOONGARCH_HPP -+#define CPU_LOONGARCH_C1_LIRASSEMBLER_LOONGARCH_HPP -+ -+// ArrayCopyStub needs access to bailout -+friend class ArrayCopyStub; -+ -+ private: -+ int array_element_size(BasicType type) const; -+ -+ void arith_fpu_implementation(LIR_Code code, int left_index, int right_index, -+ int dest_index, bool pop_fpu_stack); -+ -+ // helper functions which checks for overflow and sets bailout if it -+ // occurs. Always returns a valid embeddable pointer but in the -+ // bailout case the pointer won't be to unique storage. -+ address float_constant(float f); -+ address double_constant(double d); -+ -+ address int_constant(jlong n); -+ -+ bool is_literal_address(LIR_Address* addr); -+ -+ // Ensure we have a valid Address (base+offset) to a stack-slot. -+ Address stack_slot_address(int index, uint shift, int adjust = 0); -+ -+ // Record the type of the receiver in ReceiverTypeData -+ void type_profile_helper(Register mdo, ciMethodData *md, ciProfileData *data, -+ Register recv, Label* update_done); -+ void add_debug_info_for_branch(address adr, CodeEmitInfo* info); -+ -+ void casw(Register addr, Register newval, Register cmpval, bool sign); -+ void casl(Register addr, Register newval, Register cmpval); -+ -+ void poll_for_safepoint(relocInfo::relocType rtype, CodeEmitInfo* info = NULL); -+ -+ static const int max_tableswitches = 20; -+ struct tableswitch switches[max_tableswitches]; -+ int tableswitch_count; -+ -+ void init() { tableswitch_count = 0; } -+ -+ void deoptimize_trap(CodeEmitInfo *info); -+ -+public: -+ void store_parameter(Register r, int offset_from_sp_in_words); -+ void store_parameter(jint c, int offset_from_sp_in_words); -+ void store_parameter(jobject c, int offset_from_sp_in_words); -+ -+ enum { -+ // call stub: CompiledStaticCall::to_interp_stub_size() + -+ // NativeInstruction::nop_instruction_size + -+ // NativeCallTrampolineStub::instruction_size -+ call_stub_size = 13 * NativeInstruction::nop_instruction_size, -+ exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(175), -+ deopt_handler_size = 7 * NativeInstruction::nop_instruction_size -+ }; -+ -+#endif // CPU_LOONGARCH_C1_LIRASSEMBLER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_LIRGenerator_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_LIRGenerator_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/c1_LIRGenerator_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_LIRGenerator_loongarch_64.cpp 2023-12-20 09:23:19.784814696 +0800 -@@ -0,0 +1,1442 @@ +diff --git a/hotspot/src/cpu/loongarch/vm/c1_LIRGenerator_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_LIRGenerator_loongarch_64.cpp +new file mode 100644 +index 0000000000..e170bee525 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_LIRGenerator_loongarch_64.cpp +@@ -0,0 +1,1444 @@ +/* + * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2021, Loongson Technology. All rights reserved. ++ * Copyright (c) 2021, 2024, Loongson Technology. 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 @@ -14002,8 +13936,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + if (index->is_register()) { + // apply the shift and accumulate the displacement + if (shift > 0) { -+ LIR_Opr tmp = new_pointer_register(); -+ __ shift_left(index, shift, tmp); ++ // Use long register to avoid overflow when shifting large index values left. ++ LIR_Opr tmp = new_register(T_LONG); ++ __ convert(Bytecodes::_i2l, index, tmp); ++ __ shift_left(tmp, shift, tmp); + index = tmp; + } + if (large_disp != 0) { @@ -15287,9 +15223,244 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch_64.cpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch.hpp +new file mode 100644 +index 0000000000..f15dacafeb +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch.hpp +@@ -0,0 +1,70 @@ ++/* ++ * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2021, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_LOONGARCH_C1_LINEARSCAN_LOONGARCH_HPP ++#define CPU_LOONGARCH_C1_LINEARSCAN_LOONGARCH_HPP ++ ++inline bool LinearScan::is_processed_reg_num(int reg_num) { ++ return reg_num <= FrameMap::last_cpu_reg() || reg_num >= pd_nof_cpu_regs_frame_map; ++} ++ ++inline int LinearScan::num_physical_regs(BasicType type) { ++ return 1; ++} ++ ++inline bool LinearScan::requires_adjacent_regs(BasicType type) { ++ return false; ++} ++ ++inline bool LinearScan::is_caller_save(int assigned_reg) { ++ assert(assigned_reg >= 0 && assigned_reg < nof_regs, "should call this only for registers"); ++ if (assigned_reg < pd_first_callee_saved_reg) ++ return true; ++ if (assigned_reg > pd_last_callee_saved_reg && assigned_reg < pd_first_callee_saved_fpu_reg) ++ return true; ++ if (assigned_reg > pd_last_callee_saved_fpu_reg && assigned_reg < pd_last_fpu_reg) ++ return true; ++ return false; ++} ++ ++inline void LinearScan::pd_add_temps(LIR_Op* op) {} ++ ++// Implementation of LinearScanWalker ++inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) { ++ if (allocator()->gen()->is_vreg_flag_set(cur->reg_num(), LIRGenerator::callee_saved)) { ++ assert(cur->type() != T_FLOAT && cur->type() != T_DOUBLE, "cpu regs only"); ++ _first_reg = pd_first_callee_saved_reg; ++ _last_reg = pd_last_callee_saved_reg; ++ return true; ++ } else if (cur->type() == T_INT || cur->type() == T_LONG || cur->type() == T_OBJECT || ++ cur->type() == T_ADDRESS || cur->type() == T_METADATA) { ++ _first_reg = pd_first_cpu_reg; ++ _last_reg = pd_last_allocatable_cpu_reg; ++ return true; ++ } ++ return false; ++} ++ ++#endif // CPU_LOONGARCH_C1_LINEARSCAN_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch_64.cpp +new file mode 100644 +index 0000000000..219b2e3671 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_LinearScan_loongarch_64.cpp +@@ -0,0 +1,33 @@ ++/* ++ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. All rights reserved. ++ * Copyright (c) 2021, Loongson Technology. 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 "precompiled.hpp" ++#include "c1/c1_Instruction.hpp" ++#include "c1/c1_LinearScan.hpp" ++#include "utilities/bitMap.inline.hpp" ++ ++void LinearScan::allocate_fpu_stack() { ++ // No FPU stack on LoongArch64 ++} +diff --git a/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch.hpp +new file mode 100644 +index 0000000000..38ff4c5836 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch.hpp +@@ -0,0 +1,112 @@ ++/* ++ * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2021, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_LOONGARCH_C1_MACROASSEMBLER_LOONGARCH_HPP ++#define CPU_LOONGARCH_C1_MACROASSEMBLER_LOONGARCH_HPP ++ ++using MacroAssembler::build_frame; ++using MacroAssembler::null_check; ++ ++// C1_MacroAssembler contains high-level macros for C1 ++ ++ private: ++ int _rsp_offset; // track rsp changes ++ // initialization ++ void pd_init() { _rsp_offset = 0; } ++ ++ public: ++ void try_allocate( ++ Register obj, // result: pointer to object after successful allocation ++ Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise ++ int con_size_in_bytes, // object size in bytes if known at compile time ++ Register t1, // temp register ++ Register t2, // temp register ++ Label& slow_case // continuation point if fast allocation fails ++ ); ++ ++ void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2); ++ void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1, Register t2); ++ ++ // locking ++ // hdr : must be A0, contents destroyed ++ // obj : must point to the object to lock, contents preserved ++ // disp_hdr: must point to the displaced header location, contents preserved ++ // scratch : scratch register, contents destroyed ++ // returns code offset at which to add null check debug information ++ int lock_object (Register swap, Register obj, Register disp_hdr, Register scratch, Label& slow_case); ++ ++ // unlocking ++ // hdr : contents destroyed ++ // obj : must point to the object to lock, contents preserved ++ // disp_hdr: must be A0 & must point to the displaced header location, contents destroyed ++ void unlock_object(Register swap, Register obj, Register lock, Label& slow_case); ++ ++ void initialize_object( ++ Register obj, // result: pointer to object after successful allocation ++ Register klass, // object klass ++ Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise ++ int con_size_in_bytes, // object size in bytes if known at compile time ++ Register t1, // temp register ++ Register t2, // temp register ++ bool is_tlab_allocated // the object was allocated in a TLAB; relevant for the implementation of ZeroTLAB ++ ); ++ ++ // allocation of fixed-size objects ++ // (can also be used to allocate fixed-size arrays, by setting ++ // hdr_size correctly and storing the array length afterwards) ++ // obj : will contain pointer to allocated object ++ // t1, t2 : scratch registers - contents destroyed ++ // header_size: size of object header in words ++ // object_size: total size of object in words ++ // slow_case : exit to slow case implementation if fast allocation fails ++ void allocate_object(Register obj, Register t1, Register t2, int header_size, ++ int object_size, Register klass, Label& slow_case); ++ ++ enum { ++ max_array_allocation_length = 0x00FFFFFF ++ }; ++ ++ // allocation of arrays ++ // obj : will contain pointer to allocated object ++ // len : array length in number of elements ++ // t : scratch register - contents destroyed ++ // header_size: size of object header in words ++ // f : element scale factor ++ // slow_case : exit to slow case implementation if fast allocation fails ++ void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, ++ int f, Register klass, Label& slow_case); ++ ++ int rsp_offset() const { return _rsp_offset; } ++ void set_rsp_offset(int n) { _rsp_offset = n; } ++ ++ void invalidate_registers(bool inv_a0, bool inv_s0, bool inv_a2, bool inv_a3, ++ bool inv_a4, bool inv_a5) PRODUCT_RETURN; ++ ++ // This platform only uses signal-based null checks. The Label is not needed. ++ void null_check(Register r, Label *Lnull = NULL) { MacroAssembler::null_check(r); } ++ ++ void load_parameter(int offset_in_words, Register reg); ++ ++#endif // CPU_LOONGARCH_C1_MACROASSEMBLER_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch_64.cpp +new file mode 100644 +index 0000000000..b75126fba4 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch_64.cpp @@ -0,0 +1,346 @@ +/* + * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. @@ -15637,125 +15808,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#endif +} +#endif // ifndef PRODUCT -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_MacroAssembler_loongarch.hpp 2023-12-20 09:23:19.784814696 +0800 -@@ -0,0 +1,112 @@ -+/* -+ * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2021, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_C1_MACROASSEMBLER_LOONGARCH_HPP -+#define CPU_LOONGARCH_C1_MACROASSEMBLER_LOONGARCH_HPP -+ -+using MacroAssembler::build_frame; -+using MacroAssembler::null_check; -+ -+// C1_MacroAssembler contains high-level macros for C1 -+ -+ private: -+ int _rsp_offset; // track rsp changes -+ // initialization -+ void pd_init() { _rsp_offset = 0; } -+ -+ public: -+ void try_allocate( -+ Register obj, // result: pointer to object after successful allocation -+ Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise -+ int con_size_in_bytes, // object size in bytes if known at compile time -+ Register t1, // temp register -+ Register t2, // temp register -+ Label& slow_case // continuation point if fast allocation fails -+ ); -+ -+ void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2); -+ void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1, Register t2); -+ -+ // locking -+ // hdr : must be A0, contents destroyed -+ // obj : must point to the object to lock, contents preserved -+ // disp_hdr: must point to the displaced header location, contents preserved -+ // scratch : scratch register, contents destroyed -+ // returns code offset at which to add null check debug information -+ int lock_object (Register swap, Register obj, Register disp_hdr, Register scratch, Label& slow_case); -+ -+ // unlocking -+ // hdr : contents destroyed -+ // obj : must point to the object to lock, contents preserved -+ // disp_hdr: must be A0 & must point to the displaced header location, contents destroyed -+ void unlock_object(Register swap, Register obj, Register lock, Label& slow_case); -+ -+ void initialize_object( -+ Register obj, // result: pointer to object after successful allocation -+ Register klass, // object klass -+ Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise -+ int con_size_in_bytes, // object size in bytes if known at compile time -+ Register t1, // temp register -+ Register t2, // temp register -+ bool is_tlab_allocated // the object was allocated in a TLAB; relevant for the implementation of ZeroTLAB -+ ); -+ -+ // allocation of fixed-size objects -+ // (can also be used to allocate fixed-size arrays, by setting -+ // hdr_size correctly and storing the array length afterwards) -+ // obj : will contain pointer to allocated object -+ // t1, t2 : scratch registers - contents destroyed -+ // header_size: size of object header in words -+ // object_size: total size of object in words -+ // slow_case : exit to slow case implementation if fast allocation fails -+ void allocate_object(Register obj, Register t1, Register t2, int header_size, -+ int object_size, Register klass, Label& slow_case); -+ -+ enum { -+ max_array_allocation_length = 0x00FFFFFF -+ }; -+ -+ // allocation of arrays -+ // obj : will contain pointer to allocated object -+ // len : array length in number of elements -+ // t : scratch register - contents destroyed -+ // header_size: size of object header in words -+ // f : element scale factor -+ // slow_case : exit to slow case implementation if fast allocation fails -+ void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, -+ int f, Register klass, Label& slow_case); -+ -+ int rsp_offset() const { return _rsp_offset; } -+ void set_rsp_offset(int n) { _rsp_offset = n; } -+ -+ void invalidate_registers(bool inv_a0, bool inv_s0, bool inv_a2, bool inv_a3, -+ bool inv_a4, bool inv_a5) PRODUCT_RETURN; -+ -+ // This platform only uses signal-based null checks. The Label is not needed. -+ void null_check(Register r, Label *Lnull = NULL) { MacroAssembler::null_check(r); } -+ -+ void load_parameter(int offset_in_words, Register reg); -+ -+#endif // CPU_LOONGARCH_C1_MACROASSEMBLER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c1_Runtime1_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_Runtime1_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/c1_Runtime1_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c1_Runtime1_loongarch_64.cpp 2023-12-20 09:23:19.784814696 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/c1_Runtime1_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/c1_Runtime1_loongarch_64.cpp +new file mode 100644 +index 0000000000..a750dca323 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_Runtime1_loongarch_64.cpp @@ -0,0 +1,1252 @@ +/* + * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. @@ -17009,9 +17066,86 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + Unimplemented(); + return 0; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c2_globals_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c2_globals_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/c2_globals_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c2_globals_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/c1_globals_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c1_globals_loongarch.hpp +new file mode 100644 +index 0000000000..df052a058c +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c1_globals_loongarch.hpp +@@ -0,0 +1,69 @@ ++/* ++ * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2021, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_LOONGARCH_C1_GLOBALS_LOONGARCH_HPP ++#define CPU_LOONGARCH_C1_GLOBALS_LOONGARCH_HPP ++ ++#include "utilities/globalDefinitions.hpp" ++#include "utilities/macros.hpp" ++ ++// Sets the default values for platform dependent flags used by the client compiler. ++// (see c1_globals.hpp) ++ ++#ifndef COMPILER2 ++define_pd_global(bool, BackgroundCompilation, true ); ++define_pd_global(bool, InlineIntrinsics, true ); ++define_pd_global(bool, PreferInterpreterNativeStubs, false); ++define_pd_global(bool, ProfileTraps, false); ++define_pd_global(bool, UseOnStackReplacement, true ); ++define_pd_global(bool, TieredCompilation, false); ++define_pd_global(intx, CompileThreshold, 1500 ); ++ ++define_pd_global(intx, OnStackReplacePercentage, 933 ); ++define_pd_global(intx, NewSizeThreadIncrease, 4*K ); ++define_pd_global(intx, InitialCodeCacheSize, 160*K); ++define_pd_global(intx, ReservedCodeCacheSize, 32*M ); ++define_pd_global(intx, NonProfiledCodeHeapSize, 13*M ); ++define_pd_global(intx, ProfiledCodeHeapSize, 14*M ); ++define_pd_global(intx, NonNMethodCodeHeapSize, 5*M ); ++define_pd_global(bool, ProfileInterpreter, false); ++define_pd_global(intx, CodeCacheExpansionSize, 32*K ); ++define_pd_global(uintx, CodeCacheMinBlockLength, 1); ++define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); ++define_pd_global(bool, NeverActAsServerClassMachine, true ); ++define_pd_global(uint64_t,MaxRAM, 1ULL*G); ++define_pd_global(bool, CICompileOSR, true ); ++#endif // !COMPILER2 ++define_pd_global(bool, UseTypeProfile, false); ++define_pd_global(bool, RoundFPResults, true ); ++ ++define_pd_global(bool, LIRFillDelaySlots, false); ++define_pd_global(bool, OptimizeSinglePrecision, true ); ++define_pd_global(bool, CSEArrayLength, false); ++define_pd_global(bool, TwoOperandLIRForm, false ); ++ ++define_pd_global(intx, SafepointPollOffset, 0 ); ++ ++#endif // CPU_LOONGARCH_C1_GLOBALS_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/c2_globals_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/c2_globals_loongarch.hpp +new file mode 100644 +index 0000000000..044b0d2536 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c2_globals_loongarch.hpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -17100,9 +17234,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +define_pd_global(bool, NeverActAsServerClassMachine, false); + +#endif // CPU_LOONGARCH_VM_C2_GLOBALS_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/c2_init_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/c2_init_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/c2_init_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/c2_init_loongarch.cpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/c2_init_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/c2_init_loongarch.cpp +new file mode 100644 +index 0000000000..c7bf590b60 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/c2_init_loongarch.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. @@ -17138,9 +17274,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +void Compile::pd_compiler2_init() { + guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "" ); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/codeBuffer_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/codeBuffer_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/codeBuffer_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/codeBuffer_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/codeBuffer_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/codeBuffer_loongarch.hpp +new file mode 100644 +index 0000000000..652f6c1092 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/codeBuffer_loongarch.hpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -17177,9 +17315,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + void flush_bundle(bool start_new_bundle) {} + +#endif // CPU_LOONGARCH_VM_CODEBUFFER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/compiledIC_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/compiledIC_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/compiledIC_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/compiledIC_loongarch.cpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/compiledIC_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/compiledIC_loongarch.cpp +new file mode 100644 +index 0000000000..70a47fc772 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/compiledIC_loongarch.cpp @@ -0,0 +1,167 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -17348,9 +17488,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // !PRODUCT -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/copy_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/copy_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/copy_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/copy_loongarch.hpp 2024-01-30 13:54:24.776042456 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/copy_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/copy_loongarch.hpp +new file mode 100644 +index 0000000000..cb65540139 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/copy_loongarch.hpp @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. @@ -17442,9 +17584,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif //CPU_LOONGARCH_VM_COPY_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/cppInterpreterGenerator_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/cppInterpreterGenerator_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/cppInterpreterGenerator_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/cppInterpreterGenerator_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/cppInterpreterGenerator_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/cppInterpreterGenerator_loongarch.hpp +new file mode 100644 +index 0000000000..45d86f5bfe +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/cppInterpreterGenerator_loongarch.hpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. @@ -17499,9 +17643,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + bool native); // C++ interpreter only + +#endif // CPU_LOONGARCH_VM_CPPINTERPRETERGENERATOR_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/cppInterpreter_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/cppInterpreter_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/cppInterpreter_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/cppInterpreter_loongarch.cpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/cppInterpreter_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/cppInterpreter_loongarch.cpp +new file mode 100644 +index 0000000000..d6c0df3b77 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/cppInterpreter_loongarch.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. @@ -17718,9 +17864,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // CC_INTERP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/debug_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/debug_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/debug_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/debug_loongarch.cpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/debug_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/debug_loongarch.cpp +new file mode 100644 +index 0000000000..50de03653b +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/debug_loongarch.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. @@ -17773,9 +17921,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +void pd_obfuscate_location(char *buf,int buflen) {} + +#endif // PRODUCT -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.cpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.cpp +new file mode 100644 +index 0000000000..62478be3dc +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -17807,9 +17957,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#include "depChecker_loongarch.hpp" + +// Nothing to do on LoongArch -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.hpp +new file mode 100644 +index 0000000000..598be0ee6f +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/depChecker_loongarch.hpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -17842,9 +17994,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// Nothing to do on LoongArch + +#endif // CPU_LOONGARCH_VM_DEPCHECKER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/disassembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/disassembler_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/disassembler_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/disassembler_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/disassembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/disassembler_loongarch.hpp +new file mode 100644 +index 0000000000..ccd89e8d6d +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/disassembler_loongarch.hpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -17883,9 +18037,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } + +#endif // CPU_LOONGARCH_VM_DISASSEMBLER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/frame_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/frame_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/frame_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/frame_loongarch.cpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/frame_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/frame_loongarch.cpp +new file mode 100644 +index 0000000000..0f50a5715d +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/frame_loongarch.cpp @@ -0,0 +1,711 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -18598,9 +18754,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + init((intptr_t*)sp, (intptr_t*)fp, (address)pc); +} +#endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/frame_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/frame_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/frame_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/frame_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/frame_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/frame_loongarch.hpp +new file mode 100644 +index 0000000000..964026e621 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/frame_loongarch.hpp @@ -0,0 +1,229 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -18831,9 +18989,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#endif // CC_INTERP + +#endif // CPU_LOONGARCH_VM_FRAME_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/frame_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/frame_loongarch.inline.hpp ---- a/hotspot/src/cpu/loongarch/vm/frame_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/frame_loongarch.inline.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/frame_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/frame_loongarch.inline.hpp +new file mode 100644 +index 0000000000..3d22339ad7 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/frame_loongarch.inline.hpp @@ -0,0 +1,312 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -19147,9 +19307,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // CPU_LOONGARCH_VM_FRAME_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/globalDefinitions_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/globalDefinitions_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/globalDefinitions_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/globalDefinitions_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/globalDefinitions_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/globalDefinitions_loongarch.hpp +new file mode 100644 +index 0000000000..f9f93b9e65 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/globalDefinitions_loongarch.hpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. @@ -19192,9 +19354,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#define SUPPORTS_NATIVE_CX8 + +#endif // CPU_LOONGARCH_VM_GLOBALDEFINITIONS_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/globals_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/globals_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/globals_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/globals_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/globals_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/globals_loongarch.hpp +new file mode 100644 +index 0000000000..182be608a3 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/globals_loongarch.hpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -19299,12 +19463,14 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + "Eliminate barriers for single active cpu") + +#endif // CPU_LOONGARCH_VM_GLOBALS_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/icache_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/icache_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/icache_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/icache_loongarch.cpp 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,42 @@ +diff --git a/hotspot/src/cpu/loongarch/vm/icBuffer_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/icBuffer_loongarch.cpp +new file mode 100644 +index 0000000000..8c78225346 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/icBuffer_loongarch.cpp +@@ -0,0 +1,101 @@ +/* -+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021, Loongson Technology. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * @@ -19330,25 +19496,86 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + +#include "precompiled.hpp" +#include "asm/macroAssembler.hpp" -+#include "runtime/icache.hpp" ++#include "asm/macroAssembler.inline.hpp" ++#include "code/icBuffer.hpp" ++#include "gc_interface/collectedHeap.inline.hpp" ++#include "interpreter/bytecodes.hpp" ++#include "memory/resourceArea.hpp" ++#include "nativeInst_loongarch.hpp" ++#include "oops/oop.inline.hpp" ++#include "oops/oop.inline2.hpp" + -+void ICacheStubGenerator::generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub) -+{ -+#define __ _masm-> -+ StubCodeMark mark(this, "ICache", "flush_icache_stub"); -+ address start = __ pc(); ++#define A0 RA0 ++#define A1 RA1 ++#define A2 RA2 ++#define A3 RA3 ++#define A4 RA4 ++#define A5 RA5 ++#define A6 RA6 ++#define A7 RA7 ++#define T0 RT0 ++#define T1 RT1 ++#define T2 RT2 ++#define T3 RT3 ++#define T4 RT4 ++#define T5 RT5 ++#define T6 RT6 ++#define T7 RT7 ++#define T8 RT8 + -+ __ ibar(0); -+ __ ori(V0, RA2, 0); -+ __ jr(RA); ++int InlineCacheBuffer::ic_stub_code_size() { ++ return NativeMovConstReg::instruction_size + ++ NativeGeneralJump::instruction_size + ++ 1; ++ // so that code_end can be set in CodeBuffer ++ // 64bit 15 = 6 + 8 bytes + 1 byte ++ // 32bit 7 = 2 + 4 bytes + 1 byte ++} + -+ *flush_icache_stub = (ICache::flush_icache_stub_t)start; ++ ++// we use T1 as cached oop(klass) now. this is the target of virtual call, ++// when reach here, the receiver in T0 ++// refer to shareRuntime_loongarch.cpp,gen_i2c2i_adapters ++void InlineCacheBuffer::assemble_ic_buffer_code(address code_begin, void* cached_value, ++ address entry_point) { ++ ResourceMark rm; ++ CodeBuffer code(code_begin, ic_stub_code_size()); ++ MacroAssembler* masm = new MacroAssembler(&code); ++ // note: even though the code contains an embedded oop, we do not need reloc info ++ // because ++ // (1) the oop is old (i.e., doesn't matter for scavenges) ++ // (2) these ICStubs are removed *before* a GC happens, so the roots disappear ++ // assert(cached_oop == NULL || cached_oop->is_perm(), "must be perm oop"); ++#define __ masm-> ++ __ patchable_li52(T1, (long)cached_value); ++ // TODO: confirm reloc ++ __ jmp(entry_point, relocInfo::runtime_call_type); ++ __ flush(); +#undef __ +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/icache_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/icache_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/icache_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/icache_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,41 @@ ++ ++ ++address InlineCacheBuffer::ic_buffer_entry_point(address code_begin) { ++ NativeMovConstReg* move = nativeMovConstReg_at(code_begin); // creation also verifies the object ++ NativeGeneralJump* jump = nativeGeneralJump_at(move->next_instruction_address()); ++ return jump->jump_destination(); ++} ++ ++ ++void* InlineCacheBuffer::ic_buffer_cached_value(address code_begin) { ++ // creation also verifies the object ++ NativeMovConstReg* move = nativeMovConstReg_at(code_begin); ++ // Verifies the jump ++ NativeGeneralJump* jump = nativeGeneralJump_at(move->next_instruction_address()); ++ void* o= (void*)move->data(); ++ return o; ++} +diff --git a/hotspot/src/cpu/loongarch/vm/icache_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/icache_loongarch.cpp +new file mode 100644 +index 0000000000..d577e41f59 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/icache_loongarch.cpp +@@ -0,0 +1,42 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021, Loongson Technology. All rights reserved. @@ -19374,28 +19601,31 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#ifndef CPU_LOONGARCH_VM_ICACHE_LOONGARCH_HPP -+#define CPU_LOONGARCH_VM_ICACHE_LOONGARCH_HPP ++#include "precompiled.hpp" ++#include "asm/macroAssembler.hpp" ++#include "runtime/icache.hpp" + -+// Interface for updating the instruction cache. Whenever the VM modifies -+// code, part of the processor instruction cache potentially has to be flushed. ++void ICacheStubGenerator::generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub) ++{ ++#define __ _masm-> ++ StubCodeMark mark(this, "ICache", "flush_icache_stub"); ++ address start = __ pc(); + -+class ICache : public AbstractICache { -+ public: -+ enum { -+ stub_size = 3 * BytesPerInstWord, // Size of the icache flush stub in bytes -+ line_size = 32, // flush instruction affects a dword -+ log2_line_size = 5 // log2(line_size) -+ }; -+}; ++ __ ibar(0); ++ __ ori(V0, RA2, 0); ++ __ jr(RA); + -+#endif // CPU_LOONGARCH_VM_ICACHE_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/icBuffer_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/icBuffer_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/icBuffer_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/icBuffer_loongarch.cpp 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,101 @@ ++ *flush_icache_stub = (ICache::flush_icache_stub_t)start; ++#undef __ ++} +diff --git a/hotspot/src/cpu/loongarch/vm/icache_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/icache_loongarch.hpp +new file mode 100644 +index 0000000000..15e45cb350 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/icache_loongarch.hpp +@@ -0,0 +1,41 @@ +/* -+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021, Loongson Technology. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * @@ -19419,85 +19649,27 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#include "precompiled.hpp" -+#include "asm/macroAssembler.hpp" -+#include "asm/macroAssembler.inline.hpp" -+#include "code/icBuffer.hpp" -+#include "gc_interface/collectedHeap.inline.hpp" -+#include "interpreter/bytecodes.hpp" -+#include "memory/resourceArea.hpp" -+#include "nativeInst_loongarch.hpp" -+#include "oops/oop.inline.hpp" -+#include "oops/oop.inline2.hpp" -+ -+#define A0 RA0 -+#define A1 RA1 -+#define A2 RA2 -+#define A3 RA3 -+#define A4 RA4 -+#define A5 RA5 -+#define A6 RA6 -+#define A7 RA7 -+#define T0 RT0 -+#define T1 RT1 -+#define T2 RT2 -+#define T3 RT3 -+#define T4 RT4 -+#define T5 RT5 -+#define T6 RT6 -+#define T7 RT7 -+#define T8 RT8 -+ -+int InlineCacheBuffer::ic_stub_code_size() { -+ return NativeMovConstReg::instruction_size + -+ NativeGeneralJump::instruction_size + -+ 1; -+ // so that code_end can be set in CodeBuffer -+ // 64bit 15 = 6 + 8 bytes + 1 byte -+ // 32bit 7 = 2 + 4 bytes + 1 byte -+} -+ -+ -+// we use T1 as cached oop(klass) now. this is the target of virtual call, -+// when reach here, the receiver in T0 -+// refer to shareRuntime_loongarch.cpp,gen_i2c2i_adapters -+void InlineCacheBuffer::assemble_ic_buffer_code(address code_begin, void* cached_value, -+ address entry_point) { -+ ResourceMark rm; -+ CodeBuffer code(code_begin, ic_stub_code_size()); -+ MacroAssembler* masm = new MacroAssembler(&code); -+ // note: even though the code contains an embedded oop, we do not need reloc info -+ // because -+ // (1) the oop is old (i.e., doesn't matter for scavenges) -+ // (2) these ICStubs are removed *before* a GC happens, so the roots disappear -+ // assert(cached_oop == NULL || cached_oop->is_perm(), "must be perm oop"); -+#define __ masm-> -+ __ patchable_li52(T1, (long)cached_value); -+ // TODO: confirm reloc -+ __ jmp(entry_point, relocInfo::runtime_call_type); -+ __ flush(); -+#undef __ -+} -+ ++#ifndef CPU_LOONGARCH_VM_ICACHE_LOONGARCH_HPP ++#define CPU_LOONGARCH_VM_ICACHE_LOONGARCH_HPP + -+address InlineCacheBuffer::ic_buffer_entry_point(address code_begin) { -+ NativeMovConstReg* move = nativeMovConstReg_at(code_begin); // creation also verifies the object -+ NativeGeneralJump* jump = nativeGeneralJump_at(move->next_instruction_address()); -+ return jump->jump_destination(); -+} ++// Interface for updating the instruction cache. Whenever the VM modifies ++// code, part of the processor instruction cache potentially has to be flushed. + ++class ICache : public AbstractICache { ++ public: ++ enum { ++ stub_size = 3 * BytesPerInstWord, // Size of the icache flush stub in bytes ++ line_size = 32, // flush instruction affects a dword ++ log2_line_size = 5 // log2(line_size) ++ }; ++}; + -+void* InlineCacheBuffer::ic_buffer_cached_value(address code_begin) { -+ // creation also verifies the object -+ NativeMovConstReg* move = nativeMovConstReg_at(code_begin); -+ // Verifies the jump -+ NativeGeneralJump* jump = nativeGeneralJump_at(move->next_instruction_address()); -+ void* o= (void*)move->data(); -+ return o; -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.cpp 2023-12-20 09:23:19.788147991 +0800 ++#endif // CPU_LOONGARCH_VM_ICACHE_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.cpp +new file mode 100644 +index 0000000000..8c84f21511 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.cpp @@ -0,0 +1,1960 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -21459,9 +21631,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + unimplemented(); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.hpp b/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.hpp ---- a/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.hpp b/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.hpp +new file mode 100644 +index 0000000000..9113da54ff +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/interp_masm_loongarch_64.hpp @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -21732,9 +21906,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_LOONGARCH_VM_INTERP_MASM_LOONGARCH_64_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/interpreterGenerator_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/interpreterGenerator_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/interpreterGenerator_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/interpreterGenerator_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/interpreterGenerator_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/interpreterGenerator_loongarch.hpp +new file mode 100644 +index 0000000000..7f253b2d51 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/interpreterGenerator_loongarch.hpp @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -21787,13 +21963,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + void generate_counter_overflow(Label* do_continue); + +#endif // CPU_LOONGARCH_VM_INTERPRETERGENERATOR_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/interpreter_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/interpreter_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/interpreter_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/interpreter_loongarch_64.cpp 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,277 @@ +diff --git a/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch.hpp +new file mode 100644 +index 0000000000..052eb997e4 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch.hpp +@@ -0,0 +1,66 @@ +/* -+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. ++ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2021, Loongson Technology. 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 @@ -21816,319 +21994,56 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#include "precompiled.hpp" -+#include "asm/macroAssembler.hpp" -+#include "interpreter/bytecodeHistogram.hpp" -+#include "interpreter/interpreter.hpp" -+#include "interpreter/interpreterGenerator.hpp" -+#include "interpreter/interpreterRuntime.hpp" -+#include "interpreter/templateTable.hpp" -+#include "oops/arrayOop.hpp" -+#include "oops/methodData.hpp" -+#include "oops/method.hpp" -+#include "oops/oop.inline.hpp" -+#include "prims/jvmtiExport.hpp" -+#include "prims/jvmtiThreadState.hpp" -+#include "prims/methodHandles.hpp" -+#include "runtime/arguments.hpp" -+#include "runtime/deoptimization.hpp" -+#include "runtime/frame.inline.hpp" -+#include "runtime/sharedRuntime.hpp" -+#include "runtime/stubRoutines.hpp" -+#include "runtime/synchronizer.hpp" -+#include "runtime/timer.hpp" -+#include "runtime/vframeArray.hpp" -+#include "utilities/debug.hpp" -+ -+#define __ _masm-> -+ -+#define A0 RA0 -+#define A1 RA1 -+#define A2 RA2 -+#define A3 RA3 -+#define A4 RA4 -+#define A5 RA5 -+#define A6 RA6 -+#define A7 RA7 -+#define T0 RT0 -+#define T1 RT1 -+#define T2 RT2 -+#define T3 RT3 -+#define T4 RT4 -+#define T5 RT5 -+#define T6 RT6 -+#define T7 RT7 -+#define T8 RT8 -+ -+address AbstractInterpreterGenerator::generate_slow_signature_handler() { -+ address entry = __ pc(); -+ // Rmethod: method -+ // LVP: pointer to locals -+ // A3: first stack arg -+ __ move(A3, SP); -+ __ addi_d(SP, SP, -18 * wordSize); -+ __ st_d(RA, SP, 0); -+ __ call_VM(noreg, -+ CAST_FROM_FN_PTR(address, -+ InterpreterRuntime::slow_signature_handler), -+ Rmethod, LVP, A3); -+ -+ // V0: result handler -+ -+ // Stack layout: -+ // ... -+ // 18 stack arg0 <--- old sp -+ // 17 floatReg arg7 -+ // ... -+ // 10 floatReg arg0 -+ // 9 float/double identifiers -+ // 8 IntReg arg7 -+ // ... -+ // 2 IntReg arg1 -+ // 1 aligned slot -+ // SP: 0 return address -+ -+ // Do FP first so we can use A3 as temp -+ __ ld_d(A3, Address(SP, 9 * wordSize)); // float/double identifiers -+ -+ for (int i= 0; i < Argument::n_float_register_parameters; i++) { -+ FloatRegister floatreg = as_FloatRegister(i + FA0->encoding()); -+ Label isdouble, done; -+ -+ __ andi(AT, A3, 1 << i); -+ __ bnez(AT, isdouble); -+ __ fld_s(floatreg, SP, (10 + i) * wordSize); -+ __ b(done); -+ __ bind(isdouble); -+ __ fld_d(floatreg, SP, (10 + i) * wordSize); -+ __ bind(done); -+ } -+ -+ // A0 is for env. -+ // If the mothed is not static, A1 will be corrected in generate_native_entry. -+ for (int i= 1; i < Argument::n_register_parameters; i++) { -+ Register reg = as_Register(i + A0->encoding()); -+ -+ __ ld_d(reg, SP, (1 + i) * wordSize); -+ } -+ -+ // A0/V0 contains the result from the call of -+ // InterpreterRuntime::slow_signature_handler so we don't touch it -+ // here. It will be loaded with the JNIEnv* later. -+ __ ld_d(RA, SP, 0); -+ __ addi_d(SP, SP, 18 * wordSize); -+ __ jr(RA); -+ return entry; -+} -+ -+ -+// -+// Various method entries -+// -+ -+address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) { -+ -+ // Rmethod: methodOop -+ // V0: scratrch -+ // Rsender: send 's sp -+ -+ if (!InlineIntrinsics) return NULL; // Generate a vanilla entry ++#ifndef CPU_LOONGARCH_VM_INTERPRETERRT_LOONGARCH_HPP ++#define CPU_LOONGARCH_VM_INTERPRETERRT_LOONGARCH_HPP + -+ address entry_point = __ pc(); -+ //guarantee(0, "LA not implemented yet"); -+ // These don't need a safepoint check because they aren't virtually -+ // callable. We won't enter these intrinsics from compiled code. -+ // If in the future we added an intrinsic which was virtually callable -+ // we'd have to worry about how to safepoint so that this code is used. ++#include "memory/allocation.hpp" + -+ // mathematical functions inlined by compiler -+ // (interpreter must provide identical implementation -+ // in order to avoid monotonicity bugs when switching -+ // from interpreter to compiler in the middle of some -+ // computation) -+ // -+ // stack: [ lo(arg) ] <-- sp -+ // [ hi(arg) ] -+ { -+ // Note: For JDK 1.3 StrictMath exists and Math.sin/cos/sqrt are -+ // java methods. Interpreter::method_kind(...) will select -+ // this entry point for the corresponding methods in JDK 1.3. -+ __ fld_d(FA0, SP, 0 * wordSize); -+ __ fld_d(FA1, SP, 1 * wordSize); -+ __ push2(RA, FP); -+ __ addi_d(FP, SP, 2 * wordSize); ++// native method calls + -+ // [ fp ] <-- sp -+ // [ ra ] -+ // [ lo ] <-- fp -+ // [ hi ] -+ //FIXME, need consider this -+ switch (kind) { -+ case Interpreter::java_lang_math_sin : -+ __ trigfunc('s'); -+ break; -+ case Interpreter::java_lang_math_cos : -+ __ trigfunc('c'); -+ break; -+ case Interpreter::java_lang_math_tan : -+ __ trigfunc('t'); -+ break; -+ case Interpreter::java_lang_math_sqrt: -+ __ fsqrt_d(F0, FA0); -+ break; -+ case Interpreter::java_lang_math_abs: -+ __ fabs_d(F0, FA0); -+ break; -+ case Interpreter::java_lang_math_log: -+ // Store to stack to convert 80bit precision back to 64bits -+ break; -+ case Interpreter::java_lang_math_log10: -+ // Store to stack to convert 80bit precision back to 64bits -+ break; -+ case Interpreter::java_lang_math_pow: -+ break; -+ case Interpreter::java_lang_math_exp: -+ break; ++class SignatureHandlerGenerator: public NativeSignatureIterator { ++ private: ++ MacroAssembler* _masm; ++ unsigned int _num_fp_args; ++ unsigned int _num_int_args; ++ int _stack_offset; + -+ default : -+ ShouldNotReachHere(); -+ } ++ void move(int from_offset, int to_offset); ++ void box(int from_offset, int to_offset); ++ void pass_int(); ++ void pass_long(); ++ void pass_object(); ++ void pass_float(); ++ void pass_double(); + -+ // must maintain return value in F0:F1 -+ __ ld_d(RA, FP, (-1) * wordSize); -+ //FIXME -+ __ ld_d(FP, FP, (-2) * wordSize); -+ __ move(SP, Rsender); -+ __ jr(RA); ++ public: ++ // Creation ++ SignatureHandlerGenerator(methodHandle method, CodeBuffer* buffer) : NativeSignatureIterator(method) { ++ _masm = new MacroAssembler(buffer); ++ _num_int_args = (method->is_static() ? 1 : 0); ++ _num_fp_args = 0; ++ _stack_offset = 0; + } -+ return entry_point; -+} -+ -+ -+// Abstract method entry -+// Attempt to execute abstract method. Throw exception -+address InterpreterGenerator::generate_abstract_entry(void) { -+ -+ // Rmethod: methodOop -+ // V0: receiver (unused) -+ // Rsender : sender 's sp -+ address entry_point = __ pc(); -+ -+ // abstract method entry -+ // throw exception -+ // adjust stack to what a normal return would do -+ __ empty_expression_stack(); -+ __ restore_bcp(); -+ __ restore_locals(); -+ __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError)); -+ // the call_VM checks for exception, so we should never return here. -+ __ should_not_reach_here(); -+ -+ return entry_point; -+} -+ -+ -+// Empty method, generate a very fast return. + -+address InterpreterGenerator::generate_empty_entry(void) { -+ -+ // Rmethod: methodOop -+ // V0: receiver (unused) -+ // Rsender: sender 's sp, must set sp to this value on return, on LoongArch, now use T0, as it right? -+ if (!UseFastEmptyMethods) return NULL; -+ -+ address entry_point = __ pc(); -+ //TODO: LA -+ //guarantee(0, "LA not implemented yet"); -+ Label slow_path; -+ __ li(RT0, SafepointSynchronize::address_of_state()); -+ __ ld_w(AT, RT0, 0); -+ __ li(RT0, (SafepointSynchronize::_not_synchronized)); -+ __ bne(AT, RT0,slow_path); -+ __ move(SP, Rsender); -+ __ jr(RA); -+ __ bind(slow_path); -+ (void) generate_normal_entry(false); -+ return entry_point; -+ -+} -+ -+void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) { -+ -+ // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in -+ // the days we had adapter frames. When we deoptimize a situation where a -+ // compiled caller calls a compiled caller will have registers it expects -+ // to survive the call to the callee. If we deoptimize the callee the only -+ // way we can restore these registers is to have the oldest interpreter -+ // frame that we create restore these values. That is what this routine -+ // will accomplish. ++ // Code generation ++ void generate(uint64_t fingerprint); + -+ // At the moment we have modified c2 to not have any callee save registers -+ // so this problem does not exist and this routine is just a place holder. ++ // Code generation support ++ static Register from(); ++ static Register to(); ++ static Register temp(); ++}; + -+ assert(f->is_interpreted_frame(), "must be interpreted"); -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/interpreter_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/interpreter_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/interpreter_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/interpreter_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,50 @@ ++#endif // CPU_LOONGARCH_VM_INTERPRETERRT_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch_64.cpp +new file mode 100644 +index 0000000000..0c9df4aa71 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch_64.cpp +@@ -0,0 +1,274 @@ +/* -+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_VM_INTERPRETER_LOONGARCH_HPP -+#define CPU_LOONGARCH_VM_INTERPRETER_LOONGARCH_HPP -+ -+ public: -+ -+ // Sentinel placed in the code for interpreter returns so -+ // that i2c adapters and osr code can recognize an interpreter -+ // return address and convert the return to a specialized -+ // block of code to handle compiedl return values and cleaning -+ // the fpu stack. -+ static const int return_sentinel; -+ -+ static Address::ScaleFactor stackElementScale() { -+ return Address::times_8; -+ } -+ -+ // Offset from sp (which points to the last stack element) -+ static int expr_offset_in_bytes(int i) { return stackElementSize * i; } -+ // Size of interpreter code. Increase if too small. Interpreter will -+ // fail with a guarantee ("not enough space for interpreter generation"); -+ // if too small. -+ // Run with +PrintInterpreterSize to get the VM to print out the size. -+ // Max size with JVMTI and TaggedStackInterpreter -+ const static int InterpreterCodeSize = 168 * 1024; -+#endif // CPU_LOONGARCH_VM_INTERPRETER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch_64.cpp 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,274 @@ -+/* -+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2021, Loongson Technology. All rights reserved. ++ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2021, Loongson Technology. 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 @@ -22400,13 +22315,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // return result handler + return Interpreter::result_handler(m->result_type()); +IRT_END -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/interpreterRT_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,66 @@ +diff --git a/hotspot/src/cpu/loongarch/vm/interpreter_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/interpreter_loongarch.hpp +new file mode 100644 +index 0000000000..c83afbdaf0 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/interpreter_loongarch.hpp +@@ -0,0 +1,50 @@ +/* -+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2021, Loongson Technology. All rights reserved. ++ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. 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 @@ -22429,50 +22346,319 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#ifndef CPU_LOONGARCH_VM_INTERPRETERRT_LOONGARCH_HPP -+#define CPU_LOONGARCH_VM_INTERPRETERRT_LOONGARCH_HPP ++#ifndef CPU_LOONGARCH_VM_INTERPRETER_LOONGARCH_HPP ++#define CPU_LOONGARCH_VM_INTERPRETER_LOONGARCH_HPP + -+#include "memory/allocation.hpp" ++ public: + -+// native method calls ++ // Sentinel placed in the code for interpreter returns so ++ // that i2c adapters and osr code can recognize an interpreter ++ // return address and convert the return to a specialized ++ // block of code to handle compiedl return values and cleaning ++ // the fpu stack. ++ static const int return_sentinel; + -+class SignatureHandlerGenerator: public NativeSignatureIterator { -+ private: -+ MacroAssembler* _masm; -+ unsigned int _num_fp_args; -+ unsigned int _num_int_args; -+ int _stack_offset; ++ static Address::ScaleFactor stackElementScale() { ++ return Address::times_8; ++ } + -+ void move(int from_offset, int to_offset); -+ void box(int from_offset, int to_offset); -+ void pass_int(); -+ void pass_long(); -+ void pass_object(); -+ void pass_float(); -+ void pass_double(); ++ // Offset from sp (which points to the last stack element) ++ static int expr_offset_in_bytes(int i) { return stackElementSize * i; } ++ // Size of interpreter code. Increase if too small. Interpreter will ++ // fail with a guarantee ("not enough space for interpreter generation"); ++ // if too small. ++ // Run with +PrintInterpreterSize to get the VM to print out the size. ++ // Max size with JVMTI and TaggedStackInterpreter ++ const static int InterpreterCodeSize = 168 * 1024; ++#endif // CPU_LOONGARCH_VM_INTERPRETER_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/interpreter_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/interpreter_loongarch_64.cpp +new file mode 100644 +index 0000000000..5a4f102cfd +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/interpreter_loongarch_64.cpp +@@ -0,0 +1,277 @@ ++/* ++ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. 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. ++ * ++ */ + -+ public: -+ // Creation -+ SignatureHandlerGenerator(methodHandle method, CodeBuffer* buffer) : NativeSignatureIterator(method) { -+ _masm = new MacroAssembler(buffer); -+ _num_int_args = (method->is_static() ? 1 : 0); -+ _num_fp_args = 0; -+ _stack_offset = 0; ++#include "precompiled.hpp" ++#include "asm/macroAssembler.hpp" ++#include "interpreter/bytecodeHistogram.hpp" ++#include "interpreter/interpreter.hpp" ++#include "interpreter/interpreterGenerator.hpp" ++#include "interpreter/interpreterRuntime.hpp" ++#include "interpreter/templateTable.hpp" ++#include "oops/arrayOop.hpp" ++#include "oops/methodData.hpp" ++#include "oops/method.hpp" ++#include "oops/oop.inline.hpp" ++#include "prims/jvmtiExport.hpp" ++#include "prims/jvmtiThreadState.hpp" ++#include "prims/methodHandles.hpp" ++#include "runtime/arguments.hpp" ++#include "runtime/deoptimization.hpp" ++#include "runtime/frame.inline.hpp" ++#include "runtime/sharedRuntime.hpp" ++#include "runtime/stubRoutines.hpp" ++#include "runtime/synchronizer.hpp" ++#include "runtime/timer.hpp" ++#include "runtime/vframeArray.hpp" ++#include "utilities/debug.hpp" ++ ++#define __ _masm-> ++ ++#define A0 RA0 ++#define A1 RA1 ++#define A2 RA2 ++#define A3 RA3 ++#define A4 RA4 ++#define A5 RA5 ++#define A6 RA6 ++#define A7 RA7 ++#define T0 RT0 ++#define T1 RT1 ++#define T2 RT2 ++#define T3 RT3 ++#define T4 RT4 ++#define T5 RT5 ++#define T6 RT6 ++#define T7 RT7 ++#define T8 RT8 ++ ++address AbstractInterpreterGenerator::generate_slow_signature_handler() { ++ address entry = __ pc(); ++ // Rmethod: method ++ // LVP: pointer to locals ++ // A3: first stack arg ++ __ move(A3, SP); ++ __ addi_d(SP, SP, -18 * wordSize); ++ __ st_d(RA, SP, 0); ++ __ call_VM(noreg, ++ CAST_FROM_FN_PTR(address, ++ InterpreterRuntime::slow_signature_handler), ++ Rmethod, LVP, A3); ++ ++ // V0: result handler ++ ++ // Stack layout: ++ // ... ++ // 18 stack arg0 <--- old sp ++ // 17 floatReg arg7 ++ // ... ++ // 10 floatReg arg0 ++ // 9 float/double identifiers ++ // 8 IntReg arg7 ++ // ... ++ // 2 IntReg arg1 ++ // 1 aligned slot ++ // SP: 0 return address ++ ++ // Do FP first so we can use A3 as temp ++ __ ld_d(A3, Address(SP, 9 * wordSize)); // float/double identifiers ++ ++ for (int i= 0; i < Argument::n_float_register_parameters; i++) { ++ FloatRegister floatreg = as_FloatRegister(i + FA0->encoding()); ++ Label isdouble, done; ++ ++ __ andi(AT, A3, 1 << i); ++ __ bnez(AT, isdouble); ++ __ fld_s(floatreg, SP, (10 + i) * wordSize); ++ __ b(done); ++ __ bind(isdouble); ++ __ fld_d(floatreg, SP, (10 + i) * wordSize); ++ __ bind(done); + } + -+ // Code generation -+ void generate(uint64_t fingerprint); ++ // A0 is for env. ++ // If the mothed is not static, A1 will be corrected in generate_native_entry. ++ for (int i= 1; i < Argument::n_register_parameters; i++) { ++ Register reg = as_Register(i + A0->encoding()); + -+ // Code generation support -+ static Register from(); -+ static Register to(); -+ static Register temp(); -+}; ++ __ ld_d(reg, SP, (1 + i) * wordSize); ++ } + -+#endif // CPU_LOONGARCH_VM_INTERPRETERRT_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/javaFrameAnchor_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/javaFrameAnchor_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/javaFrameAnchor_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/javaFrameAnchor_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 ++ // A0/V0 contains the result from the call of ++ // InterpreterRuntime::slow_signature_handler so we don't touch it ++ // here. It will be loaded with the JNIEnv* later. ++ __ ld_d(RA, SP, 0); ++ __ addi_d(SP, SP, 18 * wordSize); ++ __ jr(RA); ++ return entry; ++} ++ ++ ++// ++// Various method entries ++// ++ ++address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) { ++ ++ // Rmethod: methodOop ++ // V0: scratrch ++ // Rsender: send 's sp ++ ++ if (!InlineIntrinsics) return NULL; // Generate a vanilla entry ++ ++ address entry_point = __ pc(); ++ //guarantee(0, "LA not implemented yet"); ++ // These don't need a safepoint check because they aren't virtually ++ // callable. We won't enter these intrinsics from compiled code. ++ // If in the future we added an intrinsic which was virtually callable ++ // we'd have to worry about how to safepoint so that this code is used. ++ ++ // mathematical functions inlined by compiler ++ // (interpreter must provide identical implementation ++ // in order to avoid monotonicity bugs when switching ++ // from interpreter to compiler in the middle of some ++ // computation) ++ // ++ // stack: [ lo(arg) ] <-- sp ++ // [ hi(arg) ] ++ { ++ // Note: For JDK 1.3 StrictMath exists and Math.sin/cos/sqrt are ++ // java methods. Interpreter::method_kind(...) will select ++ // this entry point for the corresponding methods in JDK 1.3. ++ __ fld_d(FA0, SP, 0 * wordSize); ++ __ fld_d(FA1, SP, 1 * wordSize); ++ __ push2(RA, FP); ++ __ addi_d(FP, SP, 2 * wordSize); ++ ++ // [ fp ] <-- sp ++ // [ ra ] ++ // [ lo ] <-- fp ++ // [ hi ] ++ //FIXME, need consider this ++ switch (kind) { ++ case Interpreter::java_lang_math_sin : ++ __ trigfunc('s'); ++ break; ++ case Interpreter::java_lang_math_cos : ++ __ trigfunc('c'); ++ break; ++ case Interpreter::java_lang_math_tan : ++ __ trigfunc('t'); ++ break; ++ case Interpreter::java_lang_math_sqrt: ++ __ fsqrt_d(F0, FA0); ++ break; ++ case Interpreter::java_lang_math_abs: ++ __ fabs_d(F0, FA0); ++ break; ++ case Interpreter::java_lang_math_log: ++ // Store to stack to convert 80bit precision back to 64bits ++ break; ++ case Interpreter::java_lang_math_log10: ++ // Store to stack to convert 80bit precision back to 64bits ++ break; ++ case Interpreter::java_lang_math_pow: ++ break; ++ case Interpreter::java_lang_math_exp: ++ break; ++ ++ default : ++ ShouldNotReachHere(); ++ } ++ ++ // must maintain return value in F0:F1 ++ __ ld_d(RA, FP, (-1) * wordSize); ++ //FIXME ++ __ ld_d(FP, FP, (-2) * wordSize); ++ __ move(SP, Rsender); ++ __ jr(RA); ++ } ++ return entry_point; ++} ++ ++ ++// Abstract method entry ++// Attempt to execute abstract method. Throw exception ++address InterpreterGenerator::generate_abstract_entry(void) { ++ ++ // Rmethod: methodOop ++ // V0: receiver (unused) ++ // Rsender : sender 's sp ++ address entry_point = __ pc(); ++ ++ // abstract method entry ++ // throw exception ++ // adjust stack to what a normal return would do ++ __ empty_expression_stack(); ++ __ restore_bcp(); ++ __ restore_locals(); ++ __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError)); ++ // the call_VM checks for exception, so we should never return here. ++ __ should_not_reach_here(); ++ ++ return entry_point; ++} ++ ++ ++// Empty method, generate a very fast return. ++ ++address InterpreterGenerator::generate_empty_entry(void) { ++ ++ // Rmethod: methodOop ++ // V0: receiver (unused) ++ // Rsender: sender 's sp, must set sp to this value on return, on LoongArch, now use T0, as it right? ++ if (!UseFastEmptyMethods) return NULL; ++ ++ address entry_point = __ pc(); ++ //TODO: LA ++ //guarantee(0, "LA not implemented yet"); ++ Label slow_path; ++ __ li(RT0, SafepointSynchronize::address_of_state()); ++ __ ld_w(AT, RT0, 0); ++ __ li(RT0, (SafepointSynchronize::_not_synchronized)); ++ __ bne(AT, RT0,slow_path); ++ __ move(SP, Rsender); ++ __ jr(RA); ++ __ bind(slow_path); ++ (void) generate_normal_entry(false); ++ return entry_point; ++ ++} ++ ++void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) { ++ ++ // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in ++ // the days we had adapter frames. When we deoptimize a situation where a ++ // compiled caller calls a compiled caller will have registers it expects ++ // to survive the call to the callee. If we deoptimize the callee the only ++ // way we can restore these registers is to have the oldest interpreter ++ // frame that we create restore these values. That is what this routine ++ // will accomplish. ++ ++ // At the moment we have modified c2 to not have any callee save registers ++ // so this problem does not exist and this routine is just a place holder. ++ ++ assert(f->is_interpreted_frame(), "must be interpreted"); ++} +diff --git a/hotspot/src/cpu/loongarch/vm/javaFrameAnchor_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/javaFrameAnchor_loongarch.hpp +new file mode 100644 +index 0000000000..de97de5804 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/javaFrameAnchor_loongarch.hpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -22561,9 +22747,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + void set_last_Java_fp(intptr_t* fp) { _last_Java_fp = fp; } + +#endif // CPU_LOONGARCH_VM_JAVAFRAMEANCHOR_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/jniFastGetField_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/jniFastGetField_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/jniFastGetField_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/jniFastGetField_loongarch_64.cpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/jniFastGetField_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/jniFastGetField_loongarch_64.cpp +new file mode 100644 +index 0000000000..5b52e54e08 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/jniFastGetField_loongarch_64.cpp @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. @@ -22734,64 +22922,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +address JNI_FastGetField::generate_fast_get_double_field() { + return generate_fast_get_int_field0(T_DOUBLE); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/jni_loongarch.h b/hotspot/src/cpu/loongarch/vm/jni_loongarch.h ---- a/hotspot/src/cpu/loongarch/vm/jni_loongarch.h 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/jni_loongarch.h 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,51 @@ -+/* -+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. Oracle designates this -+ * particular file as subject to the "Classpath" exception as provided -+ * by Oracle in the LICENSE file that accompanied this code. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ */ -+ -+#ifndef _JAVASOFT_JNI_MD_H_ -+#define _JAVASOFT_JNI_MD_H_ -+ -+// Note: please do not change these without also changing jni_md.h in the JDK -+// repository -+#ifndef __has_attribute -+ #define __has_attribute(x) 0 -+#endif -+#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) -+ #define JNIEXPORT __attribute__((visibility("default"))) -+ #define JNIIMPORT __attribute__((visibility("default"))) -+#else -+ #define JNIEXPORT -+ #define JNIIMPORT -+#endif -+ -+#define JNICALL -+ -+typedef int jint; -+ -+ typedef long jlong; -+ -+typedef signed char jbyte; -+ -+#endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/jniTypes_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/jniTypes_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/jniTypes_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/jniTypes_loongarch.hpp 2023-12-20 09:23:19.788147991 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/jniTypes_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/jniTypes_loongarch.hpp +new file mode 100644 +index 0000000000..554ff216ac +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/jniTypes_loongarch.hpp @@ -0,0 +1,144 @@ +/* + * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. @@ -22937,9 +23072,98 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_LOONGARCH_VM_JNITYPES_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/loongarch_64.ad b/hotspot/src/cpu/loongarch/vm/loongarch_64.ad ---- a/hotspot/src/cpu/loongarch/vm/loongarch_64.ad 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/loongarch_64.ad 2024-01-30 13:54:24.792708955 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/jni_loongarch.h b/hotspot/src/cpu/loongarch/vm/jni_loongarch.h +new file mode 100644 +index 0000000000..eb25cbc354 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/jni_loongarch.h +@@ -0,0 +1,51 @@ ++/* ++ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. Oracle designates this ++ * particular file as subject to the "Classpath" exception as provided ++ * by Oracle in the LICENSE file that accompanied this code. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++#ifndef _JAVASOFT_JNI_MD_H_ ++#define _JAVASOFT_JNI_MD_H_ ++ ++// Note: please do not change these without also changing jni_md.h in the JDK ++// repository ++#ifndef __has_attribute ++ #define __has_attribute(x) 0 ++#endif ++#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) ++ #define JNIEXPORT __attribute__((visibility("default"))) ++ #define JNIIMPORT __attribute__((visibility("default"))) ++#else ++ #define JNIEXPORT ++ #define JNIIMPORT ++#endif ++ ++#define JNICALL ++ ++typedef int jint; ++ ++ typedef long jlong; ++ ++typedef signed char jbyte; ++ ++#endif +diff --git a/hotspot/src/cpu/loongarch/vm/loongarch.ad b/hotspot/src/cpu/loongarch/vm/loongarch.ad +new file mode 100644 +index 0000000000..48c44779e7 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/loongarch.ad +@@ -0,0 +1,24 @@ ++// ++// Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. ++// Copyright (c) 2015, 2020, Loongson Technology. 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. ++// ++// +diff --git a/hotspot/src/cpu/loongarch/vm/loongarch_64.ad b/hotspot/src/cpu/loongarch/vm/loongarch_64.ad +new file mode 100644 +index 0000000000..fa4bf6e170 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/loongarch_64.ad @@ -0,0 +1,12861 @@ +// +// Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -35802,37 +36026,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// These must follow all instruction definitions as they use the names +// defined in the instructions definitions. + -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/loongarch.ad b/hotspot/src/cpu/loongarch/vm/loongarch.ad ---- a/hotspot/src/cpu/loongarch/vm/loongarch.ad 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/loongarch.ad 2023-12-20 09:23:19.788147991 +0800 -@@ -0,0 +1,24 @@ -+// -+// Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. -+// Copyright (c) 2015, 2020, Loongson Technology. 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. -+// -+// -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.cpp +new file mode 100644 +index 0000000000..89295343ce +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.cpp @@ -0,0 +1,3895 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -39729,9 +39927,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + bind(L_exit); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.hpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.hpp +new file mode 100644 +index 0000000000..8b123c2906 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.hpp @@ -0,0 +1,771 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -40504,9 +40704,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_LOONGARCH_VM_MACROASSEMBLER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.inline.hpp ---- a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.inline.hpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.inline.hpp +new file mode 100644 +index 0000000000..0b265a4def +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/macroAssembler_loongarch.inline.hpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -40542,9 +40744,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#include "code/codeCache.hpp" + +#endif // CPU_LOONGARCH_VM_MACROASSEMBLER_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/metaspaceShared_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/metaspaceShared_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/metaspaceShared_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/metaspaceShared_loongarch_64.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/metaspaceShared_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/metaspaceShared_loongarch_64.cpp +new file mode 100644 +index 0000000000..b36216c533 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/metaspaceShared_loongarch_64.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. @@ -40666,9 +40870,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + *mc_top = (char*)__ pc(); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.cpp +new file mode 100644 +index 0000000000..cb31ca5ad5 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.cpp @@ -0,0 +1,566 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -41236,9 +41442,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) { +} +#endif //PRODUCT -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.hpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.hpp +new file mode 100644 +index 0000000000..f84337424b +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/methodHandles_loongarch.hpp @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. @@ -41302,9 +41510,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // Should be in sharedRuntime, not here. + return R3; + } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.cpp +new file mode 100644 +index 0000000000..639ac6cd3e +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.cpp @@ -0,0 +1,485 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -41791,9 +42001,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return Assembler::high(insn_word(), 10) == Assembler::ld_w_op && + Assembler::low(insn_word(), 5) == AT->encoding(); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.hpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.hpp +new file mode 100644 +index 0000000000..493239923b +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/nativeInst_loongarch.hpp @@ -0,0 +1,513 @@ +/* + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. @@ -42308,9 +42520,62 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return (NativeCallTrampolineStub*)addr; +} +#endif // CPU_LOONGARCH_VM_NATIVEINST_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/register_definitions_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/register_definitions_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/register_definitions_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/register_definitions_loongarch.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/registerMap_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/registerMap_loongarch.hpp +new file mode 100644 +index 0000000000..5ff7555d2f +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/registerMap_loongarch.hpp +@@ -0,0 +1,45 @@ ++/* ++ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_LOONGARCH_VM_REGISTERMAP_LOONGARCH_HPP ++#define CPU_LOONGARCH_VM_REGISTERMAP_LOONGARCH_HPP ++ ++// machine-dependent implemention for register maps ++ friend class frame; ++ ++ private: ++ // This is the hook for finding a register in an "well-known" location, ++ // such as a register block of a predetermined format. ++ // Since there is none, we just return NULL. ++ // See registerMap_sparc.hpp for an example of grabbing registers ++ // from register save areas of a standard layout. ++ address pd_location(VMReg reg) const {return NULL;} ++ ++ // no PD state to clear or copy: ++ void pd_clear() {} ++ void pd_initialize() {} ++ void pd_initialize_from(const RegisterMap* map) {} ++ ++#endif // CPU_LOONGARCH_VM_REGISTERMAP_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/register_definitions_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/register_definitions_loongarch.cpp +new file mode 100644 +index 0000000000..c6424c321f +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/register_definitions_loongarch.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. @@ -42415,9 +42680,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +REGISTER_DEFINITION(FloatRegister, f29); +REGISTER_DEFINITION(FloatRegister, f30); +REGISTER_DEFINITION(FloatRegister, f31); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/register_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/register_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/register_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/register_loongarch.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/register_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/register_loongarch.cpp +new file mode 100644 +index 0000000000..3104cd1cc5 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/register_loongarch.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. @@ -42478,9 +42745,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + }; + return is_valid() ? names[encoding()] : "fccnoreg"; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/register_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/register_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/register_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/register_loongarch.hpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/register_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/register_loongarch.hpp +new file mode 100644 +index 0000000000..37b39f9129 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/register_loongarch.hpp @@ -0,0 +1,436 @@ +/* + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. @@ -42918,58 +43187,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif //CPU_LOONGARCH_VM_REGISTER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/registerMap_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/registerMap_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/registerMap_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/registerMap_loongarch.hpp 2023-12-20 09:23:19.791481286 +0800 -@@ -0,0 +1,45 @@ -+/* -+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_VM_REGISTERMAP_LOONGARCH_HPP -+#define CPU_LOONGARCH_VM_REGISTERMAP_LOONGARCH_HPP -+ -+// machine-dependent implemention for register maps -+ friend class frame; -+ -+ private: -+ // This is the hook for finding a register in an "well-known" location, -+ // such as a register block of a predetermined format. -+ // Since there is none, we just return NULL. -+ // See registerMap_sparc.hpp for an example of grabbing registers -+ // from register save areas of a standard layout. -+ address pd_location(VMReg reg) const {return NULL;} -+ -+ // no PD state to clear or copy: -+ void pd_clear() {} -+ void pd_initialize() {} -+ void pd_initialize_from(const RegisterMap* map) {} -+ -+#endif // CPU_LOONGARCH_VM_REGISTERMAP_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.cpp +new file mode 100644 +index 0000000000..bf4498dc62 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. @@ -43101,9 +43323,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + +void metadata_Relocation::pd_fix_value(address x) { +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.hpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.hpp +new file mode 100644 +index 0000000000..211242f3fb +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/relocInfo_loongarch.hpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -43145,9 +43369,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + }; + +#endif // CPU_LOONGARCH_VM_RELOCINFO_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/runtime_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/runtime_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/runtime_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/runtime_loongarch_64.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/runtime_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/runtime_loongarch_64.cpp +new file mode 100644 +index 0000000000..e6ee65f367 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/runtime_loongarch_64.cpp @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. @@ -43348,9 +43574,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + masm->flush(); + _exception_blob = ExceptionBlob::create(&buffer, oop_maps, framesize); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/sharedRuntime_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/sharedRuntime_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/sharedRuntime_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/sharedRuntime_loongarch_64.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/sharedRuntime_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/sharedRuntime_loongarch_64.cpp +new file mode 100644 +index 0000000000..36786b53bd +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/sharedRuntime_loongarch_64.cpp @@ -0,0 +1,3453 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -46805,9 +47033,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +extern "C" int SpinPause() {return 0;} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/stubGenerator_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/stubGenerator_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/stubGenerator_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/stubGenerator_loongarch_64.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/stubGenerator_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/stubGenerator_loongarch_64.cpp +new file mode 100644 +index 0000000000..361b775144 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/stubGenerator_loongarch_64.cpp @@ -0,0 +1,3445 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -50254,9 +50484,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +void StubGenerator_generate(CodeBuffer* code, bool all) { + StubGenerator g(code, all); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.cpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.cpp +new file mode 100644 +index 0000000000..f0f3d55a4e +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.cpp @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -50522,9 +50754,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + 0x02D578EDUL, 0x7DAEED62UL, // word swap + 0xD502ED78UL, 0xAE7D62EDUL, // byte swap of word swap +}; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.hpp b/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.hpp ---- a/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.hpp 2023-12-20 09:23:19.791481286 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.hpp b/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.hpp +new file mode 100644 +index 0000000000..d020a527e4 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/stubRoutines_loongarch_64.hpp @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -50586,9 +50820,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_LOONGARCH_VM_STUBROUTINES_LOONGARCH_64_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/templateInterpreterGenerator_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/templateInterpreterGenerator_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/templateInterpreterGenerator_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/templateInterpreterGenerator_loongarch.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/templateInterpreterGenerator_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/templateInterpreterGenerator_loongarch.hpp +new file mode 100644 +index 0000000000..213e69b0b2 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/templateInterpreterGenerator_loongarch.hpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -50625,9 +50861,58 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // address generate_asm_interpreter_entry(bool synchronized); + +#endif // CPU_LOONGARCH_VM_TEMPLATEINTERPRETERGENERATOR_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch_64.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch.hpp +new file mode 100644 +index 0000000000..39e3ad7bb5 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch.hpp +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_LOONGARCH_VM_TEMPLATEINTERPRETER_LOONGARCH_HPP ++#define CPU_LOONGARCH_VM_TEMPLATEINTERPRETER_LOONGARCH_HPP ++ ++ ++ protected: ++ ++ // Size of interpreter code. Increase if too small. Interpreter will ++ // fail with a guarantee ("not enough space for interpreter generation"); ++ // if too small. ++ // Run with +PrintInterpreter to get the VM to print out the size. ++ // Max size with JVMTI ++ // The sethi() instruction generates lots more instructions when shell ++ // stack limit is unlimited, so that's why this is much bigger. ++ const static int InterpreterCodeSize = 500 * K; ++ ++#endif // CPU_LOONGARCH_VM_TEMPLATEINTERPRETER_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch_64.cpp +new file mode 100644 +index 0000000000..b25086a399 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch_64.cpp @@ -0,0 +1,2335 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -52964,54 +53249,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} +#endif // !PRODUCT +#endif // ! CC_INTERP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/templateInterpreter_loongarch.hpp 2023-12-20 09:23:19.794814582 +0800 -@@ -0,0 +1,41 @@ -+/* -+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_VM_TEMPLATEINTERPRETER_LOONGARCH_HPP -+#define CPU_LOONGARCH_VM_TEMPLATEINTERPRETER_LOONGARCH_HPP -+ -+ -+ protected: -+ -+ // Size of interpreter code. Increase if too small. Interpreter will -+ // fail with a guarantee ("not enough space for interpreter generation"); -+ // if too small. -+ // Run with +PrintInterpreter to get the VM to print out the size. -+ // Max size with JVMTI -+ // The sethi() instruction generates lots more instructions when shell -+ // stack limit is unlimited, so that's why this is much bigger. -+ const static int InterpreterCodeSize = 500 * K; -+ -+#endif // CPU_LOONGARCH_VM_TEMPLATEINTERPRETER_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.cpp +new file mode 100644 +index 0000000000..228217f001 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.cpp @@ -0,0 +1,4024 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -57037,9 +57279,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + __ membar(__ AnyAny);//no membar here for aarch64 +} +#endif // !CC_INTERP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.hpp b/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.hpp ---- a/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.hpp b/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.hpp +new file mode 100644 +index 0000000000..c48d76e0a2 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/templateTable_loongarch_64.hpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. @@ -57085,12 +57329,14 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + static void index_check_without_pop(Register array, Register index); + +#endif // CPU_LOONGARCH_VM_TEMPLATETABLE_LOONGARCH_64_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.cpp 2023-12-20 09:23:19.794814582 +0800 -@@ -0,0 +1,51 @@ +diff --git a/hotspot/src/cpu/loongarch/vm/vmStructs_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/vmStructs_loongarch.hpp +new file mode 100644 +index 0000000000..7c3ce68010 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vmStructs_loongarch.hpp +@@ -0,0 +1,68 @@ +/* -+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * @@ -57114,220 +57360,58 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#include "precompiled.hpp" -+#include "asm/assembler.hpp" -+#include "code/vmreg.hpp" ++#ifndef CPU_LOONGARCH_VM_VMSTRUCTS_LOONGARCH_HPP ++#define CPU_LOONGARCH_VM_VMSTRUCTS_LOONGARCH_HPP + ++// These are the CPU-specific fields, types and integer ++// constants required by the Serviceability Agent. This file is ++// referenced by vmStructs.cpp. + ++#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ ++ \ ++ /******************************/ \ ++ /* JavaCallWrapper */ \ ++ /******************************/ \ ++ /******************************/ \ ++ /* JavaFrameAnchor */ \ ++ /******************************/ \ ++ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) \ ++ \ + -+void VMRegImpl::set_regName() { -+ Register reg = ::as_Register(0); -+ int i; -+ for (i = 0; i < ConcreteRegisterImpl::max_gpr ; ) { -+ regName[i++] = reg->name(); -+ regName[i++] = reg->name(); -+ reg = reg->successor(); -+ } ++ /* NOTE that we do not use the last_entry() macro here; it is used */ ++ /* in vmStructs__.hpp's VM_STRUCTS_OS_CPU macro (and must */ ++ /* be present there) */ + -+ FloatRegister freg = ::as_FloatRegister(0); -+ for ( ; i < ConcreteRegisterImpl::max_fpr ; ) { -+ regName[i++] = freg->name(); -+ regName[i++] = freg->name(); -+ freg = freg->successor(); -+ } + -+ for ( ; i < ConcreteRegisterImpl::number_of_registers ; i ++ ) { -+ regName[i] = "NON-GPR-FPR"; -+ } -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.hpp 2023-12-20 09:23:19.794814582 +0800 -@@ -0,0 +1,35 @@ ++#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \ ++ ++ /* NOTE that we do not use the last_entry() macro here; it is used */ ++ /* in vmStructs__.hpp's VM_TYPES_OS_CPU macro (and must */ ++ /* be present there) */ ++ ++ ++#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ ++ ++ /* NOTE that we do not use the last_entry() macro here; it is used */ ++ /* in vmStructs__.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */ ++ /* be present there) */ ++ ++#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ ++ ++ /* NOTE that we do not use the last_entry() macro here; it is used */ ++ /* in vmStructs__.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */ ++ /* be present there) */ ++ ++#endif // CPU_LOONGARCH_VM_VMSTRUCTS_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.cpp +new file mode 100644 +index 0000000000..c71f64e132 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.cpp +@@ -0,0 +1,84 @@ +/* -+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_VM_VMREG_LOONGARCH_HPP -+#define CPU_LOONGARCH_VM_VMREG_LOONGARCH_HPP -+ -+bool is_Register(); -+Register as_Register(); -+ -+bool is_FloatRegister(); -+FloatRegister as_FloatRegister(); -+ -+#endif // CPU_LOONGARCH_VM_VMREG_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.inline.hpp ---- a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.inline.hpp 2023-12-20 09:23:19.794814582 +0800 -@@ -0,0 +1,66 @@ -+/* -+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_VM_VMREG_LOONGARCH_INLINE_HPP -+#define CPU_LOONGARCH_VM_VMREG_LOONGARCH_INLINE_HPP -+ -+inline VMReg RegisterImpl::as_VMReg() { -+ if( this==noreg ) return VMRegImpl::Bad(); -+ return VMRegImpl::as_VMReg(encoding() << 1 ); -+} -+ -+inline VMReg FloatRegisterImpl::as_VMReg() { -+ return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr); -+} -+ -+inline bool VMRegImpl::is_Register() { -+ return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr; -+} -+ -+inline bool VMRegImpl::is_FloatRegister() { -+ return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr; -+} -+ -+inline Register VMRegImpl::as_Register() { -+ -+ assert( is_Register(), "must be"); -+ return ::as_Register(value() >> 1); -+} -+ -+inline FloatRegister VMRegImpl::as_FloatRegister() { -+ assert( is_FloatRegister(), "must be" ); -+ assert( is_even(value()), "must be" ); -+ return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1); -+} -+ -+inline bool VMRegImpl::is_concrete() { -+ assert(is_reg(), "must be"); -+ if(is_Register()) return true; -+ if(is_FloatRegister()) return true; -+ assert(false, "what register?"); -+ return false; -+} -+ -+#endif // CPU_LOONGARCH_VM_VMREG_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vmStructs_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/vmStructs_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/vmStructs_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vmStructs_loongarch.hpp 2023-12-20 09:23:19.794814582 +0800 -@@ -0,0 +1,68 @@ -+/* -+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_LOONGARCH_VM_VMSTRUCTS_LOONGARCH_HPP -+#define CPU_LOONGARCH_VM_VMSTRUCTS_LOONGARCH_HPP -+ -+// These are the CPU-specific fields, types and integer -+// constants required by the Serviceability Agent. This file is -+// referenced by vmStructs.cpp. -+ -+#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ -+ \ -+ /******************************/ \ -+ /* JavaCallWrapper */ \ -+ /******************************/ \ -+ /******************************/ \ -+ /* JavaFrameAnchor */ \ -+ /******************************/ \ -+ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) \ -+ \ -+ -+ /* NOTE that we do not use the last_entry() macro here; it is used */ -+ /* in vmStructs__.hpp's VM_STRUCTS_OS_CPU macro (and must */ -+ /* be present there) */ -+ -+ -+#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \ -+ -+ /* NOTE that we do not use the last_entry() macro here; it is used */ -+ /* in vmStructs__.hpp's VM_TYPES_OS_CPU macro (and must */ -+ /* be present there) */ -+ -+ -+#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ -+ -+ /* NOTE that we do not use the last_entry() macro here; it is used */ -+ /* in vmStructs__.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */ -+ /* be present there) */ -+ -+#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ -+ -+ /* NOTE that we do not use the last_entry() macro here; it is used */ -+ /* in vmStructs__.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */ -+ /* be present there) */ -+ -+#endif // CPU_LOONGARCH_VM_VMSTRUCTS_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.cpp 2023-12-20 09:23:19.794814582 +0800 -@@ -0,0 +1,84 @@ -+/* -+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2018, 2020, Loongson Technology. All rights reserved. ++ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2018, 2020, Loongson Technology. 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 @@ -57409,9 +57493,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + strncpy(tmp, _cpu_desc, CPU_DETAILED_DESC_BUF_SIZE); + return tmp; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.hpp +new file mode 100644 +index 0000000000..682dd9c78f +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vm_version_ext_loongarch.hpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. @@ -57467,9 +57553,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_LOONGARCH_VM_VM_VERSION_EXT_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.cpp ---- a/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.cpp +new file mode 100644 +index 0000000000..81ea3b230c +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.cpp @@ -0,0 +1,443 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -57914,9 +58002,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + get_processor_features(); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.hpp ---- a/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.hpp +new file mode 100644 +index 0000000000..3b5f907a79 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vm_version_loongarch.hpp @@ -0,0 +1,299 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -58217,9 +58307,181 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_LOONGARCH_VM_VM_VERSION_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/loongarch/vm/vtableStubs_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/vtableStubs_loongarch_64.cpp ---- a/hotspot/src/cpu/loongarch/vm/vtableStubs_loongarch_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/loongarch/vm/vtableStubs_loongarch_64.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.cpp b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.cpp +new file mode 100644 +index 0000000000..52bccfc183 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.cpp +@@ -0,0 +1,51 @@ ++/* ++ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. 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 "precompiled.hpp" ++#include "asm/assembler.hpp" ++#include "code/vmreg.hpp" ++ ++ ++ ++void VMRegImpl::set_regName() { ++ Register reg = ::as_Register(0); ++ int i; ++ for (i = 0; i < ConcreteRegisterImpl::max_gpr ; ) { ++ regName[i++] = reg->name(); ++ regName[i++] = reg->name(); ++ reg = reg->successor(); ++ } ++ ++ FloatRegister freg = ::as_FloatRegister(0); ++ for ( ; i < ConcreteRegisterImpl::max_fpr ; ) { ++ regName[i++] = freg->name(); ++ regName[i++] = freg->name(); ++ freg = freg->successor(); ++ } ++ ++ for ( ; i < ConcreteRegisterImpl::number_of_registers ; i ++ ) { ++ regName[i] = "NON-GPR-FPR"; ++ } ++} +diff --git a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.hpp b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.hpp +new file mode 100644 +index 0000000000..80a1fc57de +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.hpp +@@ -0,0 +1,35 @@ ++/* ++ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_LOONGARCH_VM_VMREG_LOONGARCH_HPP ++#define CPU_LOONGARCH_VM_VMREG_LOONGARCH_HPP ++ ++bool is_Register(); ++Register as_Register(); ++ ++bool is_FloatRegister(); ++FloatRegister as_FloatRegister(); ++ ++#endif // CPU_LOONGARCH_VM_VMREG_LOONGARCH_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.inline.hpp b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.inline.hpp +new file mode 100644 +index 0000000000..f822d4c355 +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vmreg_loongarch.inline.hpp +@@ -0,0 +1,66 @@ ++/* ++ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_LOONGARCH_VM_VMREG_LOONGARCH_INLINE_HPP ++#define CPU_LOONGARCH_VM_VMREG_LOONGARCH_INLINE_HPP ++ ++inline VMReg RegisterImpl::as_VMReg() { ++ if( this==noreg ) return VMRegImpl::Bad(); ++ return VMRegImpl::as_VMReg(encoding() << 1 ); ++} ++ ++inline VMReg FloatRegisterImpl::as_VMReg() { ++ return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr); ++} ++ ++inline bool VMRegImpl::is_Register() { ++ return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr; ++} ++ ++inline bool VMRegImpl::is_FloatRegister() { ++ return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr; ++} ++ ++inline Register VMRegImpl::as_Register() { ++ ++ assert( is_Register(), "must be"); ++ return ::as_Register(value() >> 1); ++} ++ ++inline FloatRegister VMRegImpl::as_FloatRegister() { ++ assert( is_FloatRegister(), "must be" ); ++ assert( is_even(value()), "must be" ); ++ return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1); ++} ++ ++inline bool VMRegImpl::is_concrete() { ++ assert(is_reg(), "must be"); ++ if(is_Register()) return true; ++ if(is_FloatRegister()) return true; ++ assert(false, "what register?"); ++ return false; ++} ++ ++#endif // CPU_LOONGARCH_VM_VMREG_LOONGARCH_INLINE_HPP +diff --git a/hotspot/src/cpu/loongarch/vm/vtableStubs_loongarch_64.cpp b/hotspot/src/cpu/loongarch/vm/vtableStubs_loongarch_64.cpp +new file mode 100644 +index 0000000000..df0d176b8b +--- /dev/null ++++ b/hotspot/src/cpu/loongarch/vm/vtableStubs_loongarch_64.cpp @@ -0,0 +1,300 @@ +/* + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. @@ -58521,9 +58783,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +int VtableStub::pd_code_alignment() { + return wordSize; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/assembler_mips.cpp b/hotspot/src/cpu/mips/vm/assembler_mips.cpp ---- a/hotspot/src/cpu/mips/vm/assembler_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/assembler_mips.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/assembler_mips.cpp b/hotspot/src/cpu/mips/vm/assembler_mips.cpp +new file mode 100644 +index 0000000000..6c720972ad +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/assembler_mips.cpp @@ -0,0 +1,774 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -59299,9 +59563,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + delay_state = no_delay; +#endif +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/assembler_mips.hpp b/hotspot/src/cpu/mips/vm/assembler_mips.hpp ---- a/hotspot/src/cpu/mips/vm/assembler_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/assembler_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/assembler_mips.hpp b/hotspot/src/cpu/mips/vm/assembler_mips.hpp +new file mode 100644 +index 0000000000..e91b9db222 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/assembler_mips.hpp @@ -0,0 +1,1789 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -61092,9 +61358,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + +#endif // CPU_MIPS_VM_ASSEMBLER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/assembler_mips.inline.hpp b/hotspot/src/cpu/mips/vm/assembler_mips.inline.hpp ---- a/hotspot/src/cpu/mips/vm/assembler_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/assembler_mips.inline.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/assembler_mips.inline.hpp b/hotspot/src/cpu/mips/vm/assembler_mips.inline.hpp +new file mode 100644 +index 0000000000..39aeb5509a +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/assembler_mips.inline.hpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -61129,9 +61397,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#include "code/codeCache.hpp" + +#endif // CPU_MIPS_VM_ASSEMBLER_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.cpp b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.cpp ---- a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.cpp b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.cpp +new file mode 100644 +index 0000000000..a4a1b28c2d +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. @@ -61186,9 +61456,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#ifdef CC_INTERP + +#endif // CC_INTERP (all) -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.hpp b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.hpp ---- a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.hpp b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.hpp +new file mode 100644 +index 0000000000..aac8b7a2b7 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.hpp @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -61300,9 +61572,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + ((VMJavaVal64*)(addr))->l) + +#endif // CPU_MIPS_VM_BYTECODEINTERPRETER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.inline.hpp b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.inline.hpp ---- a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.inline.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.inline.hpp b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.inline.hpp +new file mode 100644 +index 0000000000..8ce77ab92f +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/bytecodeInterpreter_mips.inline.hpp @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -61590,9 +61864,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // CPU_MIPS_VM_BYTECODEINTERPRETER_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/bytecodes_mips.cpp b/hotspot/src/cpu/mips/vm/bytecodes_mips.cpp ---- a/hotspot/src/cpu/mips/vm/bytecodes_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/bytecodes_mips.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/bytecodes_mips.cpp b/hotspot/src/cpu/mips/vm/bytecodes_mips.cpp +new file mode 100644 +index 0000000000..61efd1f561 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/bytecodes_mips.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. @@ -61632,9 +61908,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // No mips specific bytecodes + return code; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/bytecodes_mips.hpp b/hotspot/src/cpu/mips/vm/bytecodes_mips.hpp ---- a/hotspot/src/cpu/mips/vm/bytecodes_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/bytecodes_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/bytecodes_mips.hpp b/hotspot/src/cpu/mips/vm/bytecodes_mips.hpp +new file mode 100644 +index 0000000000..25a9562acd +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/bytecodes_mips.hpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. @@ -61667,9 +61945,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// No Loongson specific bytecodes + +#endif // CPU_MIPS_VM_BYTECODES_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/bytes_mips.hpp b/hotspot/src/cpu/mips/vm/bytes_mips.hpp ---- a/hotspot/src/cpu/mips/vm/bytes_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/bytes_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/bytes_mips.hpp b/hotspot/src/cpu/mips/vm/bytes_mips.hpp +new file mode 100644 +index 0000000000..515ffad4b0 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/bytes_mips.hpp @@ -0,0 +1,193 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -61864,9 +62144,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + +#endif // CPU_MIPS_VM_BYTES_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/c2_globals_mips.hpp b/hotspot/src/cpu/mips/vm/c2_globals_mips.hpp ---- a/hotspot/src/cpu/mips/vm/c2_globals_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/c2_globals_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/c2_globals_mips.hpp b/hotspot/src/cpu/mips/vm/c2_globals_mips.hpp +new file mode 100644 +index 0000000000..f254e07abd +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/c2_globals_mips.hpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -61968,9 +62250,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +define_pd_global(bool, NeverActAsServerClassMachine, false); + +#endif // CPU_MIPS_VM_C2_GLOBALS_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/c2_init_mips.cpp b/hotspot/src/cpu/mips/vm/c2_init_mips.cpp ---- a/hotspot/src/cpu/mips/vm/c2_init_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/c2_init_mips.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/c2_init_mips.cpp b/hotspot/src/cpu/mips/vm/c2_init_mips.cpp +new file mode 100644 +index 0000000000..e6d5815f42 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/c2_init_mips.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. @@ -62006,9 +62290,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +void Compile::pd_compiler2_init() { + guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "" ); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/codeBuffer_mips.hpp b/hotspot/src/cpu/mips/vm/codeBuffer_mips.hpp ---- a/hotspot/src/cpu/mips/vm/codeBuffer_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/codeBuffer_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/codeBuffer_mips.hpp b/hotspot/src/cpu/mips/vm/codeBuffer_mips.hpp +new file mode 100644 +index 0000000000..1836b7a921 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/codeBuffer_mips.hpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -62045,9 +62331,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + void flush_bundle(bool start_new_bundle) {} + +#endif // CPU_MIPS_VM_CODEBUFFER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/compiledIC_mips.cpp b/hotspot/src/cpu/mips/vm/compiledIC_mips.cpp ---- a/hotspot/src/cpu/mips/vm/compiledIC_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/compiledIC_mips.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/compiledIC_mips.cpp b/hotspot/src/cpu/mips/vm/compiledIC_mips.cpp +new file mode 100644 +index 0000000000..8ffaaaf841 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/compiledIC_mips.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -62222,9 +62510,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // !PRODUCT -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/copy_mips.hpp b/hotspot/src/cpu/mips/vm/copy_mips.hpp ---- a/hotspot/src/cpu/mips/vm/copy_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/copy_mips.hpp 2024-01-30 13:54:24.792708955 +0800 +diff --git a/hotspot/src/cpu/mips/vm/copy_mips.hpp b/hotspot/src/cpu/mips/vm/copy_mips.hpp +new file mode 100644 +index 0000000000..4442e1dc71 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/copy_mips.hpp @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. @@ -62316,9 +62606,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif //CPU_MIPS_VM_COPY_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/cppInterpreterGenerator_mips.hpp b/hotspot/src/cpu/mips/vm/cppInterpreterGenerator_mips.hpp ---- a/hotspot/src/cpu/mips/vm/cppInterpreterGenerator_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/cppInterpreterGenerator_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/cppInterpreterGenerator_mips.hpp b/hotspot/src/cpu/mips/vm/cppInterpreterGenerator_mips.hpp +new file mode 100644 +index 0000000000..37bd03b00b +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/cppInterpreterGenerator_mips.hpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. @@ -62373,9 +62665,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + bool native); // C++ interpreter only + +#endif // CPU_MIPS_VM_CPPINTERPRETERGENERATOR_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/cppInterpreter_mips.cpp b/hotspot/src/cpu/mips/vm/cppInterpreter_mips.cpp ---- a/hotspot/src/cpu/mips/vm/cppInterpreter_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/cppInterpreter_mips.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/cppInterpreter_mips.cpp b/hotspot/src/cpu/mips/vm/cppInterpreter_mips.cpp +new file mode 100644 +index 0000000000..1f8d75d593 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/cppInterpreter_mips.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. @@ -62592,9 +62886,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // CC_INTERP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/cppInterpreter_mips.hpp b/hotspot/src/cpu/mips/vm/cppInterpreter_mips.hpp ---- a/hotspot/src/cpu/mips/vm/cppInterpreter_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/cppInterpreter_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/cppInterpreter_mips.hpp b/hotspot/src/cpu/mips/vm/cppInterpreter_mips.hpp +new file mode 100644 +index 0000000000..49c4733049 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/cppInterpreter_mips.hpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -62636,9 +62932,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + const static int InterpreterCodeSize = 210 * K; + +#endif // CPU_MIPS_VM_CPPINTERPRETER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/debug_mips.cpp b/hotspot/src/cpu/mips/vm/debug_mips.cpp ---- a/hotspot/src/cpu/mips/vm/debug_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/debug_mips.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/debug_mips.cpp b/hotspot/src/cpu/mips/vm/debug_mips.cpp +new file mode 100644 +index 0000000000..50de03653b +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/debug_mips.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. @@ -62691,9 +62989,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +void pd_obfuscate_location(char *buf,int buflen) {} + +#endif // PRODUCT -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/depChecker_mips.cpp b/hotspot/src/cpu/mips/vm/depChecker_mips.cpp ---- a/hotspot/src/cpu/mips/vm/depChecker_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/depChecker_mips.cpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/depChecker_mips.cpp b/hotspot/src/cpu/mips/vm/depChecker_mips.cpp +new file mode 100644 +index 0000000000..756ccb68f9 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/depChecker_mips.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -62725,9 +63025,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#include "depChecker_mips.hpp" + +// Nothing to do on mips -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/depChecker_mips.hpp b/hotspot/src/cpu/mips/vm/depChecker_mips.hpp ---- a/hotspot/src/cpu/mips/vm/depChecker_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/depChecker_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/depChecker_mips.hpp b/hotspot/src/cpu/mips/vm/depChecker_mips.hpp +new file mode 100644 +index 0000000000..11e52b4e8f +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/depChecker_mips.hpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -62760,9 +63062,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// Nothing to do on MIPS + +#endif // CPU_MIPS_VM_DEPCHECKER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/disassembler_mips.hpp b/hotspot/src/cpu/mips/vm/disassembler_mips.hpp ---- a/hotspot/src/cpu/mips/vm/disassembler_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/disassembler_mips.hpp 2023-12-20 09:23:19.794814582 +0800 +diff --git a/hotspot/src/cpu/mips/vm/disassembler_mips.hpp b/hotspot/src/cpu/mips/vm/disassembler_mips.hpp +new file mode 100644 +index 0000000000..c5f3a8888d +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/disassembler_mips.hpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -62801,9 +63105,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } + +#endif // CPU_MIPS_VM_DISASSEMBLER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/frame_mips.cpp b/hotspot/src/cpu/mips/vm/frame_mips.cpp ---- a/hotspot/src/cpu/mips/vm/frame_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/frame_mips.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/frame_mips.cpp b/hotspot/src/cpu/mips/vm/frame_mips.cpp +new file mode 100644 +index 0000000000..1c928976fc +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/frame_mips.cpp @@ -0,0 +1,711 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -63516,9 +63822,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + init((intptr_t*)sp, (intptr_t*)fp, (address)pc); +} +#endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/frame_mips.hpp b/hotspot/src/cpu/mips/vm/frame_mips.hpp ---- a/hotspot/src/cpu/mips/vm/frame_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/frame_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/frame_mips.hpp b/hotspot/src/cpu/mips/vm/frame_mips.hpp +new file mode 100644 +index 0000000000..9e684a8dc3 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/frame_mips.hpp @@ -0,0 +1,229 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -63749,9 +64057,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#endif // CC_INTERP + +#endif // CPU_MIPS_VM_FRAME_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/frame_mips.inline.hpp b/hotspot/src/cpu/mips/vm/frame_mips.inline.hpp ---- a/hotspot/src/cpu/mips/vm/frame_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/frame_mips.inline.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/frame_mips.inline.hpp b/hotspot/src/cpu/mips/vm/frame_mips.inline.hpp +new file mode 100644 +index 0000000000..60e56ac7ab +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/frame_mips.inline.hpp @@ -0,0 +1,312 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -64065,9 +64375,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // CPU_MIPS_VM_FRAME_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/globalDefinitions_mips.hpp b/hotspot/src/cpu/mips/vm/globalDefinitions_mips.hpp ---- a/hotspot/src/cpu/mips/vm/globalDefinitions_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/globalDefinitions_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/globalDefinitions_mips.hpp b/hotspot/src/cpu/mips/vm/globalDefinitions_mips.hpp +new file mode 100644 +index 0000000000..bd00a8d473 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/globalDefinitions_mips.hpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. @@ -64110,9 +64422,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#define SUPPORTS_NATIVE_CX8 + +#endif // CPU_MIPS_VM_GLOBALDEFINITIONS_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/globals_mips.hpp b/hotspot/src/cpu/mips/vm/globals_mips.hpp ---- a/hotspot/src/cpu/mips/vm/globals_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/globals_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/globals_mips.hpp b/hotspot/src/cpu/mips/vm/globals_mips.hpp +new file mode 100644 +index 0000000000..988bc35137 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/globals_mips.hpp @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -64238,99 +64552,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + "Eliminate barriers for single active cpu") + +#endif // CPU_MIPS_VM_GLOBALS_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/icache_mips.cpp b/hotspot/src/cpu/mips/vm/icache_mips.cpp ---- a/hotspot/src/cpu/mips/vm/icache_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/icache_mips.cpp 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,41 @@ -+/* -+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2021, Loongson Technology. 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 "precompiled.hpp" -+#include "asm/macroAssembler.hpp" -+#include "runtime/icache.hpp" -+ -+void ICacheStubGenerator::generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub) -+{ -+#define __ _masm-> -+ StubCodeMark mark(this, "ICache", "flush_icache_stub"); -+ address start = __ pc(); -+ -+ __ jr_hb(RA); -+ __ delayed()->ori(V0, RA2, 0); -+ -+ *flush_icache_stub = (ICache::flush_icache_stub_t)start; -+#undef __ -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/icache_mips.hpp b/hotspot/src/cpu/mips/vm/icache_mips.hpp ---- a/hotspot/src/cpu/mips/vm/icache_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/icache_mips.hpp 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,41 @@ -+/* -+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2021, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_MIPS_VM_ICACHE_MIPS_HPP -+#define CPU_MIPS_VM_ICACHE_MIPS_HPP -+ -+// Interface for updating the instruction cache. Whenever the VM modifies -+// code, part of the processor instruction cache potentially has to be flushed. -+ -+class ICache : public AbstractICache { -+ public: -+ enum { -+ stub_size = 2 * BytesPerInstWord, // Size of the icache flush stub in bytes -+ line_size = 32, // flush instruction affects a dword -+ log2_line_size = 5 // log2(line_size) -+ }; -+}; -+ -+#endif // CPU_MIPS_VM_ICACHE_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/icBuffer_mips.cpp b/hotspot/src/cpu/mips/vm/icBuffer_mips.cpp ---- a/hotspot/src/cpu/mips/vm/icBuffer_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/icBuffer_mips.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/icBuffer_mips.cpp b/hotspot/src/cpu/mips/vm/icBuffer_mips.cpp +new file mode 100644 +index 0000000000..96ea345360 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/icBuffer_mips.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. @@ -64429,9 +64655,105 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + void* o= (void*)move->data(); + return o; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/interp_masm_mips_64.cpp b/hotspot/src/cpu/mips/vm/interp_masm_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/interp_masm_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/interp_masm_mips_64.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/icache_mips.cpp b/hotspot/src/cpu/mips/vm/icache_mips.cpp +new file mode 100644 +index 0000000000..848964b63f +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/icache_mips.cpp +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2021, Loongson Technology. 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 "precompiled.hpp" ++#include "asm/macroAssembler.hpp" ++#include "runtime/icache.hpp" ++ ++void ICacheStubGenerator::generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub) ++{ ++#define __ _masm-> ++ StubCodeMark mark(this, "ICache", "flush_icache_stub"); ++ address start = __ pc(); ++ ++ __ jr_hb(RA); ++ __ delayed()->ori(V0, RA2, 0); ++ ++ *flush_icache_stub = (ICache::flush_icache_stub_t)start; ++#undef __ ++} +diff --git a/hotspot/src/cpu/mips/vm/icache_mips.hpp b/hotspot/src/cpu/mips/vm/icache_mips.hpp +new file mode 100644 +index 0000000000..78ee11cc73 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/icache_mips.hpp +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2021, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_MIPS_VM_ICACHE_MIPS_HPP ++#define CPU_MIPS_VM_ICACHE_MIPS_HPP ++ ++// Interface for updating the instruction cache. Whenever the VM modifies ++// code, part of the processor instruction cache potentially has to be flushed. ++ ++class ICache : public AbstractICache { ++ public: ++ enum { ++ stub_size = 2 * BytesPerInstWord, // Size of the icache flush stub in bytes ++ line_size = 32, // flush instruction affects a dword ++ log2_line_size = 5 // log2(line_size) ++ }; ++}; ++ ++#endif // CPU_MIPS_VM_ICACHE_MIPS_HPP +diff --git a/hotspot/src/cpu/mips/vm/interp_masm_mips_64.cpp b/hotspot/src/cpu/mips/vm/interp_masm_mips_64.cpp +new file mode 100644 +index 0000000000..ed2d931e94 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/interp_masm_mips_64.cpp @@ -0,0 +1,2084 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -66517,9 +66839,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + unimplemented(); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/interp_masm_mips_64.hpp b/hotspot/src/cpu/mips/vm/interp_masm_mips_64.hpp ---- a/hotspot/src/cpu/mips/vm/interp_masm_mips_64.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/interp_masm_mips_64.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/interp_masm_mips_64.hpp b/hotspot/src/cpu/mips/vm/interp_masm_mips_64.hpp +new file mode 100644 +index 0000000000..a2ebdec3ad +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/interp_masm_mips_64.hpp @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -66790,9 +67114,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_MIPS_VM_INTERP_MASM_MIPS_64_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/interpreterGenerator_mips.hpp b/hotspot/src/cpu/mips/vm/interpreterGenerator_mips.hpp ---- a/hotspot/src/cpu/mips/vm/interpreterGenerator_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/interpreterGenerator_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/interpreterGenerator_mips.hpp b/hotspot/src/cpu/mips/vm/interpreterGenerator_mips.hpp +new file mode 100644 +index 0000000000..26fced492a +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/interpreterGenerator_mips.hpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -66843,12 +67169,14 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + void generate_counter_overflow(Label* do_continue); + +#endif // CPU_MIPS_VM_INTERPRETERGENERATOR_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/interpreter_mips_64.cpp b/hotspot/src/cpu/mips/vm/interpreter_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/interpreter_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/interpreter_mips_64.cpp 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,286 @@ +diff --git a/hotspot/src/cpu/mips/vm/interpreterRT_mips.hpp b/hotspot/src/cpu/mips/vm/interpreterRT_mips.hpp +new file mode 100644 +index 0000000000..8dec2007c6 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/interpreterRT_mips.hpp +@@ -0,0 +1,61 @@ +/* -+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * @@ -66872,327 +67200,50 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#include "precompiled.hpp" -+#include "asm/macroAssembler.hpp" -+#include "interpreter/bytecodeHistogram.hpp" -+#include "interpreter/interpreter.hpp" -+#include "interpreter/interpreterGenerator.hpp" -+#include "interpreter/interpreterRuntime.hpp" -+#include "interpreter/templateTable.hpp" -+#include "oops/arrayOop.hpp" -+#include "oops/methodData.hpp" -+#include "oops/method.hpp" -+#include "oops/oop.inline.hpp" -+#include "prims/jvmtiExport.hpp" -+#include "prims/jvmtiThreadState.hpp" -+#include "prims/methodHandles.hpp" -+#include "runtime/arguments.hpp" -+#include "runtime/deoptimization.hpp" -+#include "runtime/frame.inline.hpp" -+#include "runtime/sharedRuntime.hpp" -+#include "runtime/stubRoutines.hpp" -+#include "runtime/synchronizer.hpp" -+#include "runtime/timer.hpp" -+#include "runtime/vframeArray.hpp" -+#include "utilities/debug.hpp" -+ -+#define __ _masm-> -+ -+#define A0 RA0 -+#define A1 RA1 -+#define A2 RA2 -+#define A3 RA3 -+#define A4 RA4 -+#define A5 RA5 -+#define A6 RA6 -+#define A7 RA7 -+#define T0 RT0 -+#define T1 RT1 -+#define T2 RT2 -+#define T3 RT3 -+#define T8 RT8 -+#define T9 RT9 -+ -+ -+address AbstractInterpreterGenerator::generate_slow_signature_handler() { -+ address entry = __ pc(); -+ -+ // Rmethod: method -+ // LVP: pointer to locals -+ // A3: first stack arg -+ __ move(A3, SP); -+ __ daddiu(SP, SP, -10 * wordSize); -+ __ sd(RA, SP, 0); -+ __ call_VM(noreg, -+ CAST_FROM_FN_PTR(address, -+ InterpreterRuntime::slow_signature_handler), -+ Rmethod, LVP, A3); -+ -+ // V0: result handler -+ -+ // Stack layout: -+ // ... -+ // 10 stack arg0 <--- old sp -+ // 9 float/double identifiers -+ // 8 register arg7 -+ // ... -+ // 2 register arg1 -+ // 1 aligned slot -+ // SP: 0 return address -+ -+ // Do FP first so we can use T3 as temp -+ __ ld(T3, Address(SP, 9 * wordSize)); // float/double identifiers -+ -+ // A0 is for env. -+ // If the mothed is not static, A1 will be corrected in generate_native_entry. -+ for ( int i = 1; i < Argument::n_register_parameters; i++ ) { -+ Register reg = as_Register(i + A0->encoding()); -+ FloatRegister floatreg = as_FloatRegister(i + F12->encoding()); -+ Label isfloatordouble, isdouble, next; -+ -+ __ andi(AT, T3, 1 << (i*2)); // Float or Double? -+ __ bne(AT, R0, isfloatordouble); -+ __ delayed()->nop(); -+ -+ // Do Int register here -+ __ ld(reg, SP, (1 + i) * wordSize); -+ __ b (next); -+ __ delayed()->nop(); -+ -+ __ bind(isfloatordouble); -+ __ andi(AT, T3, 1 << ((i*2)+1)); // Double? -+ __ bne(AT, R0, isdouble); -+ __ delayed()->nop(); -+ -+ // Do Float Here -+ __ lwc1(floatreg, SP, (1 + i) * wordSize); -+ __ b(next); -+ __ delayed()->nop(); -+ -+ // Do Double here -+ __ bind(isdouble); -+ __ ldc1(floatreg, SP, (1 + i) * wordSize); -+ -+ __ bind(next); -+ } -+ -+ __ ld(RA, SP, 0); -+ __ daddiu(SP, SP, 10 * wordSize); -+ __ jr(RA); -+ __ delayed()->nop(); -+ return entry; -+} -+ -+ -+// -+// Various method entries -+// -+ -+address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) { -+ -+ // Rmethod: methodOop -+ // V0: scratrch -+ // Rsender: send 's sp -+ -+ if (!InlineIntrinsics) return NULL; // Generate a vanilla entry ++#ifndef CPU_MIPS_VM_INTERPRETERRT_MIPS_HPP ++#define CPU_MIPS_VM_INTERPRETERRT_MIPS_HPP + -+ address entry_point = __ pc(); ++#include "memory/allocation.hpp" + -+ // These don't need a safepoint check because they aren't virtually -+ // callable. We won't enter these intrinsics from compiled code. -+ // If in the future we added an intrinsic which was virtually callable -+ // we'd have to worry about how to safepoint so that this code is used. ++// native method calls + -+ // mathematical functions inlined by compiler -+ // (interpreter must provide identical implementation -+ // in order to avoid monotonicity bugs when switching -+ // from interpreter to compiler in the middle of some -+ // computation) -+ // -+ // stack: [ lo(arg) ] <-- sp -+ // [ hi(arg) ] -+ { -+ // Note: For JDK 1.3 StrictMath exists and Math.sin/cos/sqrt are -+ // java methods. Interpreter::method_kind(...) will select -+ // this entry point for the corresponding methods in JDK 1.3. -+ __ ldc1(F12, SP, 0 * wordSize); -+ __ ldc1(F13, SP, 1 * wordSize); -+ __ push2(RA, FP); -+ __ daddiu(FP, SP, 2 * wordSize); ++class SignatureHandlerGenerator: public NativeSignatureIterator { ++ private: ++ MacroAssembler* _masm; + -+ // [ fp ] <-- sp -+ // [ ra ] -+ // [ lo ] <-- fp -+ // [ hi ] -+ //FIXME, need consider this -+ switch (kind) { -+ case Interpreter::java_lang_math_sin : -+ __ trigfunc('s'); -+ break; -+ case Interpreter::java_lang_math_cos : -+ __ trigfunc('c'); -+ break; -+ case Interpreter::java_lang_math_tan : -+ __ trigfunc('t'); -+ break; -+ case Interpreter::java_lang_math_sqrt: -+ __ sqrt_d(F0, F12); -+ break; -+ case Interpreter::java_lang_math_abs: -+ __ abs_d(F0, F12); -+ break; -+ case Interpreter::java_lang_math_log: -+ // Store to stack to convert 80bit precision back to 64bits -+ break; -+ case Interpreter::java_lang_math_log10: -+ // Store to stack to convert 80bit precision back to 64bits -+ break; -+ case Interpreter::java_lang_math_pow: -+ break; -+ case Interpreter::java_lang_math_exp: -+ break; ++ void move(int from_offset, int to_offset); + -+ default : -+ ShouldNotReachHere(); -+ } ++ void box(int from_offset, int to_offset); ++ void pass_int(); ++ void pass_long(); ++ void pass_object(); ++ void pass_float(); ++ void pass_double(); + -+ // must maintain return value in F0:F1 -+ __ ld(RA, FP, (-1) * wordSize); -+ //FIXME -+ __ ld(FP, FP, (-2) * wordSize); -+ __ move(SP, Rsender); -+ __ jr(RA); -+ __ delayed()->nop(); ++ public: ++ // Creation ++ SignatureHandlerGenerator(methodHandle method, CodeBuffer* buffer) : NativeSignatureIterator(method) { ++ _masm = new MacroAssembler(buffer); + } -+ return entry_point; -+} -+ -+ -+// Abstract method entry -+// Attempt to execute abstract method. Throw exception -+address InterpreterGenerator::generate_abstract_entry(void) { -+ -+ // Rmethod: methodOop -+ // V0: receiver (unused) -+ // Rsender : sender 's sp -+ address entry_point = __ pc(); -+ -+ // abstract method entry -+ // throw exception -+ // adjust stack to what a normal return would do -+ __ empty_expression_stack(); -+ __ restore_bcp(); -+ __ restore_locals(); -+ __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError)); -+ // the call_VM checks for exception, so we should never return here. -+ __ should_not_reach_here(); + -+ return entry_point; -+} -+ -+ -+// Empty method, generate a very fast return. -+ -+address InterpreterGenerator::generate_empty_entry(void) { -+ -+ // Rmethod: methodOop -+ // V0: receiver (unused) -+ // Rsender: sender 's sp , must set sp to this value on return , on mips ,now use T0,as it right? -+ if (!UseFastEmptyMethods) return NULL; -+ -+ address entry_point = __ pc(); -+ -+ Label slow_path; -+ __ li(RT0, SafepointSynchronize::address_of_state()); -+ __ lw(AT, RT0, 0); -+ __ move(RT0, (SafepointSynchronize::_not_synchronized)); -+ __ bne(AT, RT0,slow_path); -+ __ delayed()->nop(); -+ __ move(SP, Rsender); -+ __ jr(RA); -+ __ delayed()->nop(); -+ __ bind(slow_path); -+ (void) generate_normal_entry(false); -+ -+ return entry_point; -+ -+} -+ -+void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) { -+ -+ // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in -+ // the days we had adapter frames. When we deoptimize a situation where a -+ // compiled caller calls a compiled caller will have registers it expects -+ // to survive the call to the callee. If we deoptimize the callee the only -+ // way we can restore these registers is to have the oldest interpreter -+ // frame that we create restore these values. That is what this routine -+ // will accomplish. ++ // Code generation ++ void generate(uint64_t fingerprint); + -+ // At the moment we have modified c2 to not have any callee save registers -+ // so this problem does not exist and this routine is just a place holder. ++ // Code generation support ++ static Register from(); ++ static Register to(); ++ static Register temp(); ++}; + -+ assert(f->is_interpreted_frame(), "must be interpreted"); -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/interpreter_mips.hpp b/hotspot/src/cpu/mips/vm/interpreter_mips.hpp ---- a/hotspot/src/cpu/mips/vm/interpreter_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/interpreter_mips.hpp 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,50 @@ ++#endif // CPU_MIPS_VM_INTERPRETERRT_MIPS_HPP +diff --git a/hotspot/src/cpu/mips/vm/interpreterRT_mips_64.cpp b/hotspot/src/cpu/mips/vm/interpreterRT_mips_64.cpp +new file mode 100644 +index 0000000000..14b7e39af7 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/interpreterRT_mips_64.cpp +@@ -0,0 +1,259 @@ +/* -+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_MIPS_VM_INTERPRETER_MIPS_HPP -+#define CPU_MIPS_VM_INTERPRETER_MIPS_HPP -+ -+ public: -+ -+ // Sentinel placed in the code for interpreter returns so -+ // that i2c adapters and osr code can recognize an interpreter -+ // return address and convert the return to a specialized -+ // block of code to handle compiedl return values and cleaning -+ // the fpu stack. -+ static const int return_sentinel; -+ -+ static Address::ScaleFactor stackElementScale() { -+ return Address::times_8; -+ } -+ -+ // Offset from sp (which points to the last stack element) -+ static int expr_offset_in_bytes(int i) { return stackElementSize * i; } -+ // Size of interpreter code. Increase if too small. Interpreter will -+ // fail with a guarantee ("not enough space for interpreter generation"); -+ // if too small. -+ // Run with +PrintInterpreterSize to get the VM to print out the size. -+ // Max size with JVMTI and TaggedStackInterpreter -+ const static int InterpreterCodeSize = 168 * 1024; -+#endif // CPU_MIPS_VM_INTERPRETER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/interpreterRT_mips_64.cpp b/hotspot/src/cpu/mips/vm/interpreterRT_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/interpreterRT_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/interpreterRT_mips_64.cpp 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,259 @@ -+/* -+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * @@ -67450,12 +67501,14 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // return result handler + return Interpreter::result_handler(m->result_type()); +IRT_END -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/interpreterRT_mips.hpp b/hotspot/src/cpu/mips/vm/interpreterRT_mips.hpp ---- a/hotspot/src/cpu/mips/vm/interpreterRT_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/interpreterRT_mips.hpp 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,61 @@ +diff --git a/hotspot/src/cpu/mips/vm/interpreter_mips.hpp b/hotspot/src/cpu/mips/vm/interpreter_mips.hpp +new file mode 100644 +index 0000000000..9a21d704fa +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/interpreter_mips.hpp +@@ -0,0 +1,50 @@ +/* -+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * @@ -67479,45 +67532,328 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#ifndef CPU_MIPS_VM_INTERPRETERRT_MIPS_HPP -+#define CPU_MIPS_VM_INTERPRETERRT_MIPS_HPP ++#ifndef CPU_MIPS_VM_INTERPRETER_MIPS_HPP ++#define CPU_MIPS_VM_INTERPRETER_MIPS_HPP + -+#include "memory/allocation.hpp" ++ public: + -+// native method calls ++ // Sentinel placed in the code for interpreter returns so ++ // that i2c adapters and osr code can recognize an interpreter ++ // return address and convert the return to a specialized ++ // block of code to handle compiedl return values and cleaning ++ // the fpu stack. ++ static const int return_sentinel; + -+class SignatureHandlerGenerator: public NativeSignatureIterator { -+ private: -+ MacroAssembler* _masm; ++ static Address::ScaleFactor stackElementScale() { ++ return Address::times_8; ++ } + -+ void move(int from_offset, int to_offset); ++ // Offset from sp (which points to the last stack element) ++ static int expr_offset_in_bytes(int i) { return stackElementSize * i; } ++ // Size of interpreter code. Increase if too small. Interpreter will ++ // fail with a guarantee ("not enough space for interpreter generation"); ++ // if too small. ++ // Run with +PrintInterpreterSize to get the VM to print out the size. ++ // Max size with JVMTI and TaggedStackInterpreter ++ const static int InterpreterCodeSize = 168 * 1024; ++#endif // CPU_MIPS_VM_INTERPRETER_MIPS_HPP +diff --git a/hotspot/src/cpu/mips/vm/interpreter_mips_64.cpp b/hotspot/src/cpu/mips/vm/interpreter_mips_64.cpp +new file mode 100644 +index 0000000000..014c812713 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/interpreter_mips_64.cpp +@@ -0,0 +1,286 @@ ++/* ++ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. 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. ++ * ++ */ + -+ void box(int from_offset, int to_offset); -+ void pass_int(); -+ void pass_long(); -+ void pass_object(); -+ void pass_float(); -+ void pass_double(); ++#include "precompiled.hpp" ++#include "asm/macroAssembler.hpp" ++#include "interpreter/bytecodeHistogram.hpp" ++#include "interpreter/interpreter.hpp" ++#include "interpreter/interpreterGenerator.hpp" ++#include "interpreter/interpreterRuntime.hpp" ++#include "interpreter/templateTable.hpp" ++#include "oops/arrayOop.hpp" ++#include "oops/methodData.hpp" ++#include "oops/method.hpp" ++#include "oops/oop.inline.hpp" ++#include "prims/jvmtiExport.hpp" ++#include "prims/jvmtiThreadState.hpp" ++#include "prims/methodHandles.hpp" ++#include "runtime/arguments.hpp" ++#include "runtime/deoptimization.hpp" ++#include "runtime/frame.inline.hpp" ++#include "runtime/sharedRuntime.hpp" ++#include "runtime/stubRoutines.hpp" ++#include "runtime/synchronizer.hpp" ++#include "runtime/timer.hpp" ++#include "runtime/vframeArray.hpp" ++#include "utilities/debug.hpp" + -+ public: -+ // Creation -+ SignatureHandlerGenerator(methodHandle method, CodeBuffer* buffer) : NativeSignatureIterator(method) { -+ _masm = new MacroAssembler(buffer); ++#define __ _masm-> ++ ++#define A0 RA0 ++#define A1 RA1 ++#define A2 RA2 ++#define A3 RA3 ++#define A4 RA4 ++#define A5 RA5 ++#define A6 RA6 ++#define A7 RA7 ++#define T0 RT0 ++#define T1 RT1 ++#define T2 RT2 ++#define T3 RT3 ++#define T8 RT8 ++#define T9 RT9 ++ ++ ++address AbstractInterpreterGenerator::generate_slow_signature_handler() { ++ address entry = __ pc(); ++ ++ // Rmethod: method ++ // LVP: pointer to locals ++ // A3: first stack arg ++ __ move(A3, SP); ++ __ daddiu(SP, SP, -10 * wordSize); ++ __ sd(RA, SP, 0); ++ __ call_VM(noreg, ++ CAST_FROM_FN_PTR(address, ++ InterpreterRuntime::slow_signature_handler), ++ Rmethod, LVP, A3); ++ ++ // V0: result handler ++ ++ // Stack layout: ++ // ... ++ // 10 stack arg0 <--- old sp ++ // 9 float/double identifiers ++ // 8 register arg7 ++ // ... ++ // 2 register arg1 ++ // 1 aligned slot ++ // SP: 0 return address ++ ++ // Do FP first so we can use T3 as temp ++ __ ld(T3, Address(SP, 9 * wordSize)); // float/double identifiers ++ ++ // A0 is for env. ++ // If the mothed is not static, A1 will be corrected in generate_native_entry. ++ for ( int i = 1; i < Argument::n_register_parameters; i++ ) { ++ Register reg = as_Register(i + A0->encoding()); ++ FloatRegister floatreg = as_FloatRegister(i + F12->encoding()); ++ Label isfloatordouble, isdouble, next; ++ ++ __ andi(AT, T3, 1 << (i*2)); // Float or Double? ++ __ bne(AT, R0, isfloatordouble); ++ __ delayed()->nop(); ++ ++ // Do Int register here ++ __ ld(reg, SP, (1 + i) * wordSize); ++ __ b (next); ++ __ delayed()->nop(); ++ ++ __ bind(isfloatordouble); ++ __ andi(AT, T3, 1 << ((i*2)+1)); // Double? ++ __ bne(AT, R0, isdouble); ++ __ delayed()->nop(); ++ ++ // Do Float Here ++ __ lwc1(floatreg, SP, (1 + i) * wordSize); ++ __ b(next); ++ __ delayed()->nop(); ++ ++ // Do Double here ++ __ bind(isdouble); ++ __ ldc1(floatreg, SP, (1 + i) * wordSize); ++ ++ __ bind(next); + } + -+ // Code generation -+ void generate(uint64_t fingerprint); ++ __ ld(RA, SP, 0); ++ __ daddiu(SP, SP, 10 * wordSize); ++ __ jr(RA); ++ __ delayed()->nop(); ++ return entry; ++} + -+ // Code generation support -+ static Register from(); -+ static Register to(); -+ static Register temp(); -+}; + -+#endif // CPU_MIPS_VM_INTERPRETERRT_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/javaFrameAnchor_mips.hpp b/hotspot/src/cpu/mips/vm/javaFrameAnchor_mips.hpp ---- a/hotspot/src/cpu/mips/vm/javaFrameAnchor_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/javaFrameAnchor_mips.hpp 2023-12-20 09:23:19.798147877 +0800 ++// ++// Various method entries ++// ++ ++address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) { ++ ++ // Rmethod: methodOop ++ // V0: scratrch ++ // Rsender: send 's sp ++ ++ if (!InlineIntrinsics) return NULL; // Generate a vanilla entry ++ ++ address entry_point = __ pc(); ++ ++ // These don't need a safepoint check because they aren't virtually ++ // callable. We won't enter these intrinsics from compiled code. ++ // If in the future we added an intrinsic which was virtually callable ++ // we'd have to worry about how to safepoint so that this code is used. ++ ++ // mathematical functions inlined by compiler ++ // (interpreter must provide identical implementation ++ // in order to avoid monotonicity bugs when switching ++ // from interpreter to compiler in the middle of some ++ // computation) ++ // ++ // stack: [ lo(arg) ] <-- sp ++ // [ hi(arg) ] ++ { ++ // Note: For JDK 1.3 StrictMath exists and Math.sin/cos/sqrt are ++ // java methods. Interpreter::method_kind(...) will select ++ // this entry point for the corresponding methods in JDK 1.3. ++ __ ldc1(F12, SP, 0 * wordSize); ++ __ ldc1(F13, SP, 1 * wordSize); ++ __ push2(RA, FP); ++ __ daddiu(FP, SP, 2 * wordSize); ++ ++ // [ fp ] <-- sp ++ // [ ra ] ++ // [ lo ] <-- fp ++ // [ hi ] ++ //FIXME, need consider this ++ switch (kind) { ++ case Interpreter::java_lang_math_sin : ++ __ trigfunc('s'); ++ break; ++ case Interpreter::java_lang_math_cos : ++ __ trigfunc('c'); ++ break; ++ case Interpreter::java_lang_math_tan : ++ __ trigfunc('t'); ++ break; ++ case Interpreter::java_lang_math_sqrt: ++ __ sqrt_d(F0, F12); ++ break; ++ case Interpreter::java_lang_math_abs: ++ __ abs_d(F0, F12); ++ break; ++ case Interpreter::java_lang_math_log: ++ // Store to stack to convert 80bit precision back to 64bits ++ break; ++ case Interpreter::java_lang_math_log10: ++ // Store to stack to convert 80bit precision back to 64bits ++ break; ++ case Interpreter::java_lang_math_pow: ++ break; ++ case Interpreter::java_lang_math_exp: ++ break; ++ ++ default : ++ ShouldNotReachHere(); ++ } ++ ++ // must maintain return value in F0:F1 ++ __ ld(RA, FP, (-1) * wordSize); ++ //FIXME ++ __ ld(FP, FP, (-2) * wordSize); ++ __ move(SP, Rsender); ++ __ jr(RA); ++ __ delayed()->nop(); ++ } ++ return entry_point; ++} ++ ++ ++// Abstract method entry ++// Attempt to execute abstract method. Throw exception ++address InterpreterGenerator::generate_abstract_entry(void) { ++ ++ // Rmethod: methodOop ++ // V0: receiver (unused) ++ // Rsender : sender 's sp ++ address entry_point = __ pc(); ++ ++ // abstract method entry ++ // throw exception ++ // adjust stack to what a normal return would do ++ __ empty_expression_stack(); ++ __ restore_bcp(); ++ __ restore_locals(); ++ __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError)); ++ // the call_VM checks for exception, so we should never return here. ++ __ should_not_reach_here(); ++ ++ return entry_point; ++} ++ ++ ++// Empty method, generate a very fast return. ++ ++address InterpreterGenerator::generate_empty_entry(void) { ++ ++ // Rmethod: methodOop ++ // V0: receiver (unused) ++ // Rsender: sender 's sp , must set sp to this value on return , on mips ,now use T0,as it right? ++ if (!UseFastEmptyMethods) return NULL; ++ ++ address entry_point = __ pc(); ++ ++ Label slow_path; ++ __ li(RT0, SafepointSynchronize::address_of_state()); ++ __ lw(AT, RT0, 0); ++ __ move(RT0, (SafepointSynchronize::_not_synchronized)); ++ __ bne(AT, RT0,slow_path); ++ __ delayed()->nop(); ++ __ move(SP, Rsender); ++ __ jr(RA); ++ __ delayed()->nop(); ++ __ bind(slow_path); ++ (void) generate_normal_entry(false); ++ ++ return entry_point; ++ ++} ++ ++void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) { ++ ++ // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in ++ // the days we had adapter frames. When we deoptimize a situation where a ++ // compiled caller calls a compiled caller will have registers it expects ++ // to survive the call to the callee. If we deoptimize the callee the only ++ // way we can restore these registers is to have the oldest interpreter ++ // frame that we create restore these values. That is what this routine ++ // will accomplish. ++ ++ // At the moment we have modified c2 to not have any callee save registers ++ // so this problem does not exist and this routine is just a place holder. ++ ++ assert(f->is_interpreted_frame(), "must be interpreted"); ++} +diff --git a/hotspot/src/cpu/mips/vm/javaFrameAnchor_mips.hpp b/hotspot/src/cpu/mips/vm/javaFrameAnchor_mips.hpp +new file mode 100644 +index 0000000000..dccdf6a019 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/javaFrameAnchor_mips.hpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. @@ -67606,9 +67942,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + void set_last_Java_fp(intptr_t* fp) { _last_Java_fp = fp; } + +#endif // CPU_MIPS_VM_JAVAFRAMEANCHOR_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/jniFastGetField_mips_64.cpp b/hotspot/src/cpu/mips/vm/jniFastGetField_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/jniFastGetField_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/jniFastGetField_mips_64.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/jniFastGetField_mips_64.cpp b/hotspot/src/cpu/mips/vm/jniFastGetField_mips_64.cpp +new file mode 100644 +index 0000000000..0f7dd9424a +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/jniFastGetField_mips_64.cpp @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. @@ -67782,64 +68120,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +address JNI_FastGetField::generate_fast_get_double_field() { + return generate_fast_get_int_field0(T_DOUBLE); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/jni_mips.h b/hotspot/src/cpu/mips/vm/jni_mips.h ---- a/hotspot/src/cpu/mips/vm/jni_mips.h 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/jni_mips.h 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,51 @@ -+/* -+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. Oracle designates this -+ * particular file as subject to the "Classpath" exception as provided -+ * by Oracle in the LICENSE file that accompanied this code. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ */ -+ -+#ifndef _JAVASOFT_JNI_MD_H_ -+#define _JAVASOFT_JNI_MD_H_ -+ -+// Note: please do not change these without also changing jni_md.h in the JDK -+// repository -+#ifndef __has_attribute -+ #define __has_attribute(x) 0 -+#endif -+#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) -+ #define JNIEXPORT __attribute__((visibility("default"))) -+ #define JNIIMPORT __attribute__((visibility("default"))) -+#else -+ #define JNIEXPORT -+ #define JNIIMPORT -+#endif -+ -+#define JNICALL -+ -+typedef int jint; -+ -+typedef long jlong; -+ -+typedef signed char jbyte; -+ -+#endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/jniTypes_mips.hpp b/hotspot/src/cpu/mips/vm/jniTypes_mips.hpp ---- a/hotspot/src/cpu/mips/vm/jniTypes_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/jniTypes_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/jniTypes_mips.hpp b/hotspot/src/cpu/mips/vm/jniTypes_mips.hpp +new file mode 100644 +index 0000000000..dfcd47b478 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/jniTypes_mips.hpp @@ -0,0 +1,144 @@ +/* + * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. @@ -67985,9 +68270,68 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_MIPS_VM_JNITYPES_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/macroAssembler_mips.cpp b/hotspot/src/cpu/mips/vm/macroAssembler_mips.cpp ---- a/hotspot/src/cpu/mips/vm/macroAssembler_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/macroAssembler_mips.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/jni_mips.h b/hotspot/src/cpu/mips/vm/jni_mips.h +new file mode 100644 +index 0000000000..6714f51d5d +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/jni_mips.h +@@ -0,0 +1,51 @@ ++/* ++ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. Oracle designates this ++ * particular file as subject to the "Classpath" exception as provided ++ * by Oracle in the LICENSE file that accompanied this code. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++#ifndef _JAVASOFT_JNI_MD_H_ ++#define _JAVASOFT_JNI_MD_H_ ++ ++// Note: please do not change these without also changing jni_md.h in the JDK ++// repository ++#ifndef __has_attribute ++ #define __has_attribute(x) 0 ++#endif ++#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) ++ #define JNIEXPORT __attribute__((visibility("default"))) ++ #define JNIIMPORT __attribute__((visibility("default"))) ++#else ++ #define JNIEXPORT ++ #define JNIIMPORT ++#endif ++ ++#define JNICALL ++ ++typedef int jint; ++ ++typedef long jlong; ++ ++typedef signed char jbyte; ++ ++#endif +diff --git a/hotspot/src/cpu/mips/vm/macroAssembler_mips.cpp b/hotspot/src/cpu/mips/vm/macroAssembler_mips.cpp +new file mode 100644 +index 0000000000..2b8840ae10 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/macroAssembler_mips.cpp @@ -0,0 +1,4332 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -72321,9 +72665,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + Unimplemented(); + } +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/macroAssembler_mips.hpp b/hotspot/src/cpu/mips/vm/macroAssembler_mips.hpp ---- a/hotspot/src/cpu/mips/vm/macroAssembler_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/macroAssembler_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/macroAssembler_mips.hpp b/hotspot/src/cpu/mips/vm/macroAssembler_mips.hpp +new file mode 100644 +index 0000000000..ab9727793f +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/macroAssembler_mips.hpp @@ -0,0 +1,701 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -73026,9 +73372,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + +#endif // CPU_MIPS_VM_MACROASSEMBLER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/macroAssembler_mips.inline.hpp b/hotspot/src/cpu/mips/vm/macroAssembler_mips.inline.hpp ---- a/hotspot/src/cpu/mips/vm/macroAssembler_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/macroAssembler_mips.inline.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/macroAssembler_mips.inline.hpp b/hotspot/src/cpu/mips/vm/macroAssembler_mips.inline.hpp +new file mode 100644 +index 0000000000..92c05fb726 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/macroAssembler_mips.inline.hpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -73064,9 +73412,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#include "code/codeCache.hpp" + +#endif // CPU_MIPS_VM_MACROASSEMBLER_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/metaspaceShared_mips_64.cpp b/hotspot/src/cpu/mips/vm/metaspaceShared_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/metaspaceShared_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/metaspaceShared_mips_64.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/metaspaceShared_mips_64.cpp b/hotspot/src/cpu/mips/vm/metaspaceShared_mips_64.cpp +new file mode 100644 +index 0000000000..0c467df2f3 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/metaspaceShared_mips_64.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. @@ -73191,9 +73541,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + *mc_top = (char*)__ pc(); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/methodHandles_mips.cpp b/hotspot/src/cpu/mips/vm/methodHandles_mips.cpp ---- a/hotspot/src/cpu/mips/vm/methodHandles_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/methodHandles_mips.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/methodHandles_mips.cpp b/hotspot/src/cpu/mips/vm/methodHandles_mips.cpp +new file mode 100644 +index 0000000000..428c271362 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/methodHandles_mips.cpp @@ -0,0 +1,576 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -73771,9 +74123,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) { +} +#endif //PRODUCT -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/methodHandles_mips.hpp b/hotspot/src/cpu/mips/vm/methodHandles_mips.hpp ---- a/hotspot/src/cpu/mips/vm/methodHandles_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/methodHandles_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/methodHandles_mips.hpp b/hotspot/src/cpu/mips/vm/methodHandles_mips.hpp +new file mode 100644 +index 0000000000..03b65fc8ef +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/methodHandles_mips.hpp @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. @@ -73837,9 +74191,42 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // Should be in sharedRuntime, not here. + return I29; + } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/mips_64.ad b/hotspot/src/cpu/mips/vm/mips_64.ad ---- a/hotspot/src/cpu/mips/vm/mips_64.ad 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/mips_64.ad 2024-01-30 13:54:24.792708955 +0800 +diff --git a/hotspot/src/cpu/mips/vm/mips.ad b/hotspot/src/cpu/mips/vm/mips.ad +new file mode 100644 +index 0000000000..3563bbe0e5 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/mips.ad +@@ -0,0 +1,25 @@ ++// ++// Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. ++// Copyright (c) 2015, 2016, Loongson Technology. 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. ++// ++// ++ +diff --git a/hotspot/src/cpu/mips/vm/mips_64.ad b/hotspot/src/cpu/mips/vm/mips_64.ad +new file mode 100644 +index 0000000000..29125913a4 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/mips_64.ad @@ -0,0 +1,14036 @@ +// +// Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -87877,38 +88264,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// These must follow all instruction definitions as they use the names +// defined in the instructions definitions. + -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/mips.ad b/hotspot/src/cpu/mips/vm/mips.ad ---- a/hotspot/src/cpu/mips/vm/mips.ad 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/mips.ad 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,25 @@ -+// -+// Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. -+// Copyright (c) 2015, 2016, Loongson Technology. 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. -+// -+// -+ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/nativeInst_mips.cpp b/hotspot/src/cpu/mips/vm/nativeInst_mips.cpp ---- a/hotspot/src/cpu/mips/vm/nativeInst_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/nativeInst_mips.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/nativeInst_mips.cpp b/hotspot/src/cpu/mips/vm/nativeInst_mips.cpp +new file mode 100644 +index 0000000000..e1f7cd944d +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/nativeInst_mips.cpp @@ -0,0 +1,1829 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -89739,9 +90099,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // we check the safepoint instruction like the this. + return is_op(Assembler::lw_op) && is_rt(AT); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/nativeInst_mips.hpp b/hotspot/src/cpu/mips/vm/nativeInst_mips.hpp ---- a/hotspot/src/cpu/mips/vm/nativeInst_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/nativeInst_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/nativeInst_mips.hpp b/hotspot/src/cpu/mips/vm/nativeInst_mips.hpp +new file mode 100644 +index 0000000000..13a4cb4ef1 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/nativeInst_mips.hpp @@ -0,0 +1,735 @@ +/* + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. @@ -90478,9 +90840,64 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // CPU_MIPS_VM_NATIVEINST_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/register_definitions_mips.cpp b/hotspot/src/cpu/mips/vm/register_definitions_mips.cpp ---- a/hotspot/src/cpu/mips/vm/register_definitions_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/register_definitions_mips.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/registerMap_mips.hpp b/hotspot/src/cpu/mips/vm/registerMap_mips.hpp +new file mode 100644 +index 0000000000..7f800eb107 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/registerMap_mips.hpp +@@ -0,0 +1,47 @@ ++/* ++ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2016, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_MIPS_VM_REGISTERMAP_MIPS_HPP ++#define CPU_MIPS_VM_REGISTERMAP_MIPS_HPP ++ ++// machine-dependent implemention for register maps ++ friend class frame; ++ ++ private: ++#ifndef CORE ++ // This is the hook for finding a register in an "well-known" location, ++ // such as a register block of a predetermined format. ++ // Since there is none, we just return NULL. ++ // See registerMap_sparc.hpp for an example of grabbing registers ++ // from register save areas of a standard layout. ++ address pd_location(VMReg reg) const {return NULL;} ++#endif ++ ++ // no PD state to clear or copy: ++ void pd_clear() {} ++ void pd_initialize() {} ++ void pd_initialize_from(const RegisterMap* map) {} ++ ++#endif // CPU_MIPS_VM_REGISTERMAP_MIPS_HPP +diff --git a/hotspot/src/cpu/mips/vm/register_definitions_mips.cpp b/hotspot/src/cpu/mips/vm/register_definitions_mips.cpp +new file mode 100644 +index 0000000000..4af2531834 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/register_definitions_mips.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. @@ -90585,60 +91002,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +REGISTER_DEFINITION(FloatRegister, f29); +REGISTER_DEFINITION(FloatRegister, f30); +REGISTER_DEFINITION(FloatRegister, f31); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/registerMap_mips.hpp b/hotspot/src/cpu/mips/vm/registerMap_mips.hpp ---- a/hotspot/src/cpu/mips/vm/registerMap_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/registerMap_mips.hpp 2023-12-20 09:23:19.798147877 +0800 -@@ -0,0 +1,47 @@ -+/* -+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2016, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_MIPS_VM_REGISTERMAP_MIPS_HPP -+#define CPU_MIPS_VM_REGISTERMAP_MIPS_HPP -+ -+// machine-dependent implemention for register maps -+ friend class frame; -+ -+ private: -+#ifndef CORE -+ // This is the hook for finding a register in an "well-known" location, -+ // such as a register block of a predetermined format. -+ // Since there is none, we just return NULL. -+ // See registerMap_sparc.hpp for an example of grabbing registers -+ // from register save areas of a standard layout. -+ address pd_location(VMReg reg) const {return NULL;} -+#endif -+ -+ // no PD state to clear or copy: -+ void pd_clear() {} -+ void pd_initialize() {} -+ void pd_initialize_from(const RegisterMap* map) {} -+ -+#endif // CPU_MIPS_VM_REGISTERMAP_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/register_mips.cpp b/hotspot/src/cpu/mips/vm/register_mips.cpp ---- a/hotspot/src/cpu/mips/vm/register_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/register_mips.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/register_mips.cpp b/hotspot/src/cpu/mips/vm/register_mips.cpp +new file mode 100644 +index 0000000000..4a9b22bfef +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/register_mips.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. @@ -90692,9 +91060,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + return is_valid() ? names[encoding()] : "fnoreg"; +} + -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/register_mips.hpp b/hotspot/src/cpu/mips/vm/register_mips.hpp ---- a/hotspot/src/cpu/mips/vm/register_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/register_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/register_mips.hpp b/hotspot/src/cpu/mips/vm/register_mips.hpp +new file mode 100644 +index 0000000000..88bf2d68cc +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/register_mips.hpp @@ -0,0 +1,346 @@ +/* + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. @@ -91042,9 +91412,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif //CPU_MIPS_VM_REGISTER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/relocInfo_mips.cpp b/hotspot/src/cpu/mips/vm/relocInfo_mips.cpp ---- a/hotspot/src/cpu/mips/vm/relocInfo_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/relocInfo_mips.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/relocInfo_mips.cpp b/hotspot/src/cpu/mips/vm/relocInfo_mips.cpp +new file mode 100644 +index 0000000000..cae43b2d96 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/relocInfo_mips.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. @@ -91202,9 +91574,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + +void metadata_Relocation::pd_fix_value(address x) { +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/relocInfo_mips.hpp b/hotspot/src/cpu/mips/vm/relocInfo_mips.hpp ---- a/hotspot/src/cpu/mips/vm/relocInfo_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/relocInfo_mips.hpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/relocInfo_mips.hpp b/hotspot/src/cpu/mips/vm/relocInfo_mips.hpp +new file mode 100644 +index 0000000000..04ad5dac96 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/relocInfo_mips.hpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -91246,9 +91620,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + }; + +#endif // CPU_MIPS_VM_RELOCINFO_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/runtime_mips_64.cpp b/hotspot/src/cpu/mips/vm/runtime_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/runtime_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/runtime_mips_64.cpp 2023-12-20 09:23:19.798147877 +0800 +diff --git a/hotspot/src/cpu/mips/vm/runtime_mips_64.cpp b/hotspot/src/cpu/mips/vm/runtime_mips_64.cpp +new file mode 100644 +index 0000000000..bb9269b423 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/runtime_mips_64.cpp @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. @@ -91456,9 +91832,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + _exception_blob = ExceptionBlob::create(&buffer, oop_maps, framesize); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/sharedRuntime_mips_64.cpp b/hotspot/src/cpu/mips/vm/sharedRuntime_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/sharedRuntime_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/sharedRuntime_mips_64.cpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/sharedRuntime_mips_64.cpp b/hotspot/src/cpu/mips/vm/sharedRuntime_mips_64.cpp +new file mode 100644 +index 0000000000..daf04c4422 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/sharedRuntime_mips_64.cpp @@ -0,0 +1,3816 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -95276,9 +95654,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + reverse_words(m, (unsigned long *)m_ints, longwords); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/stubGenerator_mips_64.cpp b/hotspot/src/cpu/mips/vm/stubGenerator_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/stubGenerator_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/stubGenerator_mips_64.cpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/stubGenerator_mips_64.cpp b/hotspot/src/cpu/mips/vm/stubGenerator_mips_64.cpp +new file mode 100644 +index 0000000000..aeb797faf9 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/stubGenerator_mips_64.cpp @@ -0,0 +1,2147 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -97427,9 +97807,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +void StubGenerator_generate(CodeBuffer* code, bool all) { + StubGenerator g(code, all); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.cpp b/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.cpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.cpp b/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.cpp +new file mode 100644 +index 0000000000..733a48b889 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -97466,9 +97848,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + +//find the last fp value +address StubRoutines::gs2::_call_stub_compiled_return = NULL; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.hpp b/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.hpp ---- a/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.hpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.hpp b/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.hpp +new file mode 100644 +index 0000000000..920c08844e +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/stubRoutines_mips_64.hpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -97529,9 +97913,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_MIPS_VM_STUBROUTINES_MIPS_64_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/templateInterpreterGenerator_mips.hpp b/hotspot/src/cpu/mips/vm/templateInterpreterGenerator_mips.hpp ---- a/hotspot/src/cpu/mips/vm/templateInterpreterGenerator_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/templateInterpreterGenerator_mips.hpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/templateInterpreterGenerator_mips.hpp b/hotspot/src/cpu/mips/vm/templateInterpreterGenerator_mips.hpp +new file mode 100644 +index 0000000000..a83c3728f8 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/templateInterpreterGenerator_mips.hpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. @@ -97568,9 +97954,58 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + // address generate_asm_interpreter_entry(bool synchronized); + +#endif // CPU_MIPS_VM_TEMPLATEINTERPRETERGENERATOR_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/templateInterpreter_mips_64.cpp b/hotspot/src/cpu/mips/vm/templateInterpreter_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/templateInterpreter_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/templateInterpreter_mips_64.cpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/templateInterpreter_mips.hpp b/hotspot/src/cpu/mips/vm/templateInterpreter_mips.hpp +new file mode 100644 +index 0000000000..204f1b2f21 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/templateInterpreter_mips.hpp +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_MIPS_VM_TEMPLATEINTERPRETER_MIPS_HPP ++#define CPU_MIPS_VM_TEMPLATEINTERPRETER_MIPS_HPP ++ ++ ++ protected: ++ ++ // Size of interpreter code. Increase if too small. Interpreter will ++ // fail with a guarantee ("not enough space for interpreter generation"); ++ // if too small. ++ // Run with +PrintInterpreter to get the VM to print out the size. ++ // Max size with JVMTI ++ // The sethi() instruction generates lots more instructions when shell ++ // stack limit is unlimited, so that's why this is much bigger. ++ const static int InterpreterCodeSize = 500 * K; ++ ++#endif // CPU_MIPS_VM_TEMPLATEINTERPRETER_MIPS_HPP +diff --git a/hotspot/src/cpu/mips/vm/templateInterpreter_mips_64.cpp b/hotspot/src/cpu/mips/vm/templateInterpreter_mips_64.cpp +new file mode 100644 +index 0000000000..0cc5d33070 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/templateInterpreter_mips_64.cpp @@ -0,0 +1,2306 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -99878,13 +100313,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} +#endif // !PRODUCT +#endif // ! CC_INTERP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/templateInterpreter_mips.hpp b/hotspot/src/cpu/mips/vm/templateInterpreter_mips.hpp ---- a/hotspot/src/cpu/mips/vm/templateInterpreter_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/templateInterpreter_mips.hpp 2023-12-20 09:23:19.801481172 +0800 -@@ -0,0 +1,41 @@ +diff --git a/hotspot/src/cpu/mips/vm/templateTable_mips.hpp b/hotspot/src/cpu/mips/vm/templateTable_mips.hpp +new file mode 100644 +index 0000000000..d879e6dc92 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/templateTable_mips.hpp +@@ -0,0 +1,34 @@ +/* -+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. ++ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2016, Loongson Technology. 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 @@ -99907,25 +100344,20 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#ifndef CPU_MIPS_VM_TEMPLATEINTERPRETER_MIPS_HPP -+#define CPU_MIPS_VM_TEMPLATEINTERPRETER_MIPS_HPP -+ -+ -+ protected: -+ -+ // Size of interpreter code. Increase if too small. Interpreter will -+ // fail with a guarantee ("not enough space for interpreter generation"); -+ // if too small. -+ // Run with +PrintInterpreter to get the VM to print out the size. -+ // Max size with JVMTI -+ // The sethi() instruction generates lots more instructions when shell -+ // stack limit is unlimited, so that's why this is much bigger. -+ const static int InterpreterCodeSize = 500 * K; ++ static void prepare_invoke(Register method, Register index, int byte_no, ++ Bytecodes::Code code); ++ static void invokevirtual_helper(Register index, Register recv, ++ Register flags); ++ static void volatile_barrier(); + -+#endif // CPU_MIPS_VM_TEMPLATEINTERPRETER_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/templateTable_mips_64.cpp b/hotspot/src/cpu/mips/vm/templateTable_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/templateTable_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/templateTable_mips_64.cpp 2023-12-20 09:23:19.801481172 +0800 ++ // Helpers ++ static void index_check(Register array, Register index); ++ static void index_check_without_pop(Register array, Register index); +diff --git a/hotspot/src/cpu/mips/vm/templateTable_mips_64.cpp b/hotspot/src/cpu/mips/vm/templateTable_mips_64.cpp +new file mode 100644 +index 0000000000..7415511b99 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/templateTable_mips_64.cpp @@ -0,0 +1,4623 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -104550,9 +104982,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + __ sync(); +} +#endif // !CC_INTERP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/templateTable_mips_64.hpp b/hotspot/src/cpu/mips/vm/templateTable_mips_64.hpp ---- a/hotspot/src/cpu/mips/vm/templateTable_mips_64.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/templateTable_mips_64.hpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/templateTable_mips_64.hpp b/hotspot/src/cpu/mips/vm/templateTable_mips_64.hpp +new file mode 100644 +index 0000000000..b63274a206 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/templateTable_mips_64.hpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. @@ -104598,12 +105032,14 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + static void index_check_without_pop(Register array, Register index); + +#endif // CPU_MIPS_VM_TEMPLATETABLE_MIPS_64_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/templateTable_mips.hpp b/hotspot/src/cpu/mips/vm/templateTable_mips.hpp ---- a/hotspot/src/cpu/mips/vm/templateTable_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/templateTable_mips.hpp 2023-12-20 09:23:19.801481172 +0800 -@@ -0,0 +1,34 @@ +diff --git a/hotspot/src/cpu/mips/vm/vmStructs_mips.hpp b/hotspot/src/cpu/mips/vm/vmStructs_mips.hpp +new file mode 100644 +index 0000000000..6939914356 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vmStructs_mips.hpp +@@ -0,0 +1,68 @@ +/* -+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Loongson Technology. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * @@ -104627,260 +105063,58 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+ static void prepare_invoke(Register method, Register index, int byte_no, -+ Bytecodes::Code code); -+ static void invokevirtual_helper(Register index, Register recv, -+ Register flags); -+ static void volatile_barrier(); ++#ifndef CPU_MIPS_VM_VMSTRUCTS_MIPS_HPP ++#define CPU_MIPS_VM_VMSTRUCTS_MIPS_HPP + -+ // Helpers -+ static void index_check(Register array, Register index); -+ static void index_check_without_pop(Register array, Register index); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vmreg_mips.cpp b/hotspot/src/cpu/mips/vm/vmreg_mips.cpp ---- a/hotspot/src/cpu/mips/vm/vmreg_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vmreg_mips.cpp 2023-12-20 09:23:19.801481172 +0800 -@@ -0,0 +1,51 @@ ++// These are the CPU-specific fields, types and integer ++// constants required by the Serviceability Agent. This file is ++// referenced by vmStructs.cpp. ++ ++#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ ++ \ ++ /******************************/ \ ++ /* JavaCallWrapper */ \ ++ /******************************/ \ ++ /******************************/ \ ++ /* JavaFrameAnchor */ \ ++ /******************************/ \ ++ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) \ ++ \ ++ ++ /* NOTE that we do not use the last_entry() macro here; it is used */ ++ /* in vmStructs__.hpp's VM_STRUCTS_OS_CPU macro (and must */ ++ /* be present there) */ ++ ++ ++#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \ ++ ++ /* NOTE that we do not use the last_entry() macro here; it is used */ ++ /* in vmStructs__.hpp's VM_TYPES_OS_CPU macro (and must */ ++ /* be present there) */ ++ ++ ++#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ ++ ++ /* NOTE that we do not use the last_entry() macro here; it is used */ ++ /* in vmStructs__.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */ ++ /* be present there) */ ++ ++#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ ++ ++ /* NOTE that we do not use the last_entry() macro here; it is used */ ++ /* in vmStructs__.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */ ++ /* be present there) */ ++ ++#endif // CPU_MIPS_VM_VMSTRUCTS_MIPS_HPP +diff --git a/hotspot/src/cpu/mips/vm/vm_version_ext_mips.cpp b/hotspot/src/cpu/mips/vm/vm_version_ext_mips.cpp +new file mode 100644 +index 0000000000..a98f70d9ff +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vm_version_ext_mips.cpp +@@ -0,0 +1,89 @@ +/* -+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. 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 "precompiled.hpp" -+#include "asm/assembler.hpp" -+#include "code/vmreg.hpp" -+ -+ -+ -+void VMRegImpl::set_regName() { -+ Register reg = ::as_Register(0); -+ int i; -+ for (i = 0; i < ConcreteRegisterImpl::max_gpr ; ) { -+ regName[i++] = reg->name(); -+ regName[i++] = reg->name(); -+ reg = reg->successor(); -+ } -+ -+ FloatRegister freg = ::as_FloatRegister(0); -+ for ( ; i < ConcreteRegisterImpl::max_fpr ; ) { -+ regName[i++] = freg->name(); -+ regName[i++] = freg->name(); -+ freg = freg->successor(); -+ } -+ -+ for ( ; i < ConcreteRegisterImpl::number_of_registers ; i ++ ) { -+ regName[i] = "NON-GPR-FPR"; -+ } -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vmreg_mips.hpp b/hotspot/src/cpu/mips/vm/vmreg_mips.hpp ---- a/hotspot/src/cpu/mips/vm/vmreg_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vmreg_mips.hpp 2023-12-20 09:23:19.801481172 +0800 -@@ -0,0 +1,35 @@ -+/* -+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_MIPS_VM_VMREG_MIPS_HPP -+#define CPU_MIPS_VM_VMREG_MIPS_HPP -+ -+bool is_Register(); -+Register as_Register(); -+ -+bool is_FloatRegister(); -+FloatRegister as_FloatRegister(); -+ -+#endif // CPU_MIPS_VM_VMREG_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vmreg_mips.inline.hpp b/hotspot/src/cpu/mips/vm/vmreg_mips.inline.hpp ---- a/hotspot/src/cpu/mips/vm/vmreg_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vmreg_mips.inline.hpp 2023-12-20 09:23:19.801481172 +0800 -@@ -0,0 +1,68 @@ -+/* -+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_MIPS_VM_VMREG_MIPS_INLINE_HPP -+#define CPU_MIPS_VM_VMREG_MIPS_INLINE_HPP -+ -+inline VMReg RegisterImpl::as_VMReg() { -+ if( this==noreg ) return VMRegImpl::Bad(); -+ return VMRegImpl::as_VMReg(encoding() << 1 ); -+} -+ -+inline VMReg FloatRegisterImpl::as_VMReg() { -+ return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr); -+} -+ -+inline bool VMRegImpl::is_Register() { -+ return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr; -+} -+ -+inline bool VMRegImpl::is_FloatRegister() { -+ return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr; -+} -+ -+inline Register VMRegImpl::as_Register() { -+ -+ assert( is_Register(), "must be"); -+ // Yuk -+ return ::as_Register(value() >> 1); -+} -+ -+inline FloatRegister VMRegImpl::as_FloatRegister() { -+ assert( is_FloatRegister(), "must be" ); -+ // Yuk -+ assert( is_even(value()), "must be" ); -+ return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1); -+} -+ -+inline bool VMRegImpl::is_concrete() { -+ assert(is_reg(), "must be"); -+ if(is_Register()) return true; -+ if(is_FloatRegister()) return true; -+ assert(false, "what register?"); -+ return false; -+} -+ -+#endif // CPU_MIPS_VM_VMREG_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vmStructs_mips.hpp b/hotspot/src/cpu/mips/vm/vmStructs_mips.hpp ---- a/hotspot/src/cpu/mips/vm/vmStructs_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vmStructs_mips.hpp 2023-12-20 09:23:19.801481172 +0800 -@@ -0,0 +1,68 @@ -+/* -+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2016, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef CPU_MIPS_VM_VMSTRUCTS_MIPS_HPP -+#define CPU_MIPS_VM_VMSTRUCTS_MIPS_HPP -+ -+// These are the CPU-specific fields, types and integer -+// constants required by the Serviceability Agent. This file is -+// referenced by vmStructs.cpp. -+ -+#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ -+ \ -+ /******************************/ \ -+ /* JavaCallWrapper */ \ -+ /******************************/ \ -+ /******************************/ \ -+ /* JavaFrameAnchor */ \ -+ /******************************/ \ -+ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) \ -+ \ -+ -+ /* NOTE that we do not use the last_entry() macro here; it is used */ -+ /* in vmStructs__.hpp's VM_STRUCTS_OS_CPU macro (and must */ -+ /* be present there) */ -+ -+ -+#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \ -+ -+ /* NOTE that we do not use the last_entry() macro here; it is used */ -+ /* in vmStructs__.hpp's VM_TYPES_OS_CPU macro (and must */ -+ /* be present there) */ -+ -+ -+#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ -+ -+ /* NOTE that we do not use the last_entry() macro here; it is used */ -+ /* in vmStructs__.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */ -+ /* be present there) */ -+ -+#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \ -+ -+ /* NOTE that we do not use the last_entry() macro here; it is used */ -+ /* in vmStructs__.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */ -+ /* be present there) */ -+ -+#endif // CPU_MIPS_VM_VMSTRUCTS_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vm_version_ext_mips.cpp b/hotspot/src/cpu/mips/vm/vm_version_ext_mips.cpp ---- a/hotspot/src/cpu/mips/vm/vm_version_ext_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vm_version_ext_mips.cpp 2023-12-20 09:23:19.801481172 +0800 -@@ -0,0 +1,89 @@ -+/* -+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2018, 2020, Loongson Technology. All rights reserved. ++ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2018, 2020, Loongson Technology. 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 @@ -104967,9 +105201,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + strncpy(tmp, _cpu_desc, CPU_DETAILED_DESC_BUF_SIZE); + return tmp; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vm_version_ext_mips.hpp b/hotspot/src/cpu/mips/vm/vm_version_ext_mips.hpp ---- a/hotspot/src/cpu/mips/vm/vm_version_ext_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vm_version_ext_mips.hpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/vm_version_ext_mips.hpp b/hotspot/src/cpu/mips/vm/vm_version_ext_mips.hpp +new file mode 100644 +index 0000000000..a240fcc2e9 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vm_version_ext_mips.hpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. @@ -105025,9 +105261,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_MIPS_VM_VM_VERSION_EXT_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vm_version_mips.cpp b/hotspot/src/cpu/mips/vm/vm_version_mips.cpp ---- a/hotspot/src/cpu/mips/vm/vm_version_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vm_version_mips.cpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/vm_version_mips.cpp b/hotspot/src/cpu/mips/vm/vm_version_mips.cpp +new file mode 100644 +index 0000000000..aef8f0746a +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vm_version_mips.cpp @@ -0,0 +1,510 @@ +/* + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -105539,9 +105777,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + + get_processor_features(); +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vm_version_mips.hpp b/hotspot/src/cpu/mips/vm/vm_version_mips.hpp ---- a/hotspot/src/cpu/mips/vm/vm_version_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vm_version_mips.hpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/vm_version_mips.hpp b/hotspot/src/cpu/mips/vm/vm_version_mips.hpp +new file mode 100644 +index 0000000000..0de01e5f64 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vm_version_mips.hpp @@ -0,0 +1,221 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. @@ -105764,9 +106004,183 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +}; + +#endif // CPU_MIPS_VM_VM_VERSION_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/mips/vm/vtableStubs_mips_64.cpp b/hotspot/src/cpu/mips/vm/vtableStubs_mips_64.cpp ---- a/hotspot/src/cpu/mips/vm/vtableStubs_mips_64.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/cpu/mips/vm/vtableStubs_mips_64.cpp 2023-12-20 09:23:19.801481172 +0800 +diff --git a/hotspot/src/cpu/mips/vm/vmreg_mips.cpp b/hotspot/src/cpu/mips/vm/vmreg_mips.cpp +new file mode 100644 +index 0000000000..86bd74d430 +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vmreg_mips.cpp +@@ -0,0 +1,51 @@ ++/* ++ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. 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 "precompiled.hpp" ++#include "asm/assembler.hpp" ++#include "code/vmreg.hpp" ++ ++ ++ ++void VMRegImpl::set_regName() { ++ Register reg = ::as_Register(0); ++ int i; ++ for (i = 0; i < ConcreteRegisterImpl::max_gpr ; ) { ++ regName[i++] = reg->name(); ++ regName[i++] = reg->name(); ++ reg = reg->successor(); ++ } ++ ++ FloatRegister freg = ::as_FloatRegister(0); ++ for ( ; i < ConcreteRegisterImpl::max_fpr ; ) { ++ regName[i++] = freg->name(); ++ regName[i++] = freg->name(); ++ freg = freg->successor(); ++ } ++ ++ for ( ; i < ConcreteRegisterImpl::number_of_registers ; i ++ ) { ++ regName[i] = "NON-GPR-FPR"; ++ } ++} +diff --git a/hotspot/src/cpu/mips/vm/vmreg_mips.hpp b/hotspot/src/cpu/mips/vm/vmreg_mips.hpp +new file mode 100644 +index 0000000000..6a970ea91a +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vmreg_mips.hpp +@@ -0,0 +1,35 @@ ++/* ++ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_MIPS_VM_VMREG_MIPS_HPP ++#define CPU_MIPS_VM_VMREG_MIPS_HPP ++ ++bool is_Register(); ++Register as_Register(); ++ ++bool is_FloatRegister(); ++FloatRegister as_FloatRegister(); ++ ++#endif // CPU_MIPS_VM_VMREG_MIPS_HPP +diff --git a/hotspot/src/cpu/mips/vm/vmreg_mips.inline.hpp b/hotspot/src/cpu/mips/vm/vmreg_mips.inline.hpp +new file mode 100644 +index 0000000000..77e18ce57d +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vmreg_mips.inline.hpp +@@ -0,0 +1,68 @@ ++/* ++ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef CPU_MIPS_VM_VMREG_MIPS_INLINE_HPP ++#define CPU_MIPS_VM_VMREG_MIPS_INLINE_HPP ++ ++inline VMReg RegisterImpl::as_VMReg() { ++ if( this==noreg ) return VMRegImpl::Bad(); ++ return VMRegImpl::as_VMReg(encoding() << 1 ); ++} ++ ++inline VMReg FloatRegisterImpl::as_VMReg() { ++ return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr); ++} ++ ++inline bool VMRegImpl::is_Register() { ++ return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr; ++} ++ ++inline bool VMRegImpl::is_FloatRegister() { ++ return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr; ++} ++ ++inline Register VMRegImpl::as_Register() { ++ ++ assert( is_Register(), "must be"); ++ // Yuk ++ return ::as_Register(value() >> 1); ++} ++ ++inline FloatRegister VMRegImpl::as_FloatRegister() { ++ assert( is_FloatRegister(), "must be" ); ++ // Yuk ++ assert( is_even(value()), "must be" ); ++ return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1); ++} ++ ++inline bool VMRegImpl::is_concrete() { ++ assert(is_reg(), "must be"); ++ if(is_Register()) return true; ++ if(is_FloatRegister()) return true; ++ assert(false, "what register?"); ++ return false; ++} ++ ++#endif // CPU_MIPS_VM_VMREG_MIPS_INLINE_HPP +diff --git a/hotspot/src/cpu/mips/vm/vtableStubs_mips_64.cpp b/hotspot/src/cpu/mips/vm/vtableStubs_mips_64.cpp +new file mode 100644 +index 0000000000..7779c58e0a +--- /dev/null ++++ b/hotspot/src/cpu/mips/vm/vtableStubs_mips_64.cpp @@ -0,0 +1,301 @@ +/* + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. @@ -106069,10 +106483,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +int VtableStub::pd_code_alignment() { + return wordSize; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp ---- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp 2023-12-20 09:23:19.824814237 +0800 -@@ -1513,6 +1513,10 @@ +diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +index c1c053e66c..5c90df1079 100644 +--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp ++++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +@@ -1513,6 +1513,10 @@ void LIR_Assembler::emit_opBranch(LIR_OpBranch* op) { } } @@ -106083,7 +106498,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) { LIR_Opr src = op->in_opr(); LIR_Opr dest = op->result_opr(); -@@ -2102,6 +2106,12 @@ +@@ -2102,6 +2106,12 @@ void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, L } @@ -106096,10 +106511,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_Assembler::arith_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr dest, CodeEmitInfo* info, bool pop_fpu_stack) { assert(info == NULL, "should never be used, idiv/irem and ldiv/lrem not handled by this method"); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp ---- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp 2023-12-20 09:23:19.824814237 +0800 -@@ -242,20 +242,27 @@ +diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +index 92b73e1c71..45da327efb 100644 +--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp ++++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +@@ -242,20 +242,27 @@ void LIRGenerator::increment_counter(LIR_Address* addr, int step) { __ add((LIR_Opr)addr, LIR_OprFact::intConst(step), (LIR_Opr)addr); } @@ -106134,9 +106550,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) { if (tmp->is_valid() && c > 0 && c < max_jint) { -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp ---- a/hotspot/src/os/linux/vm/os_linux.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/os/linux/vm/os_linux.cpp 2023-12-20 09:23:19.851480600 +0800 +diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp +index 54cfcdd116..c3d22ba5d3 100644 +--- a/hotspot/src/os/linux/vm/os_linux.cpp ++++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -22,6 +22,12 @@ * */ @@ -106150,19 +106567,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // no precompiled headers #include "classfile/classLoader.hpp" #include "classfile/systemDictionary.hpp" -@@ -1969,7 +1975,11 @@ +@@ -1972,6 +1978,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"}, {EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"}, {EM_MIPS, EM_MIPS, ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"}, + {EM_MIPS, EM_MIPS, ELFCLASS64, ELFDATA2LSB, (char*)"MIPS64 LE"}, {EM_PARISC, EM_PARISC, ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"}, -+#if defined (LOONGARCH64) -+ {EM_LOONGARCH, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB, (char*)"LOONGARCH64"}, -+#endif {EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"}, {EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"}, - }; -@@ -1984,6 +1994,8 @@ +@@ -1988,6 +1995,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) static Elf32_Half running_arch_code=EM_SPARCV9; #elif (defined __sparc) && (!defined _LP64) static Elf32_Half running_arch_code=EM_SPARC; @@ -106171,20 +106584,16 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #elif (defined __powerpc64__) static Elf32_Half running_arch_code=EM_PPC64; #elif (defined __powerpc__) -@@ -2004,9 +2016,11 @@ - static Elf32_Half running_arch_code=EM_68K; - #elif (defined AARCH64) - static Elf32_Half running_arch_code=EM_AARCH64; -+ #elif (defined LOONGARCH64) -+ static Elf32_Half running_arch_code=EM_LOONGARCH; +@@ -2012,7 +2021,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) + static Elf32_Half running_arch_code=EM_LOONGARCH; #else #error Method os::dll_load requires that one of following is defined:\ -- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64 -+ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, __mips64, PARISC, M68K, AARCH64 +- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH ++ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, __mips64, PARISC, M68K, AARCH64, LOONGARCH #endif // Identify compatability class for VM's architecture and library's architecture -@@ -3513,7 +3527,7 @@ +@@ -3519,7 +3528,7 @@ size_t os::Linux::find_large_page_size() { #ifndef ZERO large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M) @@ -106193,7 +106602,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif // ZERO FILE *fp = fopen("/proc/meminfo", "r"); -@@ -5120,7 +5134,12 @@ +@@ -5126,7 +5135,12 @@ jint os::init_2(void) Linux::fast_thread_clock_init(); // Allocate a single page and mark it as readable for safepoint polling @@ -106206,7 +106615,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp guarantee( polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page" ); os::set_polling_page( polling_page ); -@@ -5155,13 +5174,20 @@ +@@ -5161,13 +5175,20 @@ jint os::init_2(void) // size. Add a page for compiler2 recursion in main thread. // Add in 2*BytesPerWord times page size to account for VM stack during // class initialization depending on 32 or 64 bit VM. @@ -106228,9 +106637,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp tty->print_cr("\nThe stack size specified is too small, " "Specify at least %dk", os::Linux::min_stack_allowed/ K); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os/linux/vm/os_perf_linux.cpp b/hotspot/src/os/linux/vm/os_perf_linux.cpp ---- a/hotspot/src/os/linux/vm/os_perf_linux.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/os/linux/vm/os_perf_linux.cpp 2023-12-20 09:23:19.851480600 +0800 +diff --git a/hotspot/src/os/linux/vm/os_perf_linux.cpp b/hotspot/src/os/linux/vm/os_perf_linux.cpp +index 0d1f75810a..cbc6c0757c 100644 +--- a/hotspot/src/os/linux/vm/os_perf_linux.cpp ++++ b/hotspot/src/os/linux/vm/os_perf_linux.cpp @@ -50,6 +50,12 @@ #ifdef TARGET_ARCH_ppc # include "vm_version_ext_ppc.hpp" @@ -106244,9 +106654,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include #include -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/assembler_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/assembler_linux_loongarch.cpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/assembler_linux_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/assembler_linux_loongarch.cpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/assembler_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/assembler_linux_loongarch.cpp +new file mode 100644 +index 0000000000..5ee0965f42 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/assembler_linux_loongarch.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. @@ -106340,9 +106752,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } +#endif // MINIMIZE_RAM_USAGE +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/atomic_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/atomic_linux_loongarch.inline.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/atomic_linux_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/atomic_linux_loongarch.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/atomic_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/atomic_linux_loongarch.inline.hpp +new file mode 100644 +index 0000000000..69590ba582 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/atomic_linux_loongarch.inline.hpp @@ -0,0 +1,206 @@ +/* + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. @@ -106550,9 +106964,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // OS_CPU_LINUX_LOONGARCH_VM_ATOMIC_LINUX_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/bytes_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/bytes_linux_loongarch.inline.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/bytes_linux_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/bytes_linux_loongarch.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/bytes_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/bytes_linux_loongarch.inline.hpp +new file mode 100644 +index 0000000000..4e205c468e +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/bytes_linux_loongarch.inline.hpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. @@ -106591,9 +107007,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +inline u8 Bytes::swap_u8(u8 x) { return bswap_64(x); } + +#endif // OS_CPU_LINUX_LOONGARCH_VM_BYTES_LINUX_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/copy_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/copy_linux_loongarch.inline.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/copy_linux_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/copy_linux_loongarch.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/copy_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/copy_linux_loongarch.inline.hpp +new file mode 100644 +index 0000000000..7d6e11a935 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/copy_linux_loongarch.inline.hpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. @@ -106720,9 +107138,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // OS_CPU_LINUX_LOONGARCH_VM_COPY_LINUX_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/globals_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/globals_linux_loongarch.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/globals_linux_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/globals_linux_loongarch.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/globals_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/globals_linux_loongarch.hpp +new file mode 100644 +index 0000000000..8ec3fa8239 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/globals_linux_loongarch.hpp @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -106767,9 +107187,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +define_pd_global(uintx,HeapBaseMinAddress, 2*G); + +#endif // OS_CPU_LINUX_LOONGARCH_VM_GLOBALS_LINUX_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/orderAccess_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/orderAccess_linux_loongarch.inline.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/orderAccess_linux_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/orderAccess_linux_loongarch.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/orderAccess_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/orderAccess_linux_loongarch.inline.hpp +new file mode 100644 +index 0000000000..3e050c8d09 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/orderAccess_linux_loongarch.inline.hpp @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -106886,9 +107308,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#undef inlasm_sync + +#endif // OS_CPU_LINUX_LOONGARCH_VM_ORDERACCESS_LINUX_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp +new file mode 100644 +index 0000000000..f2c3df84a1 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp @@ -0,0 +1,750 @@ +/* + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. @@ -107640,9 +108064,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +bool os::is_ActiveCoresMP() { + return UseActiveCoresMP && _initial_active_processor_count == 1; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.hpp +new file mode 100644 +index 0000000000..a7321ae025 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.hpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. @@ -107683,9 +108109,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + static bool is_ActiveCoresMP(); + +#endif // OS_CPU_LINUX_LOONGARCH_VM_OS_LINUX_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/prefetch_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/prefetch_linux_loongarch.inline.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/prefetch_linux_loongarch.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/prefetch_linux_loongarch.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/prefetch_linux_loongarch.inline.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/prefetch_linux_loongarch.inline.hpp +new file mode 100644 +index 0000000000..a1cedcd8cf +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/prefetch_linux_loongarch.inline.hpp @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. @@ -107743,9 +108171,168 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // OS_CPU_LINUX_LOONGARCH_VM_PREFETCH_LINUX_LOONGARCH_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.cpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.cpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.cpp +new file mode 100644 +index 0000000000..be28a562a1 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.cpp +@@ -0,0 +1,84 @@ ++/* ++ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. 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 "precompiled.hpp" ++#include "runtime/thread.inline.hpp" ++#include "runtime/threadLocalStorage.hpp" ++ ++// Map stack pointer (%esp) to thread pointer for faster TLS access ++// ++// Here we use a flat table for better performance. Getting current thread ++// is down to one memory access (read _sp_map[%esp>>12]) in generated code ++// and two in runtime code (-fPIC code needs an extra load for _sp_map). ++// ++// This code assumes stack page is not shared by different threads. It works ++// in 32-bit VM when page size is 4K (or a multiple of 4K, if that matters). ++// ++// Notice that _sp_map is allocated in the bss segment, which is ZFOD ++// (zero-fill-on-demand). While it reserves 4M address space upfront, ++// actual memory pages are committed on demand. ++// ++// If an application creates and destroys a lot of threads, usually the ++// stack space freed by a thread will soon get reused by new thread ++// (this is especially true in NPTL or LinuxThreads in fixed-stack mode). ++// No memory page in _sp_map is wasted. ++// ++// However, it's still possible that we might end up populating & ++// committing a large fraction of the 4M table over time, but the actual ++// amount of live data in the table could be quite small. The max wastage ++// is less than 4M bytes. If it becomes an issue, we could use madvise() ++// with MADV_DONTNEED to reclaim unused (i.e. all-zero) pages in _sp_map. ++// MADV_DONTNEED on Linux keeps the virtual memory mapping, but zaps the ++// physical memory page (i.e. similar to MADV_FREE on Solaris). ++ ++#ifdef MINIMIZE_RAM_USAGE ++Thread* ThreadLocalStorage::_sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; ++#endif // MINIMIZE_RAM_USAGE ++ ++void ThreadLocalStorage::generate_code_for_get_thread() { ++ // nothing we can do here for user-level thread ++} ++ ++void ThreadLocalStorage::pd_init() { ++#ifdef MINIMIZE_RAM_USAGE ++ assert(align_size_down(os::vm_page_size(), PAGE_SIZE) == os::vm_page_size(), ++ "page size must be multiple of PAGE_SIZE"); ++#endif // MINIMIZE_RAM_USAGE ++} ++ ++void ThreadLocalStorage::pd_set_thread(Thread* thread) { ++ os::thread_local_storage_at_put(ThreadLocalStorage::thread_index(), thread); ++#ifdef MINIMIZE_RAM_USAGE ++ address stack_top = os::current_stack_base(); ++ size_t stack_size = os::current_stack_size(); ++ ++ for (address p = stack_top - stack_size; p < stack_top; p += PAGE_SIZE) { ++ int index = ((uintptr_t)p >> PAGE_SHIFT) & ((1UL << (SP_BITLENGTH - PAGE_SHIFT)) - 1); ++ assert(thread == NULL || _sp_map[index] == NULL || thread == _sp_map[index], ++ "thread exited without detaching from VM??"); ++ _sp_map[index] = thread; ++ } ++#endif // MINIMIZE_RAM_USAGE ++} +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.hpp +new file mode 100644 +index 0000000000..4fab788a75 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.hpp +@@ -0,0 +1,61 @@ ++/* ++ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef OS_CPU_LINUX_LOONGARCH_VM_THREADLS_LINUX_LOONGARCH_HPP ++#define OS_CPU_LINUX_LOONGARCH_VM_THREADLS_LINUX_LOONGARCH_HPP ++ ++#ifdef MINIMIZE_RAM_USAGE ++ // Processor dependent parts of ThreadLocalStorage ++ //only the low 2G space for user program in Linux ++ ++ #define SP_BITLENGTH 34 ++ #define PAGE_SHIFT 14 ++ #define PAGE_SIZE (1UL << PAGE_SHIFT) ++ ++ static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; ++ static int _sp_map_low; ++ static int _sp_map_high; ++#endif // MINIMIZE_RAM_USAGE ++ ++public: ++#ifdef MINIMIZE_RAM_USAGE ++ static Thread** sp_map_addr() { return _sp_map; } ++#endif // MINIMIZE_RAM_USAGE ++ ++ static Thread* thread() { ++#ifdef MINIMIZE_RAM_USAGE ++ /* Thread::thread() can also be optimized in the same way as __get_thread() */ ++ //return (Thread*) os::thread_local_storage_at(thread_index()); ++ uintptr_t sp; ++ uintptr_t mask = (1UL << (SP_BITLENGTH - PAGE_SHIFT)) - 1; ++ ++ __asm__ __volatile__ ("addi.d %0, $r29, 0 " : "=r" (sp)); ++ ++ return _sp_map[(sp >> PAGE_SHIFT) & mask]; ++#else ++ return (Thread*) os::thread_local_storage_at(thread_index()); ++#endif // MINIMIZE_RAM_USAGE ++ } ++#endif // OS_CPU_LINUX_LOONGARCH_VM_THREADLS_LINUX_LOONGARCH_HPP +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.cpp +new file mode 100644 +index 0000000000..44f666d61f +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -107846,9 +108433,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + +void JavaThread::cache_global_variables() { } + -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.hpp +new file mode 100644 +index 0000000000..d6dd2521f4 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/thread_linux_loongarch.hpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -107925,13 +108514,15 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + static void disable_register_stack_guard() {} + +#endif // OS_CPU_LINUX_LOONGARCH_VM_THREAD_LINUX_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.cpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.cpp 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,84 @@ +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/vmStructs_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/vmStructs_linux_loongarch.hpp +new file mode 100644 +index 0000000000..0097cadcb7 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/vmStructs_linux_loongarch.hpp +@@ -0,0 +1,55 @@ +/* -+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. ++ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2020, Loongson Technology. 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 @@ -107954,226 +108545,77 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * + */ + -+#include "precompiled.hpp" -+#include "runtime/thread.inline.hpp" -+#include "runtime/threadLocalStorage.hpp" ++#ifndef OS_CPU_LINUX_LOONGARCH_VM_VMSTRUCTS_LINUX_LOONGARCH_HPP ++#define OS_CPU_LINUX_LOONGARCH_VM_VMSTRUCTS_LINUX_LOONGARCH_HPP + -+// Map stack pointer (%esp) to thread pointer for faster TLS access -+// -+// Here we use a flat table for better performance. Getting current thread -+// is down to one memory access (read _sp_map[%esp>>12]) in generated code -+// and two in runtime code (-fPIC code needs an extra load for _sp_map). -+// -+// This code assumes stack page is not shared by different threads. It works -+// in 32-bit VM when page size is 4K (or a multiple of 4K, if that matters). -+// -+// Notice that _sp_map is allocated in the bss segment, which is ZFOD -+// (zero-fill-on-demand). While it reserves 4M address space upfront, -+// actual memory pages are committed on demand. -+// -+// If an application creates and destroys a lot of threads, usually the -+// stack space freed by a thread will soon get reused by new thread -+// (this is especially true in NPTL or LinuxThreads in fixed-stack mode). -+// No memory page in _sp_map is wasted. -+// -+// However, it's still possible that we might end up populating & -+// committing a large fraction of the 4M table over time, but the actual -+// amount of live data in the table could be quite small. The max wastage -+// is less than 4M bytes. If it becomes an issue, we could use madvise() -+// with MADV_DONTNEED to reclaim unused (i.e. all-zero) pages in _sp_map. -+// MADV_DONTNEED on Linux keeps the virtual memory mapping, but zaps the -+// physical memory page (i.e. similar to MADV_FREE on Solaris). ++// These are the OS and CPU-specific fields, types and integer ++// constants required by the Serviceability Agent. This file is ++// referenced by vmStructs.cpp. + -+#ifdef MINIMIZE_RAM_USAGE -+Thread* ThreadLocalStorage::_sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; -+#endif // MINIMIZE_RAM_USAGE ++#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ ++ \ ++ /******************************/ \ ++ /* Threads (NOTE: incomplete) */ \ ++ /******************************/ \ ++ nonstatic_field(OSThread, _thread_id, pid_t) \ ++ nonstatic_field(OSThread, _pthread_id, pthread_t) + -+void ThreadLocalStorage::generate_code_for_get_thread() { -+ // nothing we can do here for user-level thread -+} + -+void ThreadLocalStorage::pd_init() { -+#ifdef MINIMIZE_RAM_USAGE -+ assert(align_size_down(os::vm_page_size(), PAGE_SIZE) == os::vm_page_size(), -+ "page size must be multiple of PAGE_SIZE"); -+#endif // MINIMIZE_RAM_USAGE -+} ++#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \ ++ \ ++ /**********************/ \ ++ /* Posix Thread IDs */ \ ++ /**********************/ \ ++ \ ++ declare_integer_type(pid_t) \ ++ declare_unsigned_integer_type(pthread_t) + -+void ThreadLocalStorage::pd_set_thread(Thread* thread) { -+ os::thread_local_storage_at_put(ThreadLocalStorage::thread_index(), thread); -+#ifdef MINIMIZE_RAM_USAGE -+ address stack_top = os::current_stack_base(); -+ size_t stack_size = os::current_stack_size(); ++#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) + -+ for (address p = stack_top - stack_size; p < stack_top; p += PAGE_SIZE) { -+ int index = ((uintptr_t)p >> PAGE_SHIFT) & ((1UL << (SP_BITLENGTH - PAGE_SHIFT)) - 1); -+ assert(thread == NULL || _sp_map[index] == NULL || thread == _sp_map[index], -+ "thread exited without detaching from VM??"); -+ _sp_map[index] = thread; -+ } -+#endif // MINIMIZE_RAM_USAGE -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/threadLS_linux_loongarch.hpp 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,61 @@ -+/* -+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef OS_CPU_LINUX_LOONGARCH_VM_THREADLS_LINUX_LOONGARCH_HPP -+#define OS_CPU_LINUX_LOONGARCH_VM_THREADLS_LINUX_LOONGARCH_HPP -+ -+#ifdef MINIMIZE_RAM_USAGE -+ // Processor dependent parts of ThreadLocalStorage -+ //only the low 2G space for user program in Linux -+ -+ #define SP_BITLENGTH 34 -+ #define PAGE_SHIFT 14 -+ #define PAGE_SIZE (1UL << PAGE_SHIFT) -+ -+ static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; -+ static int _sp_map_low; -+ static int _sp_map_high; -+#endif // MINIMIZE_RAM_USAGE -+ -+public: -+#ifdef MINIMIZE_RAM_USAGE -+ static Thread** sp_map_addr() { return _sp_map; } -+#endif // MINIMIZE_RAM_USAGE -+ -+ static Thread* thread() { -+#ifdef MINIMIZE_RAM_USAGE -+ /* Thread::thread() can also be optimized in the same way as __get_thread() */ -+ //return (Thread*) os::thread_local_storage_at(thread_index()); -+ uintptr_t sp; -+ uintptr_t mask = (1UL << (SP_BITLENGTH - PAGE_SHIFT)) - 1; -+ -+ __asm__ __volatile__ ("addi.d %0, $r29, 0 " : "=r" (sp)); -+ -+ return _sp_map[(sp >> PAGE_SHIFT) & mask]; -+#else -+ return (Thread*) os::thread_local_storage_at(thread_index()); -+#endif // MINIMIZE_RAM_USAGE -+ } -+#endif // OS_CPU_LINUX_LOONGARCH_VM_THREADLS_LINUX_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/vmStructs_linux_loongarch.hpp b/hotspot/src/os_cpu/linux_loongarch/vm/vmStructs_linux_loongarch.hpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/vmStructs_linux_loongarch.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/vmStructs_linux_loongarch.hpp 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,55 @@ -+/* -+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef OS_CPU_LINUX_LOONGARCH_VM_VMSTRUCTS_LINUX_LOONGARCH_HPP -+#define OS_CPU_LINUX_LOONGARCH_VM_VMSTRUCTS_LINUX_LOONGARCH_HPP -+ -+// These are the OS and CPU-specific fields, types and integer -+// constants required by the Serviceability Agent. This file is -+// referenced by vmStructs.cpp. -+ -+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \ -+ \ -+ /******************************/ \ -+ /* Threads (NOTE: incomplete) */ \ -+ /******************************/ \ -+ nonstatic_field(OSThread, _thread_id, pid_t) \ -+ nonstatic_field(OSThread, _pthread_id, pthread_t) -+ -+ -+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \ -+ \ -+ /**********************/ \ -+ /* Posix Thread IDs */ \ -+ /**********************/ \ -+ \ -+ declare_integer_type(pid_t) \ -+ declare_unsigned_integer_type(pthread_t) -+ -+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) -+ -+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) -+ -+#endif // OS_CPU_LINUX_LOONGARCH_VM_VMSTRUCTS_LINUX_LOONGARCH_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_loongarch/vm/vm_version_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/vm_version_linux_loongarch.cpp ---- a/hotspot/src/os_cpu/linux_loongarch/vm/vm_version_linux_loongarch.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_loongarch/vm/vm_version_linux_loongarch.cpp 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,29 @@ -+/* -+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2023, Loongson Technology. 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 "precompiled.hpp" -+#include "runtime/os.hpp" -+#include "vm_version_loongarch.hpp" -+ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/assembler_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/assembler_linux_mips.cpp ---- a/hotspot/src/os_cpu/linux_mips/vm/assembler_linux_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/assembler_linux_mips.cpp 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,111 @@ ++#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) ++ ++#endif // OS_CPU_LINUX_LOONGARCH_VM_VMSTRUCTS_LINUX_LOONGARCH_HPP +diff --git a/hotspot/src/os_cpu/linux_loongarch/vm/vm_version_linux_loongarch.cpp b/hotspot/src/os_cpu/linux_loongarch/vm/vm_version_linux_loongarch.cpp +new file mode 100644 +index 0000000000..80a1538de9 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_loongarch/vm/vm_version_linux_loongarch.cpp +@@ -0,0 +1,29 @@ ++/* ++ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2023, Loongson Technology. 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 "precompiled.hpp" ++#include "runtime/os.hpp" ++#include "vm_version_loongarch.hpp" ++ +diff --git a/hotspot/src/os_cpu/linux_mips/vm/assembler_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/assembler_linux_mips.cpp +new file mode 100644 +index 0000000000..4ba53d9341 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/assembler_linux_mips.cpp +@@ -0,0 +1,111 @@ +/* + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. @@ -108285,9 +108727,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + } +#endif // MINIMIZE_RAM_USAGE +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/atomic_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/atomic_linux_mips.inline.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/atomic_linux_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/atomic_linux_mips.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/atomic_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/atomic_linux_mips.inline.hpp +new file mode 100644 +index 0000000000..1c7ad605e9 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/atomic_linux_mips.inline.hpp @@ -0,0 +1,258 @@ +/* + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. @@ -108547,9 +108991,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // OS_CPU_LINUX_MIPS_VM_ATOMIC_LINUX_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/bytes_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/bytes_linux_mips.inline.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/bytes_linux_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/bytes_linux_mips.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/bytes_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/bytes_linux_mips.inline.hpp +new file mode 100644 +index 0000000000..5b5cd10aa5 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/bytes_linux_mips.inline.hpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. @@ -108588,9 +109034,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +inline u8 Bytes::swap_u8(u8 x) { return bswap_64(x); } + +#endif // OS_CPU_LINUX_MIPS_VM_BYTES_LINUX_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/copy_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/copy_linux_mips.inline.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/copy_linux_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/copy_linux_mips.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/copy_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/copy_linux_mips.inline.hpp +new file mode 100644 +index 0000000000..73ac34501b +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/copy_linux_mips.inline.hpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. @@ -108717,9 +109165,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // OS_CPU_LINUX_MIPS_VM_COPY_LINUX_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/globals_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/globals_linux_mips.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/globals_linux_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/globals_linux_mips.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/globals_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/globals_linux_mips.hpp +new file mode 100644 +index 0000000000..f1599ac5f1 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/globals_linux_mips.hpp @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -108772,10 +109222,12 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +define_pd_global(uintx,HeapBaseMinAddress, 2*G); + +#endif // OS_CPU_LINUX_MIPS_VM_GLOBALS_LINUX_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/linux_mips_64.ad b/hotspot/src/os_cpu/linux_mips/vm/linux_mips_64.ad ---- a/hotspot/src/os_cpu/linux_mips/vm/linux_mips_64.ad 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/linux_mips_64.ad 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,50 @@ +diff --git a/hotspot/src/os_cpu/linux_mips/vm/linux_mips.ad b/hotspot/src/os_cpu/linux_mips/vm/linux_mips.ad +new file mode 100644 +index 0000000000..5e38996ffa +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/linux_mips.ad +@@ -0,0 +1,153 @@ +// +// Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2015, 2016, Loongson Technology. All rights reserved. @@ -108801,7 +109253,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// +// + -+// AMD64 Linux Architecture Description File ++// mips32/godson2 Linux Architecture Description File + +//----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- +// This block specifies the encoding classes used by the compiler to @@ -108826,10 +109278,146 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// primary, secondary, and tertiary opcode. Only the opcode sections +// which a particular instruction needs for encoding need to be +// specified. -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/linux_mips.ad b/hotspot/src/os_cpu/linux_mips/vm/linux_mips.ad ---- a/hotspot/src/os_cpu/linux_mips/vm/linux_mips.ad 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/linux_mips.ad 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,153 @@ ++encode %{ ++ // Build emit functions for each basic byte or larger field in the intel ++ // encoding scheme (opcode, rm, sib, immediate), and call them from C++ ++ // code in the enc_class source block. Emit functions will live in the ++ // main source block for now. In future, we can generalize this by ++ // adding a syntax that specifies the sizes of fields in an order, ++ // so that the adlc can build the emit functions automagically ++ ++ enc_class linux_breakpoint ++ %{ ++ MacroAssembler* masm = new MacroAssembler(&cbuf); ++ masm->call(CAST_FROM_FN_PTR(address, os::breakpoint), relocInfo::runtime_call_type); ++ %} ++ ++ enc_class call_epilog ++ %{ ++ if (VerifyStackAtCalls) { ++ // Check that stack depth is unchanged: find majik cookie on stack ++ int framesize = ra_->reg2offset_unchecked(OptoReg::add(ra_->_matcher._old_SP,-2)); ++ if(framesize >= 128) { ++ emit_opcode(cbuf, 0x81); // cmp [esp+0],0xbadb1ood ++ emit_d8(cbuf,0xBC); ++ emit_d8(cbuf,0x24); ++ emit_d32(cbuf,framesize); // Find majik cookie from ESP ++ emit_d32(cbuf, 0xbadb100d); ++ } ++ else { ++ emit_opcode(cbuf, 0x81); // cmp [esp+0],0xbadb1ood ++ emit_d8(cbuf,0x7C); ++ emit_d8(cbuf,0x24); ++ emit_d8(cbuf,framesize); // Find majik cookie from ESP ++ emit_d32(cbuf, 0xbadb100d); ++ } ++ // jmp EQ around INT3 ++ // QQQ TODO ++ const int jump_around = 5; // size of call to breakpoint, 1 for CC ++ emit_opcode(cbuf, 0x74); ++ emit_d8(cbuf, jump_around); ++ // QQQ temporary ++ emit_break(cbuf); ++ // Die if stack mismatch ++ // emit_opcode(cbuf,0xCC); ++ } ++ %} ++ ++%} ++ ++// INSTRUCTIONS -- Platform dependent ++ ++//----------OS and Locking Instructions---------------------------------------- ++ ++// This name is KNOWN by the ADLC and cannot be changed. ++// The ADLC forces a 'TypeRawPtr::BOTTOM' output type ++// for this guy. ++instruct tlsLoadP(eAXRegP dst, eFlagsReg cr) %{ ++%{ ++ match(Set dst (ThreadLocal)); ++ effect(DEF dst, KILL cr); ++ ++ format %{ "MOV EAX, Thread::current()" %} ++ ins_encode( linux_tlsencode(dst) ); ++ ins_pipe( ialu_reg_fat ); ++%} ++ ++// Die now ++instruct ShouldNotReachHere() ++%{ ++ match(Halt); ++ ++ // Use the following format syntax ++ format %{ "int3\t# ShouldNotReachHere" %} ++ // QQQ TODO for now call breakpoint ++ // opcode(0xCC); ++ // ins_encode(Opc); ++ ins_encode(linux_breakpoint); ++ ins_pipe(pipe_slow); ++%} ++ ++ ++// Platform dependent source ++ ++source ++%{ ++// emit an interrupt that is caught by the debugger ++void emit_break(CodeBuffer& cbuf) { ++ // Debugger doesn't really catch this but best we can do so far QQQ ++#define __ masm. ++ __ lui(T9, Assembler::split_high((int)os::breakpoint)); ++ __ addiu(T9, T9, Assembler::split_low((int)os::breakpoint)); ++ __ jalr(T9); ++ __ delayed()->nop(); ++} ++ ++void MachBreakpointNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const { ++ emit_break(cbuf); ++} ++ ++uint MachBreakpointNode::size(PhaseRegAlloc* ra_) const { ++ //return 5; ++ return 16; ++} ++ ++%} +diff --git a/hotspot/src/os_cpu/linux_mips/vm/linux_mips.s b/hotspot/src/os_cpu/linux_mips/vm/linux_mips.s +new file mode 100644 +index 0000000000..f87fbf265d +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/linux_mips.s +@@ -0,0 +1,25 @@ ++# ++# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2015, 2017, Loongson Technology. 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. ++# ++ ++ +diff --git a/hotspot/src/os_cpu/linux_mips/vm/linux_mips_64.ad b/hotspot/src/os_cpu/linux_mips/vm/linux_mips_64.ad +new file mode 100644 +index 0000000000..ca4d094738 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/linux_mips_64.ad +@@ -0,0 +1,50 @@ +// +// Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2015, 2016, Loongson Technology. All rights reserved. @@ -108855,7 +109443,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// +// + -+// mips32/godson2 Linux Architecture Description File ++// AMD64 Linux Architecture Description File + +//----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- +// This block specifies the encoding classes used by the compiler to @@ -108880,141 +109468,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +// primary, secondary, and tertiary opcode. Only the opcode sections +// which a particular instruction needs for encoding need to be +// specified. -+encode %{ -+ // Build emit functions for each basic byte or larger field in the intel -+ // encoding scheme (opcode, rm, sib, immediate), and call them from C++ -+ // code in the enc_class source block. Emit functions will live in the -+ // main source block for now. In future, we can generalize this by -+ // adding a syntax that specifies the sizes of fields in an order, -+ // so that the adlc can build the emit functions automagically -+ -+ enc_class linux_breakpoint -+ %{ -+ MacroAssembler* masm = new MacroAssembler(&cbuf); -+ masm->call(CAST_FROM_FN_PTR(address, os::breakpoint), relocInfo::runtime_call_type); -+ %} -+ -+ enc_class call_epilog -+ %{ -+ if (VerifyStackAtCalls) { -+ // Check that stack depth is unchanged: find majik cookie on stack -+ int framesize = ra_->reg2offset_unchecked(OptoReg::add(ra_->_matcher._old_SP,-2)); -+ if(framesize >= 128) { -+ emit_opcode(cbuf, 0x81); // cmp [esp+0],0xbadb1ood -+ emit_d8(cbuf,0xBC); -+ emit_d8(cbuf,0x24); -+ emit_d32(cbuf,framesize); // Find majik cookie from ESP -+ emit_d32(cbuf, 0xbadb100d); -+ } -+ else { -+ emit_opcode(cbuf, 0x81); // cmp [esp+0],0xbadb1ood -+ emit_d8(cbuf,0x7C); -+ emit_d8(cbuf,0x24); -+ emit_d8(cbuf,framesize); // Find majik cookie from ESP -+ emit_d32(cbuf, 0xbadb100d); -+ } -+ // jmp EQ around INT3 -+ // QQQ TODO -+ const int jump_around = 5; // size of call to breakpoint, 1 for CC -+ emit_opcode(cbuf, 0x74); -+ emit_d8(cbuf, jump_around); -+ // QQQ temporary -+ emit_break(cbuf); -+ // Die if stack mismatch -+ // emit_opcode(cbuf,0xCC); -+ } -+ %} -+ -+%} -+ -+// INSTRUCTIONS -- Platform dependent -+ -+//----------OS and Locking Instructions---------------------------------------- -+ -+// This name is KNOWN by the ADLC and cannot be changed. -+// The ADLC forces a 'TypeRawPtr::BOTTOM' output type -+// for this guy. -+instruct tlsLoadP(eAXRegP dst, eFlagsReg cr) %{ -+%{ -+ match(Set dst (ThreadLocal)); -+ effect(DEF dst, KILL cr); -+ -+ format %{ "MOV EAX, Thread::current()" %} -+ ins_encode( linux_tlsencode(dst) ); -+ ins_pipe( ialu_reg_fat ); -+%} -+ -+// Die now -+instruct ShouldNotReachHere() -+%{ -+ match(Halt); -+ -+ // Use the following format syntax -+ format %{ "int3\t# ShouldNotReachHere" %} -+ // QQQ TODO for now call breakpoint -+ // opcode(0xCC); -+ // ins_encode(Opc); -+ ins_encode(linux_breakpoint); -+ ins_pipe(pipe_slow); -+%} -+ -+ -+// Platform dependent source -+ -+source -+%{ -+// emit an interrupt that is caught by the debugger -+void emit_break(CodeBuffer& cbuf) { -+ // Debugger doesn't really catch this but best we can do so far QQQ -+#define __ masm. -+ __ lui(T9, Assembler::split_high((int)os::breakpoint)); -+ __ addiu(T9, T9, Assembler::split_low((int)os::breakpoint)); -+ __ jalr(T9); -+ __ delayed()->nop(); -+} -+ -+void MachBreakpointNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const { -+ emit_break(cbuf); -+} -+ -+uint MachBreakpointNode::size(PhaseRegAlloc* ra_) const { -+ //return 5; -+ return 16; -+} -+ -+%} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/linux_mips.s b/hotspot/src/os_cpu/linux_mips/vm/linux_mips.s ---- a/hotspot/src/os_cpu/linux_mips/vm/linux_mips.s 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/linux_mips.s 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,25 @@ -+# -+# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. -+# Copyright (c) 2015, 2017, Loongson Technology. 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. -+# -+ -+ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/orderAccess_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/orderAccess_linux_mips.inline.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/orderAccess_linux_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/orderAccess_linux_mips.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/orderAccess_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/orderAccess_linux_mips.inline.hpp +new file mode 100644 +index 0000000000..c9bc169aa5 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/orderAccess_linux_mips.inline.hpp @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -109131,9 +109589,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#undef inlasm_sync + +#endif // OS_CPU_LINUX_MIPS_VM_ORDERACCESS_LINUX_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp ---- a/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp +new file mode 100644 +index 0000000000..43487dab98 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp @@ -0,0 +1,1015 @@ +/* + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. @@ -110150,9 +110610,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +bool os::is_ActiveCoresMP() { + return UseActiveCoresMP && _initial_active_processor_count == 1; +} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.hpp +new file mode 100644 +index 0000000000..c07d08156f +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.hpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. @@ -110193,9 +110655,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + static bool is_ActiveCoresMP(); + +#endif // OS_CPU_LINUX_MIPS_VM_OS_LINUX_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/prefetch_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/prefetch_linux_mips.inline.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/prefetch_linux_mips.inline.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/prefetch_linux_mips.inline.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/prefetch_linux_mips.inline.hpp b/hotspot/src/os_cpu/linux_mips/vm/prefetch_linux_mips.inline.hpp +new file mode 100644 +index 0000000000..93490345f0 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/prefetch_linux_mips.inline.hpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. @@ -110255,9 +110719,168 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +} + +#endif // OS_CPU_LINUX_MIPS_VM_PREFETCH_LINUX_MIPS_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp ---- a/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.cpp +new file mode 100644 +index 0000000000..be28a562a1 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.cpp +@@ -0,0 +1,84 @@ ++/* ++ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. 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 "precompiled.hpp" ++#include "runtime/thread.inline.hpp" ++#include "runtime/threadLocalStorage.hpp" ++ ++// Map stack pointer (%esp) to thread pointer for faster TLS access ++// ++// Here we use a flat table for better performance. Getting current thread ++// is down to one memory access (read _sp_map[%esp>>12]) in generated code ++// and two in runtime code (-fPIC code needs an extra load for _sp_map). ++// ++// This code assumes stack page is not shared by different threads. It works ++// in 32-bit VM when page size is 4K (or a multiple of 4K, if that matters). ++// ++// Notice that _sp_map is allocated in the bss segment, which is ZFOD ++// (zero-fill-on-demand). While it reserves 4M address space upfront, ++// actual memory pages are committed on demand. ++// ++// If an application creates and destroys a lot of threads, usually the ++// stack space freed by a thread will soon get reused by new thread ++// (this is especially true in NPTL or LinuxThreads in fixed-stack mode). ++// No memory page in _sp_map is wasted. ++// ++// However, it's still possible that we might end up populating & ++// committing a large fraction of the 4M table over time, but the actual ++// amount of live data in the table could be quite small. The max wastage ++// is less than 4M bytes. If it becomes an issue, we could use madvise() ++// with MADV_DONTNEED to reclaim unused (i.e. all-zero) pages in _sp_map. ++// MADV_DONTNEED on Linux keeps the virtual memory mapping, but zaps the ++// physical memory page (i.e. similar to MADV_FREE on Solaris). ++ ++#ifdef MINIMIZE_RAM_USAGE ++Thread* ThreadLocalStorage::_sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; ++#endif // MINIMIZE_RAM_USAGE ++ ++void ThreadLocalStorage::generate_code_for_get_thread() { ++ // nothing we can do here for user-level thread ++} ++ ++void ThreadLocalStorage::pd_init() { ++#ifdef MINIMIZE_RAM_USAGE ++ assert(align_size_down(os::vm_page_size(), PAGE_SIZE) == os::vm_page_size(), ++ "page size must be multiple of PAGE_SIZE"); ++#endif // MINIMIZE_RAM_USAGE ++} ++ ++void ThreadLocalStorage::pd_set_thread(Thread* thread) { ++ os::thread_local_storage_at_put(ThreadLocalStorage::thread_index(), thread); ++#ifdef MINIMIZE_RAM_USAGE ++ address stack_top = os::current_stack_base(); ++ size_t stack_size = os::current_stack_size(); ++ ++ for (address p = stack_top - stack_size; p < stack_top; p += PAGE_SIZE) { ++ int index = ((uintptr_t)p >> PAGE_SHIFT) & ((1UL << (SP_BITLENGTH - PAGE_SHIFT)) - 1); ++ assert(thread == NULL || _sp_map[index] == NULL || thread == _sp_map[index], ++ "thread exited without detaching from VM??"); ++ _sp_map[index] = thread; ++ } ++#endif // MINIMIZE_RAM_USAGE ++} +diff --git a/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.hpp +new file mode 100644 +index 0000000000..e595195e21 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.hpp +@@ -0,0 +1,61 @@ ++/* ++ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ * ++ */ ++ ++#ifndef OS_CPU_LINUX_MIPS_VM_THREADLS_LINUX_MIPS_HPP ++#define OS_CPU_LINUX_MIPS_VM_THREADLS_LINUX_MIPS_HPP ++ ++#ifdef MINIMIZE_RAM_USAGE ++ // Processor dependent parts of ThreadLocalStorage ++ //only the low 2G space for user program in Linux ++ ++ #define SP_BITLENGTH 34 ++ #define PAGE_SHIFT 14 ++ #define PAGE_SIZE (1UL << PAGE_SHIFT) ++ ++ static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; ++ static int _sp_map_low; ++ static int _sp_map_high; ++#endif // MINIMIZE_RAM_USAGE ++ ++public: ++#ifdef MINIMIZE_RAM_USAGE ++ static Thread** sp_map_addr() { return _sp_map; } ++#endif // MINIMIZE_RAM_USAGE ++ ++ static Thread* thread() { ++#ifdef MINIMIZE_RAM_USAGE ++ /* Thread::thread() can also be optimized in the same way as __get_thread() */ ++ //return (Thread*) os::thread_local_storage_at(thread_index()); ++ uintptr_t sp; ++ uintptr_t mask = (1UL << (SP_BITLENGTH - PAGE_SHIFT)) - 1; ++ ++ __asm__ __volatile__ ("daddiu %0, $29, 0 " : "=r" (sp)); ++ ++ return _sp_map[(sp >> PAGE_SHIFT) & mask]; ++#else ++ return (Thread*) os::thread_local_storage_at(thread_index()); ++#endif // MINIMIZE_RAM_USAGE ++ } ++#endif // OS_CPU_LINUX_MIPS_VM_THREADLS_LINUX_MIPS_HPP +diff --git a/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp +new file mode 100644 +index 0000000000..44f666d61f +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. @@ -110358,9 +110981,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + +void JavaThread::cache_global_variables() { } + -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp +new file mode 100644 +index 0000000000..cb11c36ae5 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -110437,162 +111062,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + static void disable_register_stack_guard() {} + +#endif // OS_CPU_LINUX_MIPS_VM_THREAD_LINUX_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.cpp ---- a/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.cpp 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,84 @@ -+/* -+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. 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 "precompiled.hpp" -+#include "runtime/thread.inline.hpp" -+#include "runtime/threadLocalStorage.hpp" -+ -+// Map stack pointer (%esp) to thread pointer for faster TLS access -+// -+// Here we use a flat table for better performance. Getting current thread -+// is down to one memory access (read _sp_map[%esp>>12]) in generated code -+// and two in runtime code (-fPIC code needs an extra load for _sp_map). -+// -+// This code assumes stack page is not shared by different threads. It works -+// in 32-bit VM when page size is 4K (or a multiple of 4K, if that matters). -+// -+// Notice that _sp_map is allocated in the bss segment, which is ZFOD -+// (zero-fill-on-demand). While it reserves 4M address space upfront, -+// actual memory pages are committed on demand. -+// -+// If an application creates and destroys a lot of threads, usually the -+// stack space freed by a thread will soon get reused by new thread -+// (this is especially true in NPTL or LinuxThreads in fixed-stack mode). -+// No memory page in _sp_map is wasted. -+// -+// However, it's still possible that we might end up populating & -+// committing a large fraction of the 4M table over time, but the actual -+// amount of live data in the table could be quite small. The max wastage -+// is less than 4M bytes. If it becomes an issue, we could use madvise() -+// with MADV_DONTNEED to reclaim unused (i.e. all-zero) pages in _sp_map. -+// MADV_DONTNEED on Linux keeps the virtual memory mapping, but zaps the -+// physical memory page (i.e. similar to MADV_FREE on Solaris). -+ -+#ifdef MINIMIZE_RAM_USAGE -+Thread* ThreadLocalStorage::_sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; -+#endif // MINIMIZE_RAM_USAGE -+ -+void ThreadLocalStorage::generate_code_for_get_thread() { -+ // nothing we can do here for user-level thread -+} -+ -+void ThreadLocalStorage::pd_init() { -+#ifdef MINIMIZE_RAM_USAGE -+ assert(align_size_down(os::vm_page_size(), PAGE_SIZE) == os::vm_page_size(), -+ "page size must be multiple of PAGE_SIZE"); -+#endif // MINIMIZE_RAM_USAGE -+} -+ -+void ThreadLocalStorage::pd_set_thread(Thread* thread) { -+ os::thread_local_storage_at_put(ThreadLocalStorage::thread_index(), thread); -+#ifdef MINIMIZE_RAM_USAGE -+ address stack_top = os::current_stack_base(); -+ size_t stack_size = os::current_stack_size(); -+ -+ for (address p = stack_top - stack_size; p < stack_top; p += PAGE_SIZE) { -+ int index = ((uintptr_t)p >> PAGE_SHIFT) & ((1UL << (SP_BITLENGTH - PAGE_SHIFT)) - 1); -+ assert(thread == NULL || _sp_map[index] == NULL || thread == _sp_map[index], -+ "thread exited without detaching from VM??"); -+ _sp_map[index] = thread; -+ } -+#endif // MINIMIZE_RAM_USAGE -+} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/threadLS_linux_mips.hpp 2023-12-20 09:23:19.868147074 +0800 -@@ -0,0 +1,61 @@ -+/* -+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * This code is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 only, as -+ * published by the Free Software Foundation. -+ * -+ * This code is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * version 2 for more details (a copy is included in the LICENSE file that -+ * accompanied this code). -+ * -+ * You should have received a copy of the GNU General Public License version -+ * 2 along with this work; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -+ * or visit www.oracle.com if you need additional information or have any -+ * questions. -+ * -+ */ -+ -+#ifndef OS_CPU_LINUX_MIPS_VM_THREADLS_LINUX_MIPS_HPP -+#define OS_CPU_LINUX_MIPS_VM_THREADLS_LINUX_MIPS_HPP -+ -+#ifdef MINIMIZE_RAM_USAGE -+ // Processor dependent parts of ThreadLocalStorage -+ //only the low 2G space for user program in Linux -+ -+ #define SP_BITLENGTH 34 -+ #define PAGE_SHIFT 14 -+ #define PAGE_SIZE (1UL << PAGE_SHIFT) -+ -+ static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; -+ static int _sp_map_low; -+ static int _sp_map_high; -+#endif // MINIMIZE_RAM_USAGE -+ -+public: -+#ifdef MINIMIZE_RAM_USAGE -+ static Thread** sp_map_addr() { return _sp_map; } -+#endif // MINIMIZE_RAM_USAGE -+ -+ static Thread* thread() { -+#ifdef MINIMIZE_RAM_USAGE -+ /* Thread::thread() can also be optimized in the same way as __get_thread() */ -+ //return (Thread*) os::thread_local_storage_at(thread_index()); -+ uintptr_t sp; -+ uintptr_t mask = (1UL << (SP_BITLENGTH - PAGE_SHIFT)) - 1; -+ -+ __asm__ __volatile__ ("daddiu %0, $29, 0 " : "=r" (sp)); -+ -+ return _sp_map[(sp >> PAGE_SHIFT) & mask]; -+#else -+ return (Thread*) os::thread_local_storage_at(thread_index()); -+#endif // MINIMIZE_RAM_USAGE -+ } -+#endif // OS_CPU_LINUX_MIPS_VM_THREADLS_LINUX_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/vmStructs_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/vmStructs_linux_mips.hpp ---- a/hotspot/src/os_cpu/linux_mips/vm/vmStructs_linux_mips.hpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/vmStructs_linux_mips.hpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/vmStructs_linux_mips.hpp b/hotspot/src/os_cpu/linux_mips/vm/vmStructs_linux_mips.hpp +new file mode 100644 +index 0000000000..b7454bf045 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/vmStructs_linux_mips.hpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. @@ -110649,9 +111123,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) + +#endif // OS_CPU_LINUX_MIPS_VM_VMSTRUCTS_LINUX_MIPS_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/os_cpu/linux_mips/vm/vm_version_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/vm_version_linux_mips.cpp ---- a/hotspot/src/os_cpu/linux_mips/vm/vm_version_linux_mips.cpp 1970-01-01 08:00:00.000000000 +0800 -+++ b/hotspot/src/os_cpu/linux_mips/vm/vm_version_linux_mips.cpp 2023-12-20 09:23:19.868147074 +0800 +diff --git a/hotspot/src/os_cpu/linux_mips/vm/vm_version_linux_mips.cpp b/hotspot/src/os_cpu/linux_mips/vm/vm_version_linux_mips.cpp +new file mode 100644 +index 0000000000..ce697823b9 +--- /dev/null ++++ b/hotspot/src/os_cpu/linux_mips/vm/vm_version_linux_mips.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. @@ -110681,30 +111157,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +#include "precompiled.hpp" +#include "runtime/os.hpp" +#include "vm_version_mips.hpp" -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/tools/hsdis/hsdis.c b/hotspot/src/share/tools/hsdis/hsdis.c ---- a/hotspot/src/share/tools/hsdis/hsdis.c 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/tools/hsdis/hsdis.c 2023-12-20 09:23:19.908146618 +0800 -@@ -493,6 +493,16 @@ - #if defined(LIBARCH_ppc64) || defined(LIBARCH_ppc64le) - res = "powerpc:common64"; - #endif -+#ifdef LIBARCH_mips64 -+#ifdef LOONGSON -+ res = "mips:loongson_3a"; -+#else -+ res = "mips:isa64"; -+#endif -+#endif -+#ifdef LIBARCH_loongarch64 -+ res = "loongarch"; -+#endif - #ifdef LIBARCH_aarch64 - res = "aarch64"; - #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/tools/hsdis/Makefile b/hotspot/src/share/tools/hsdis/Makefile ---- a/hotspot/src/share/tools/hsdis/Makefile 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/tools/hsdis/Makefile 2023-12-20 09:23:19.904813322 +0800 -@@ -105,12 +105,25 @@ +diff --git a/hotspot/src/share/tools/hsdis/Makefile b/hotspot/src/share/tools/hsdis/Makefile +index 0d1b608944..a9754ce2ac 100644 +--- a/hotspot/src/share/tools/hsdis/Makefile ++++ b/hotspot/src/share/tools/hsdis/Makefile +@@ -105,12 +105,25 @@ CFLAGS/sparc += -m32 endif CFLAGS += $(CFLAGS/$(ARCH)) CFLAGS += -fPIC @@ -110730,9 +111187,31 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp LDFLAGS += -ldl OUTFLAGS += -o $@ else -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp ---- a/hotspot/src/share/vm/adlc/main.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/adlc/main.cpp 2023-12-20 09:23:19.908146618 +0800 +diff --git a/hotspot/src/share/tools/hsdis/hsdis.c b/hotspot/src/share/tools/hsdis/hsdis.c +index 4fb4964870..f6ef5bea15 100644 +--- a/hotspot/src/share/tools/hsdis/hsdis.c ++++ b/hotspot/src/share/tools/hsdis/hsdis.c +@@ -493,6 +493,16 @@ static const char* native_arch_name() { + #if defined(LIBARCH_ppc64) || defined(LIBARCH_ppc64le) + res = "powerpc:common64"; + #endif ++#ifdef LIBARCH_mips64 ++#ifdef LOONGSON ++ res = "mips:loongson_3a"; ++#else ++ res = "mips:isa64"; ++#endif ++#endif ++#ifdef LIBARCH_loongarch64 ++ res = "loongarch"; ++#endif + #ifdef LIBARCH_aarch64 + res = "aarch64"; + #endif +diff --git a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp +index 52044f12d4..50c585872e 100644 +--- a/hotspot/src/share/vm/adlc/main.cpp ++++ b/hotspot/src/share/vm/adlc/main.cpp @@ -22,6 +22,12 @@ * */ @@ -110746,7 +111225,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // MAIN.CPP - Entry point for the Architecture Description Language Compiler #include "adlc.hpp" -@@ -234,6 +240,14 @@ +@@ -234,6 +240,14 @@ int main(int argc, char *argv[]) AD.addInclude(AD._CPP_file, "nativeInst_x86.hpp"); AD.addInclude(AD._CPP_file, "vmreg_x86.inline.hpp"); #endif @@ -110761,9 +111240,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 AD.addInclude(AD._CPP_file, "assembler_aarch64.inline.hpp"); AD.addInclude(AD._CPP_file, "nativeInst_aarch64.hpp"); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp ---- a/hotspot/src/share/vm/asm/assembler.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/asm/assembler.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp +index f7f1ae1d36..572aa997ca 100644 +--- a/hotspot/src/share/vm/asm/assembler.hpp ++++ b/hotspot/src/share/vm/asm/assembler.hpp @@ -22,6 +22,12 @@ * */ @@ -110792,7 +111272,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "register_aarch64.hpp" # include "vm_version_aarch64.hpp" -@@ -468,6 +482,12 @@ +@@ -468,6 +482,12 @@ class AbstractAssembler : public ResourceObj { #ifdef TARGET_ARCH_ppc # include "assembler_ppc.hpp" #endif @@ -110805,9 +111285,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif // SHARE_VM_ASM_ASSEMBLER_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/asm/assembler.inline.hpp b/hotspot/src/share/vm/asm/assembler.inline.hpp ---- a/hotspot/src/share/vm/asm/assembler.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/asm/assembler.inline.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/asm/assembler.inline.hpp b/hotspot/src/share/vm/asm/assembler.inline.hpp +index 1a48cb3171..8ac90e1474 100644 +--- a/hotspot/src/share/vm/asm/assembler.inline.hpp ++++ b/hotspot/src/share/vm/asm/assembler.inline.hpp @@ -22,6 +22,12 @@ * */ @@ -110834,9 +111315,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "assembler_aarch64.inline.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp ---- a/hotspot/src/share/vm/asm/codeBuffer.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp +index d94ac40655..f6b578111f 100644 +--- a/hotspot/src/share/vm/asm/codeBuffer.cpp ++++ b/hotspot/src/share/vm/asm/codeBuffer.cpp @@ -22,6 +22,12 @@ * */ @@ -110850,7 +111332,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "compiler/disassembler.hpp" -@@ -323,6 +329,7 @@ +@@ -323,6 +329,7 @@ void CodeSection::relocate(address at, RelocationHolder const& spec, int format) assert(rtype == relocInfo::none || rtype == relocInfo::runtime_call_type || rtype == relocInfo::internal_word_type|| @@ -110858,9 +111340,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp rtype == relocInfo::section_word_type || rtype == relocInfo::external_word_type, "code needs relocation information"); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp ---- a/hotspot/src/share/vm/asm/codeBuffer.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp +index 02b619ad77..c04560a0bc 100644 +--- a/hotspot/src/share/vm/asm/codeBuffer.hpp ++++ b/hotspot/src/share/vm/asm/codeBuffer.hpp @@ -22,6 +22,12 @@ * */ @@ -110874,7 +111357,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_ASM_CODEBUFFER_HPP #define SHARE_VM_ASM_CODEBUFFER_HPP -@@ -635,6 +641,12 @@ +@@ -635,6 +641,12 @@ class CodeBuffer: public StackObj { #ifdef TARGET_ARCH_ppc # include "codeBuffer_ppc.hpp" #endif @@ -110887,9 +111370,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp }; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/asm/macroAssembler.hpp b/hotspot/src/share/vm/asm/macroAssembler.hpp ---- a/hotspot/src/share/vm/asm/macroAssembler.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/asm/macroAssembler.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/asm/macroAssembler.hpp b/hotspot/src/share/vm/asm/macroAssembler.hpp +index 1482eb630b..0be415b6c5 100644 +--- a/hotspot/src/share/vm/asm/macroAssembler.hpp ++++ b/hotspot/src/share/vm/asm/macroAssembler.hpp @@ -22,6 +22,12 @@ * */ @@ -110915,9 +111399,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp +# include "macroAssembler_loongarch.hpp" +#endif #endif // SHARE_VM_ASM_MACROASSEMBLER_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp ---- a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp +index db3daa52e9..6f4e523c59 100644 +--- a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp ++++ b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp @@ -22,6 +22,12 @@ * */ @@ -110944,9 +111429,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "macroAssembler_aarch64.inline.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/asm/register.hpp b/hotspot/src/share/vm/asm/register.hpp ---- a/hotspot/src/share/vm/asm/register.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/asm/register.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/asm/register.hpp b/hotspot/src/share/vm/asm/register.hpp +index c500890181..6a20929e59 100644 +--- a/hotspot/src/share/vm/asm/register.hpp ++++ b/hotspot/src/share/vm/asm/register.hpp @@ -22,6 +22,12 @@ * */ @@ -110960,7 +111446,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_ASM_REGISTER_HPP #define SHARE_VM_ASM_REGISTER_HPP -@@ -108,6 +114,12 @@ +@@ -108,6 +114,12 @@ const type name = ((type)name##_##type##EnumValue) #ifdef TARGET_ARCH_ppc # include "register_ppc.hpp" #endif @@ -110973,9 +111459,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "register_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_Defs.hpp b/hotspot/src/share/vm/c1/c1_Defs.hpp ---- a/hotspot/src/share/vm/c1/c1_Defs.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_Defs.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/c1/c1_Defs.hpp b/hotspot/src/share/vm/c1/c1_Defs.hpp +index b0cd763739..b42b9de1b5 100644 +--- a/hotspot/src/share/vm/c1/c1_Defs.hpp ++++ b/hotspot/src/share/vm/c1/c1_Defs.hpp @@ -22,6 +22,12 @@ * */ @@ -110999,7 +111486,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "register_aarch64.hpp" #endif -@@ -56,6 +65,9 @@ +@@ -56,6 +65,9 @@ enum { #ifdef TARGET_ARCH_x86 # include "c1_Defs_x86.hpp" #endif @@ -111009,9 +111496,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "c1_Defs_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp ---- a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp +index f07e97a4d3..6bc367a897 100644 +--- a/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp ++++ b/hotspot/src/share/vm/c1/c1_FpuStackSim.hpp @@ -22,6 +22,12 @@ * */ @@ -111025,7 +111513,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_C1_C1_FPUSTACKSIM_HPP #define SHARE_VM_C1_C1_FPUSTACKSIM_HPP -@@ -35,6 +41,9 @@ +@@ -35,6 +41,9 @@ class FpuStackSim; #ifdef TARGET_ARCH_x86 # include "c1_FpuStackSim_x86.hpp" #endif @@ -111035,9 +111523,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "c1_FpuStackSim_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_FrameMap.cpp b/hotspot/src/share/vm/c1/c1_FrameMap.cpp ---- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.cpp b/hotspot/src/share/vm/c1/c1_FrameMap.cpp +index 1dac94d58c..b1e37ec41c 100644 +--- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp ++++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp @@ -22,6 +22,12 @@ * */ @@ -111061,9 +111550,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "vmreg_aarch64.inline.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_FrameMap.hpp b/hotspot/src/share/vm/c1/c1_FrameMap.hpp ---- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp 2023-12-20 09:23:19.911479913 +0800 +diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.hpp b/hotspot/src/share/vm/c1/c1_FrameMap.hpp +index 41571e3d16..c0e7b28ea4 100644 +--- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp ++++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp @@ -22,6 +22,12 @@ * */ @@ -111077,7 +111567,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_C1_C1_FRAMEMAP_HPP #define SHARE_VM_C1_C1_FRAMEMAP_HPP -@@ -85,6 +91,9 @@ +@@ -85,6 +91,9 @@ class FrameMap : public CompilationResourceObj { #ifdef TARGET_ARCH_x86 # include "c1_FrameMap_x86.hpp" #endif @@ -111087,298 +111577,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "c1_FrameMap_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp ---- a/hotspot/src/share/vm/c1/c1_globals.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_globals.hpp 2023-12-20 09:23:19.921479797 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2022. These -+ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #ifndef SHARE_VM_C1_C1_GLOBALS_HPP - #define SHARE_VM_C1_C1_GLOBALS_HPP - -@@ -29,6 +35,9 @@ - #ifdef TARGET_ARCH_x86 - # include "c1_globals_x86.hpp" - #endif -+#ifdef TARGET_ARCH_loongarch -+# include "c1_globals_loongarch.hpp" -+#endif - #ifdef TARGET_ARCH_aarch64 - # include "c1_globals_aarch64.hpp" - #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp ---- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp 2023-12-20 09:23:19.918146502 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2022. These -+ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #include "precompiled.hpp" - #include "c1/c1_CFGPrinter.hpp" - #include "c1/c1_CodeStubs.hpp" -@@ -35,6 +41,9 @@ - #ifdef TARGET_ARCH_x86 - # include "vmreg_x86.inline.hpp" - #endif -+#ifdef TARGET_ARCH_loongarch -+# include "vmreg_loongarch.inline.hpp" -+#endif - #ifdef TARGET_ARCH_aarch64 - # include "vmreg_aarch64.inline.hpp" - #endif -@@ -1266,6 +1275,23 @@ - } - break; - } -+ case lir_cmp_cmove: { -+ assert(op->as_Op4() != NULL, "lir_cmp_cmove must be LIR_Op4"); -+ LIR_Op4* cmove = (LIR_Op4*)op; -+ -+ LIR_Opr move_from = cmove->in_opr3(); -+ LIR_Opr move_to = cmove->result_opr(); -+ -+ if (move_to->is_register() && move_from->is_register()) { -+ Interval* from = interval_at(reg_num(move_from)); -+ Interval* to = interval_at(reg_num(move_to)); -+ if (from != NULL && to != NULL) { -+ to->set_register_hint(from); -+ TRACE_LINEAR_SCAN(4, tty->print_cr("operation at op_id %d: added hint from interval %d to %d", cmove->id(), from->reg_num(), to->reg_num())); -+ } -+ } -+ break; -+ } - } - } - -@@ -2104,7 +2130,7 @@ - #ifdef _LP64 - return LIR_OprFact::double_cpu(assigned_reg, assigned_reg); - #else --#if defined(SPARC) || defined(PPC) -+#if defined(SPARC) || defined(PPC) || defined(LOONGARCH) - return LIR_OprFact::double_cpu(assigned_regHi, assigned_reg); - #else - return LIR_OprFact::double_cpu(assigned_reg, assigned_regHi); -@@ -3285,7 +3311,9 @@ - check_live = (move->patch_code() == lir_patch_none); - } - LIR_OpBranch* branch = op->as_OpBranch(); -- if (branch != NULL && branch->stub() != NULL && branch->stub()->is_exception_throw_stub()) { -+ LIR_OpCmpBranch* cmp_branch = op->as_OpCmpBranch(); -+ if ((branch != NULL && branch->stub() != NULL && branch->stub()->is_exception_throw_stub()) || -+ (cmp_branch != NULL && cmp_branch->stub() != NULL && cmp_branch->stub()->is_exception_throw_stub())) { - // Don't bother checking the stub in this case since the - // exception stub will never return to normal control flow. - check_live = false; -@@ -6148,6 +6176,16 @@ - if (branch->ublock() == target_from) { - branch->change_ublock(target_to); - } -+ } else if (op->code() == lir_cmp_branch || op->code() == lir_cmp_float_branch) { -+ assert(op->as_OpCmpBranch() != NULL, "branch must be of type LIR_OpCmpBranch"); -+ LIR_OpCmpBranch* branch = (LIR_OpCmpBranch*)op; -+ -+ if (branch->block() == target_from) { -+ branch->change_block(target_to); -+ } -+ if (branch->ublock() == target_from) { -+ branch->change_ublock(target_to); -+ } - } - } - } -@@ -6252,6 +6290,20 @@ - instructions->truncate(instructions->length() - 1); - } - } -+ } else if (prev_op->code() == lir_cmp_branch || prev_op->code() == lir_cmp_float_branch) { -+ assert(prev_op->as_OpCmpBranch() != NULL, "branch must be of type LIR_OpCmpBranch"); -+ LIR_OpCmpBranch* prev_branch = (LIR_OpCmpBranch*)prev_op; -+ -+ if (prev_branch->stub() == NULL) { -+ if (prev_branch->block() == code->at(i + 1) && prev_branch->info() == NULL) { -+ TRACE_LINEAR_SCAN(3, tty->print_cr("Negating conditional branch and deleting unconditional branch at end of block B%d", block->block_id())); -+ -+ // eliminate a conditional branch to the immediate successor -+ prev_branch->change_block(last_branch->block()); -+ prev_branch->negate_cond(); -+ instructions->trunc_to(instructions->length() - 1); -+ } -+ } - } - } - } -@@ -6328,6 +6380,13 @@ - assert(op_branch->block() == NULL || code->index_of(op_branch->block()) != -1, "branch target not valid"); - assert(op_branch->ublock() == NULL || code->index_of(op_branch->ublock()) != -1, "branch target not valid"); - } -+ -+ LIR_OpCmpBranch* op_cmp_branch = instructions->at(j)->as_OpCmpBranch(); -+ -+ if (op_cmp_branch != NULL) { -+ assert(op_cmp_branch->block() == NULL || code->find(op_cmp_branch->block()) != -1, "branch target not valid"); -+ assert(op_cmp_branch->ublock() == NULL || code->find(op_cmp_branch->ublock()) != -1, "branch target not valid"); -+ } - } - - for (j = 0; j < block->number_of_sux() - 1; j++) { -@@ -6571,6 +6630,24 @@ - break; - } - -+ case lir_cmp_branch: -+ case lir_cmp_float_branch: { -+ LIR_OpCmpBranch* branch = op->as_OpCmpBranch(); -+ if (branch->block() == NULL) { -+ inc_counter(counter_stub_branch); -+ } else { -+ inc_counter(counter_cond_branch); -+ } -+ inc_counter(counter_cmp); -+ break; -+ } -+ -+ case lir_cmp_cmove: { -+ inc_counter(counter_misc_inst); -+ inc_counter(counter_cmp); -+ break; -+ } -+ - case lir_neg: - case lir_add: - case lir_sub: -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_LinearScan.hpp b/hotspot/src/share/vm/c1/c1_LinearScan.hpp ---- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp 2023-12-20 09:23:19.918146502 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2022. These -+ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #ifndef SHARE_VM_C1_C1_LINEARSCAN_HPP - #define SHARE_VM_C1_C1_LINEARSCAN_HPP - -@@ -976,6 +982,9 @@ - #ifdef TARGET_ARCH_x86 - # include "c1_LinearScan_x86.hpp" - #endif -+#ifdef TARGET_ARCH_loongarch -+# include "c1_LinearScan_loongarch.hpp" -+#endif - #ifdef TARGET_ARCH_aarch64 - # include "c1_LinearScan_aarch64.hpp" - #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp ---- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp 2023-12-20 09:23:19.914813209 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2022. These -+ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #include "precompiled.hpp" - #include "c1/c1_Compilation.hpp" - #include "c1/c1_Instruction.hpp" -@@ -34,6 +40,10 @@ - # include "nativeInst_x86.hpp" - # include "vmreg_x86.inline.hpp" - #endif -+#ifdef TARGET_ARCH_loongarch -+# include "nativeInst_loongarch.hpp" -+# include "vmreg_loongarch.inline.hpp" -+#endif - #ifdef TARGET_ARCH_aarch64 - # include "nativeInst_aarch64.hpp" - # include "vmreg_aarch64.inline.hpp" -@@ -811,6 +821,18 @@ - } - - -+void LIR_Assembler::emit_op4(LIR_Op4* op) { -+ switch (op->code()) { -+ case lir_cmp_cmove: -+ cmp_cmove(op->condition(), op->in_opr1(), op->in_opr2(), op->in_opr3(), op->in_opr4(), op->result_opr(), op->type()); -+ break; -+ -+ default: -+ Unimplemented(); -+ break; -+ } -+} -+ - void LIR_Assembler::build_frame() { - _masm->build_frame(initial_frame_size_in_bytes(), bang_size_in_bytes()); - } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp ---- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp 2023-12-20 09:23:19.914813209 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2022. These -+ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #ifndef SHARE_VM_C1_C1_LIRASSEMBLER_HPP - #define SHARE_VM_C1_C1_LIRASSEMBLER_HPP - -@@ -195,7 +201,9 @@ - void emit_op1(LIR_Op1* op); - void emit_op2(LIR_Op2* op); - void emit_op3(LIR_Op3* op); -+ void emit_op4(LIR_Op4* op); - void emit_opBranch(LIR_OpBranch* op); -+ void emit_opCmpBranch(LIR_OpCmpBranch* op); - void emit_opLabel(LIR_OpLabel* op); - void emit_arraycopy(LIR_OpArrayCopy* op); - void emit_updatecrc32(LIR_OpUpdateCRC32* op); -@@ -227,6 +235,7 @@ - void volatile_move_op(LIR_Opr src, LIR_Opr result, BasicType type, CodeEmitInfo* info); - void comp_mem_op(LIR_Opr src, LIR_Opr result, BasicType type, CodeEmitInfo* info); // info set for null exceptions - void comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr result, LIR_Op2* op); -+ void cmp_cmove(LIR_Condition code, LIR_Opr left, LIR_Opr right, LIR_Opr src1, LIR_Opr src2, LIR_Opr result, BasicType type); - void cmove(LIR_Condition code, LIR_Opr left, LIR_Opr right, LIR_Opr result, BasicType type); - - void call( LIR_OpJavaCall* op, relocInfo::relocType rtype); -@@ -265,6 +274,9 @@ - #ifdef TARGET_ARCH_x86 - # include "c1_LIRAssembler_x86.hpp" - #endif -+#ifdef TARGET_ARCH_loongarch -+# include "c1_LIRAssembler_loongarch.hpp" -+#endif - #ifdef TARGET_ARCH_aarch64 - # include "c1_LIRAssembler_aarch64.hpp" - #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp ---- a/hotspot/src/share/vm/c1/c1_LIR.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp 2023-12-20 09:23:19.914813209 +0800 +diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp +index fa37e7a046..5d33d3f7a0 100644 +--- a/hotspot/src/share/vm/c1/c1_LIR.cpp ++++ b/hotspot/src/share/vm/c1/c1_LIR.cpp @@ -22,6 +22,12 @@ * */ @@ -111392,7 +111594,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "precompiled.hpp" #include "c1/c1_InstructionPrinter.hpp" #include "c1/c1_LIR.hpp" -@@ -79,6 +85,17 @@ +@@ -79,6 +85,17 @@ FloatRegister LIR_OprDesc::as_double_reg() const { #endif @@ -111410,7 +111612,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp LIR_Opr LIR_OprFact::illegalOpr = LIR_OprFact::illegal(); -@@ -149,13 +166,19 @@ +@@ -149,13 +166,19 @@ void LIR_Address::verify0() const { #endif #ifdef _LP64 assert(base()->is_cpu_register(), "wrong base operand"); @@ -111431,7 +111633,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #else assert(base()->is_single_cpu(), "wrong base operand"); assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand"); -@@ -258,8 +281,6 @@ +@@ -258,8 +281,6 @@ bool LIR_OprDesc::is_oop() const { } } @@ -111440,7 +111642,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_Op2::verify() const { #ifdef ASSERT switch (code()) { -@@ -301,6 +322,18 @@ +@@ -301,6 +322,18 @@ void LIR_Op2::verify() const { #endif } @@ -111459,7 +111661,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp LIR_OpBranch::LIR_OpBranch(LIR_Condition cond, BasicType type, BlockBegin* block) : LIR_Op(lir_branch, LIR_OprFact::illegalOpr, (CodeEmitInfo*)NULL) -@@ -358,6 +391,55 @@ +@@ -358,6 +391,55 @@ void LIR_OpBranch::negate_cond() { } } @@ -111515,7 +111717,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, -@@ -560,10 +642,7 @@ +@@ -560,10 +642,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) { assert(opConvert->_info == NULL, "must be"); if (opConvert->_opr->is_valid()) do_input(opConvert->_opr); if (opConvert->_result->is_valid()) do_output(opConvert->_result); @@ -111527,7 +111729,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp do_stub(opConvert->_stub); break; -@@ -661,6 +740,25 @@ +@@ -661,6 +740,25 @@ void LIR_OpVisitState::visit(LIR_Op* op) { break; } @@ -111553,7 +111755,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // special handling for cmove: right input operand must not be equal // to the result operand, otherwise the backend fails case lir_cmove: -@@ -806,6 +904,29 @@ +@@ -806,6 +904,29 @@ void LIR_OpVisitState::visit(LIR_Op* op) { break; } @@ -111583,7 +111785,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // LIR_OpJavaCall case lir_static_call: -@@ -1121,6 +1242,13 @@ +@@ -1121,6 +1242,13 @@ void LIR_Op2::emit_code(LIR_Assembler* masm) { masm->emit_op2(this); } @@ -111597,7 +111799,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_OpAllocArray::emit_code(LIR_Assembler* masm) { masm->emit_alloc_array(this); masm->append_code_stub(stub()); -@@ -1141,6 +1269,10 @@ +@@ -1141,6 +1269,10 @@ void LIR_Op3::emit_code(LIR_Assembler* masm) { masm->emit_op3(this); } @@ -111608,7 +111810,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_OpLock::emit_code(LIR_Assembler* masm) { masm->emit_lock(this); if (stub()) { -@@ -1381,7 +1513,6 @@ +@@ -1381,7 +1513,6 @@ void LIR_List::cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int info)); } @@ -111616,7 +111818,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_List::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Address* addr, CodeEmitInfo* info) { append(new LIR_Op2( lir_cmp, -@@ -1391,6 +1522,17 @@ +@@ -1391,6 +1522,17 @@ void LIR_List::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Address* ad info)); } @@ -111634,7 +111836,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_List::allocate_object(LIR_Opr dst, LIR_Opr t1, LIR_Opr t2, LIR_Opr t3, LIR_Opr t4, int header_size, int object_size, LIR_Opr klass, bool init_check, CodeStub* stub) { append(new LIR_OpAllocObj( -@@ -1520,18 +1662,6 @@ +@@ -1520,18 +1662,6 @@ void LIR_List::store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr append(c); } @@ -111653,7 +111855,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2, LIR_Opr result) { append(new LIR_OpCompareAndSwap(lir_cas_long, addr, cmp_value, new_value, t1, t2, result)); -@@ -1780,6 +1910,8 @@ +@@ -1780,6 +1910,8 @@ const char * LIR_Op::name() const { case lir_cmp_l2i: s = "cmp_l2i"; break; case lir_ucmp_fd2i: s = "ucomp_fd2i"; break; case lir_cmp_fd2i: s = "comp_fd2i"; break; @@ -111662,7 +111864,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp case lir_cmove: s = "cmove"; break; case lir_add: s = "add"; break; case lir_sub: s = "sub"; break; -@@ -1809,6 +1941,8 @@ +@@ -1809,6 +1941,8 @@ const char * LIR_Op::name() const { // LIR_Op3 case lir_idiv: s = "idiv"; break; case lir_irem: s = "irem"; break; @@ -111671,7 +111873,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // LIR_OpJavaCall case lir_static_call: s = "static"; break; case lir_optvirtual_call: s = "optvirtual"; break; -@@ -1960,6 +2094,26 @@ +@@ -1960,6 +2094,26 @@ void LIR_OpBranch::print_instr(outputStream* out) const { } } @@ -111698,7 +111900,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_Op::print_condition(outputStream* out, LIR_Condition cond) { switch(cond) { case lir_cond_equal: out->print("[EQ]"); break; -@@ -1980,12 +2134,9 @@ +@@ -1980,12 +2134,9 @@ void LIR_OpConvert::print_instr(outputStream* out) const { print_bytecode(out, bytecode()); in_opr()->print(out); out->print(" "); result_opr()->print(out); out->print(" "); @@ -111713,7 +111915,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } void LIR_OpConvert::print_bytecode(outputStream* out, Bytecodes::Code code) { -@@ -2031,9 +2182,6 @@ +@@ -2031,9 +2182,6 @@ void LIR_OpRoundFP::print_instr(outputStream* out) const { // LIR_Op2 void LIR_Op2::print_instr(outputStream* out) const { @@ -111723,7 +111925,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp in_opr1()->print(out); out->print(" "); in_opr2()->print(out); out->print(" "); if (tmp1_opr()->is_valid()) { tmp1_opr()->print(out); out->print(" "); } -@@ -2082,6 +2230,18 @@ +@@ -2082,6 +2230,18 @@ void LIR_Op3::print_instr(outputStream* out) const { result_opr()->print(out); } @@ -111742,7 +111944,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void LIR_OpLock::print_instr(outputStream* out) const { hdr_opr()->print(out); out->print(" "); -@@ -2095,10 +2255,14 @@ +@@ -2095,10 +2255,14 @@ void LIR_OpLock::print_instr(outputStream* out) const { #ifdef ASSERT void LIR_OpAssert::print_instr(outputStream* out) const { @@ -111757,385 +111959,41 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp ---- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp 2024-01-30 13:54:24.796042252 +0800 -@@ -22,6 +22,12 @@ +diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp +index 24b8620211..aec77afe1f 100644 +--- a/hotspot/src/share/vm/c1/c1_LIR.hpp ++++ b/hotspot/src/share/vm/c1/c1_LIR.hpp +@@ -22,6 +22,11 @@ * */ +/* + * This file has been modified by Loongson Technology in 2022. These -+ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made ++ * modifications are Copyright (c) 2018, 2022, Loongson Technology, and are made + * available on the same license terms set forth above. + */ -+ - #include "precompiled.hpp" - #include "c1/c1_Defs.hpp" - #include "c1/c1_Compilation.hpp" -@@ -483,13 +489,11 @@ - CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info) { - CodeStub* stub = new RangeCheckStub(range_check_info, index); - if (index->is_constant()) { -- cmp_mem_int(lir_cond_belowEqual, array, arrayOopDesc::length_offset_in_bytes(), -- index->as_jint(), null_check_info); -- __ branch(lir_cond_belowEqual, T_INT, stub); // forward branch -- } else { -- cmp_reg_mem(lir_cond_aboveEqual, index, array, -- arrayOopDesc::length_offset_in_bytes(), T_INT, null_check_info); -- __ branch(lir_cond_aboveEqual, T_INT, stub); // forward branch -+ cmp_mem_int_branch(lir_cond_belowEqual, array, arrayOopDesc::length_offset_in_bytes(), -+ index->as_jint(), stub, null_check_info); // forward branch -+ } else { -+ cmp_reg_mem_branch(lir_cond_aboveEqual, index, array, arrayOopDesc::length_offset_in_bytes(), -+ T_INT, stub, null_check_info); // forward branch - } - } - -@@ -497,12 +501,10 @@ - void LIRGenerator::nio_range_check(LIR_Opr buffer, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) { - CodeStub* stub = new RangeCheckStub(info, index, true); - if (index->is_constant()) { -- cmp_mem_int(lir_cond_belowEqual, buffer, java_nio_Buffer::limit_offset(), index->as_jint(), info); -- __ branch(lir_cond_belowEqual, T_INT, stub); // forward branch -+ cmp_mem_int_branch(lir_cond_belowEqual, buffer, java_nio_Buffer::limit_offset(), index->as_jint(), stub, info); // forward branch - } else { -- cmp_reg_mem(lir_cond_aboveEqual, index, buffer, -- java_nio_Buffer::limit_offset(), T_INT, info); -- __ branch(lir_cond_aboveEqual, T_INT, stub); // forward branch -+ cmp_reg_mem_branch(lir_cond_aboveEqual, index, buffer, -+ java_nio_Buffer::limit_offset(), T_INT, stub, info); // forward branch - } - __ move(index, result); - } -@@ -935,7 +937,7 @@ - return tmp; - } + #ifndef SHARE_VM_C1_C1_LIR_HPP + #define SHARE_VM_C1_C1_LIR_HPP --void LIRGenerator::profile_branch(If* if_instr, If::Condition cond) { -+void LIRGenerator::profile_branch(If* if_instr, If::Condition cond, LIR_Opr left, LIR_Opr right) { - if (if_instr->should_profile()) { - ciMethod* method = if_instr->profiled_method(); - assert(method != NULL, "method should be set if branch is profiled"); -@@ -956,10 +958,17 @@ - __ metadata2reg(md->constant_encoding(), md_reg); - - LIR_Opr data_offset_reg = new_pointer_register(); -- __ cmove(lir_cond(cond), -- LIR_OprFact::intptrConst(taken_count_offset), -- LIR_OprFact::intptrConst(not_taken_count_offset), -- data_offset_reg, as_BasicType(if_instr->x()->type())); -+ if (left == LIR_OprFact::illegalOpr && right == LIR_OprFact::illegalOpr) { -+ __ cmove(lir_cond(cond), -+ LIR_OprFact::intptrConst(taken_count_offset), -+ LIR_OprFact::intptrConst(not_taken_count_offset), -+ data_offset_reg, as_BasicType(if_instr->x()->type())); -+ } else { -+ __ cmp_cmove(lir_cond(cond), left, right, -+ LIR_OprFact::intptrConst(taken_count_offset), -+ LIR_OprFact::intptrConst(not_taken_count_offset), -+ data_offset_reg, as_BasicType(if_instr->x()->type())); -+ } - - // MDO cells are intptr_t, so the data_reg width is arch-dependent. - LIR_Opr data_reg = new_pointer_register(); -@@ -1306,8 +1315,8 @@ - } - - __ move(new LIR_Address(rcvr.result(), java_lang_Class::klass_offset_in_bytes(), T_ADDRESS), temp, info); -- __ cmp(lir_cond_notEqual, temp, LIR_OprFact::metadataConst(0)); -- __ cmove(lir_cond_notEqual, LIR_OprFact::intConst(0), LIR_OprFact::intConst(1), result, T_BOOLEAN); -+ __ cmp_cmove(lir_cond_notEqual, temp, LIR_OprFact::metadataConst(0), -+ LIR_OprFact::intConst(0), LIR_OprFact::intConst(1), result, T_BOOLEAN); - } - - // Example: Thread.currentThread() -@@ -1500,7 +1509,6 @@ - // Read the marking-in-progress flag. - LIR_Opr flag_val = new_register(T_INT); - __ load(mark_active_flag_addr, flag_val); -- __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0)); - - LIR_PatchCode pre_val_patch_code = lir_patch_none; - -@@ -1529,7 +1537,7 @@ - slow = new G1PreBarrierStub(pre_val); - } - -- __ branch(lir_cond_notEqual, T_INT, slow); -+ __ cmp_branch(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0), T_INT, slow); - __ branch_destination(slow->continuation()); - } - -@@ -1587,10 +1595,8 @@ - } - assert(new_val->is_register(), "must be a register at this point"); - -- __ cmp(lir_cond_notEqual, xor_shift_res, LIR_OprFact::intptrConst(NULL_WORD)); -- - CodeStub* slow = new G1PostBarrierStub(addr, new_val); -- __ branch(lir_cond_notEqual, LP64_ONLY(T_LONG) NOT_LP64(T_INT), slow); -+ __ cmp_branch(lir_cond_notEqual, xor_shift_res, LIR_OprFact::intptrConst(NULL_WORD), T_INT, slow); - __ branch_destination(slow->continuation()); - } - -@@ -1860,12 +1866,10 @@ - CodeEmitInfo* info = state_for(x); - CodeStub* stub = new RangeCheckStub(info, index.result(), true); - if (index.result()->is_constant()) { -- cmp_mem_int(lir_cond_belowEqual, buf.result(), java_nio_Buffer::limit_offset(), index.result()->as_jint(), info); -- __ branch(lir_cond_belowEqual, T_INT, stub); -+ cmp_mem_int_branch(lir_cond_belowEqual, buf.result(), java_nio_Buffer::limit_offset(), index.result()->as_jint(), stub, info); - } else { -- cmp_reg_mem(lir_cond_aboveEqual, index.result(), buf.result(), -- java_nio_Buffer::limit_offset(), T_INT, info); -- __ branch(lir_cond_aboveEqual, T_INT, stub); -+ cmp_reg_mem_branch(lir_cond_aboveEqual, index.result(), buf.result(), -+ java_nio_Buffer::limit_offset(), T_INT, stub, info); - } - __ move(index.result(), result); - } else { -@@ -1946,8 +1950,8 @@ - } else if (use_length) { - // TODO: use a (modified) version of array_range_check that does not require a - // constant length to be loaded to a register -- __ cmp(lir_cond_belowEqual, length.result(), index.result()); -- __ branch(lir_cond_belowEqual, T_INT, new RangeCheckStub(range_check_info, index.result())); -+ CodeStub* stub = new RangeCheckStub(range_check_info, index.result()); -+ __ cmp_branch(lir_cond_belowEqual, length.result(), index.result(), T_INT, stub); - } else { - array_range_check(array.result(), index.result(), null_check_info, range_check_info); - // The range check performs the null check, so clear it out for the load -@@ -2129,7 +2133,7 @@ - assert(index_op->type() == T_INT, "only int constants supported"); - addr = new LIR_Address(base_op, index_op->as_jint(), dst_type); - } else { --#if defined(X86) || defined(AARCH64) -+#if defined(X86) || defined(AARCH64) || defined(LOONGARCH) - addr = new LIR_Address(base_op, index_op, LIR_Address::Scale(log2_scale), 0, dst_type); - #elif defined(GENERATE_ADDRESS_IS_PREFERRED) - addr = generate_address(base_op, index_op, log2_scale, 0, dst_type); -@@ -2344,19 +2348,18 @@ - - if (off.type()->is_int()) { - referent_off = LIR_OprFact::intConst(java_lang_ref_Reference::referent_offset); -+ __ cmp_branch(lir_cond_notEqual, off.result(), referent_off, T_INT, Lcont->label()); - } else { - assert(off.type()->is_long(), "what else?"); - referent_off = new_register(T_LONG); - __ move(LIR_OprFact::longConst(java_lang_ref_Reference::referent_offset), referent_off); -+ __ cmp_branch(lir_cond_notEqual, off.result(), referent_off, T_LONG, Lcont->label()); - } -- __ cmp(lir_cond_notEqual, off.result(), referent_off); -- __ branch(lir_cond_notEqual, as_BasicType(off.type()), Lcont->label()); - } - if (gen_source_check) { - // offset is a const and equals referent offset - // if (source == null) -> continue -- __ cmp(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL)); -- __ branch(lir_cond_equal, T_OBJECT, Lcont->label()); -+ __ cmp_branch(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL), T_OBJECT, Lcont->label()); - } - LIR_Opr src_klass = new_register(T_METADATA); - if (gen_type_check) { -@@ -2366,8 +2369,7 @@ - LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE); - LIR_Opr reference_type = new_register(T_INT); - __ move(reference_type_addr, reference_type); -- __ cmp(lir_cond_equal, reference_type, LIR_OprFact::intConst(REF_NONE)); -- __ branch(lir_cond_equal, T_INT, Lcont->label()); -+ __ cmp_branch(lir_cond_equal, reference_type, LIR_OprFact::intConst(REF_NONE), T_INT, Lcont->label()); - } - { - // We have determined that src->_klass->_reference_type != REF_NONE -@@ -2447,19 +2449,14 @@ - int high_key = one_range->high_key(); - BlockBegin* dest = one_range->sux(); - if (low_key == high_key) { -- __ cmp(lir_cond_equal, value, low_key); -- __ branch(lir_cond_equal, T_INT, dest); -+ __ cmp_branch(lir_cond_equal, value, low_key, T_INT, dest); - } else if (high_key - low_key == 1) { -- __ cmp(lir_cond_equal, value, low_key); -- __ branch(lir_cond_equal, T_INT, dest); -- __ cmp(lir_cond_equal, value, high_key); -- __ branch(lir_cond_equal, T_INT, dest); -+ __ cmp_branch(lir_cond_equal, value, low_key, T_INT, dest); -+ __ cmp_branch(lir_cond_equal, value, high_key, T_INT, dest); - } else { - LabelObj* L = new LabelObj(); -- __ cmp(lir_cond_less, value, low_key); -- __ branch(lir_cond_less, T_INT, L->label()); -- __ cmp(lir_cond_lessEqual, value, high_key); -- __ branch(lir_cond_lessEqual, T_INT, dest); -+ __ cmp_branch(lir_cond_less, value, low_key, T_INT, L->label()); -+ __ cmp_branch(lir_cond_lessEqual, value, high_key, T_INT, dest); - __ branch_destination(L->label()); - } - } -@@ -2546,8 +2543,7 @@ - do_SwitchRanges(create_lookup_ranges(x), value, x->default_sux()); - } else { - for (int i = 0; i < len; i++) { -- __ cmp(lir_cond_equal, value, i + lo_key); -- __ branch(lir_cond_equal, T_INT, x->sux_at(i)); -+ __ cmp_branch(lir_cond_equal, value, i + lo_key, T_INT, x->sux_at(i)); - } - __ jump(x->default_sux()); - } -@@ -2572,8 +2568,7 @@ - } else { - int len = x->length(); - for (int i = 0; i < len; i++) { -- __ cmp(lir_cond_equal, value, x->key_at(i)); -- __ branch(lir_cond_equal, T_INT, x->sux_at(i)); -+ __ cmp_branch(lir_cond_equal, value, x->key_at(i), T_INT, x->sux_at(i)); - } - __ jump(x->default_sux()); - } -@@ -2625,7 +2620,6 @@ - } - LIR_Opr md_reg = new_register(T_METADATA); - __ metadata2reg(md->constant_encoding(), md_reg); -- - increment_counter(new LIR_Address(md_reg, offset, - NOT_LP64(T_INT) LP64_ONLY(T_LONG)), DataLayout::counter_increment); - } -@@ -3079,8 +3073,8 @@ - f_val.dont_load_item(); - LIR_Opr reg = rlock_result(x); - -- __ cmp(lir_cond(x->cond()), left.result(), right.result()); -- __ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type())); -+ __ cmp_cmove(lir_cond(x->cond()), left.result(), right.result(), -+ t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type())); - } - - #ifdef JFR_HAVE_INTRINSICS -@@ -3120,8 +3114,7 @@ - T_OBJECT); - LIR_Opr result = rlock_result(x); - __ move_wide(jobj_addr, result); -- __ cmp(lir_cond_equal, result, LIR_OprFact::oopConst(NULL)); -- __ branch(lir_cond_equal, T_OBJECT, L_end->label()); -+ __ cmp_branch(lir_cond_equal, result, LIR_OprFact::oopConst(0), T_OBJECT, L_end->label()); - __ move_wide(new LIR_Address(result, T_OBJECT), result); - - __ branch_destination(L_end->label()); -@@ -3485,10 +3478,9 @@ - LIR_Opr meth = new_register(T_METADATA); - __ metadata2reg(method->constant_encoding(), meth); - __ logical_and(result, mask, result); -- __ cmp(lir_cond_equal, result, LIR_OprFact::intConst(0)); - // The bci for info can point to cmp for if's we want the if bci - CodeStub* overflow = new CounterOverflowStub(info, bci, meth); -- __ branch(lir_cond_equal, T_INT, overflow); -+ __ cmp_branch(lir_cond_equal, result, LIR_OprFact::intConst(0), T_INT, overflow); - __ branch_destination(overflow->continuation()); - } - } -@@ -3600,8 +3592,7 @@ - CodeEmitInfo *info = state_for(x, x->state()); - CodeStub* stub = new PredicateFailedStub(info); - -- __ cmp(lir_cond(cond), left, right); -- __ branch(lir_cond(cond), right->type(), stub); -+ __ cmp_branch(lir_cond(cond), left, right, right->type(), stub); - } - } - -@@ -3749,8 +3740,7 @@ - __ move(new LIR_Address(klass, in_bytes(Klass::layout_helper_offset()), T_INT), layout); - int diffbit = Klass::layout_helper_boolean_diffbit(); - __ logical_and(layout, LIR_OprFact::intConst(diffbit), layout); -- __ cmp(lir_cond_notEqual, layout, LIR_OprFact::intConst(0)); -- __ cmove(lir_cond_notEqual, value_fixed, value, value_fixed, T_BYTE); -+ __ cmp_cmove(lir_cond_notEqual, layout, LIR_OprFact::intConst(0), value_fixed, value, value_fixed, T_BYTE); - value = value_fixed; - } - return value; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp ---- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp 2023-12-20 09:23:19.918146502 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2015. These -+ * modifications are Copyright (c) 2015 Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #ifndef SHARE_VM_C1_C1_LIRGENERATOR_HPP - #define SHARE_VM_C1_C1_LIRGENERATOR_HPP - -@@ -246,6 +252,9 @@ - void do_getClass(Intrinsic* x); - void do_currentThread(Intrinsic* x); - void do_MathIntrinsic(Intrinsic* x); -+#if defined(LOONGARCH64) -+ void do_LibmIntrinsic(Intrinsic* x); -+#endif - void do_ArrayCopy(Intrinsic* x); - void do_CompareAndSwap(Intrinsic* x, ValueType* type); - void do_NIOCheckIndex(Intrinsic* x); -@@ -335,8 +344,10 @@ - void new_instance (LIR_Opr dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info); - - // machine dependent -- void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info); -- void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info); -+ template -+ void cmp_mem_int_branch(LIR_Condition condition, LIR_Opr base, int disp, int c, T tgt, CodeEmitInfo* info); -+ template -+ void cmp_reg_mem_branch(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, T tgt, CodeEmitInfo* info); - void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info); - - void arraycopy_helper(Intrinsic* x, int* flags, ciArrayKlass** expected_type); -@@ -364,7 +375,7 @@ - - LIR_Opr safepoint_poll_register(); - -- void profile_branch(If* if_instr, If::Condition cond); -+ void profile_branch(If* if_instr, If::Condition cond, LIR_Opr left = LIR_OprFact::illegalOpr, LIR_Opr right = LIR_OprFact::illegalOpr); - void increment_event_counter_impl(CodeEmitInfo* info, - ciMethod *method, int frequency, - int bci, bool backedge, bool notify); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp ---- a/hotspot/src/share/vm/c1/c1_LIR.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp 2023-12-20 09:23:19.914813209 +0800 -@@ -22,6 +22,11 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2022. These -+ * modifications are Copyright (c) 2018, 2022, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ - #ifndef SHARE_VM_C1_C1_LIR_HPP - #define SHARE_VM_C1_C1_LIR_HPP - -@@ -452,7 +457,7 @@ - // for compatibility with RInfo - int fpu () const { return lo_reg_half(); } - #endif --#if defined(SPARC) || defined(ARM) || defined(PPC) || defined(AARCH64) -+#if defined(SPARC) || defined(ARM) || defined(PPC) || defined(AARCH64) || defined(LOONGARCH) - FloatRegister as_float_reg () const; - FloatRegister as_double_reg () const; - #endif -@@ -542,7 +547,7 @@ - , _type(type) - , _disp(0) { verify(); } +@@ -452,7 +457,7 @@ class LIR_OprDesc: public CompilationResourceObj { + // for compatibility with RInfo + int fpu () const { return lo_reg_half(); } + #endif +-#if defined(SPARC) || defined(ARM) || defined(PPC) || defined(AARCH64) ++#if defined(SPARC) || defined(ARM) || defined(PPC) || defined(AARCH64) || defined(LOONGARCH) + FloatRegister as_float_reg () const; + FloatRegister as_double_reg () const; + #endif +@@ -542,7 +547,7 @@ class LIR_Address: public LIR_OprPtr { + , _type(type) + , _disp(0) { verify(); } -#if defined(X86) || defined(ARM) || defined(AARCH64) +#if defined(X86) || defined(ARM) || defined(AARCH64) || defined(LOONGARCH) LIR_Address(LIR_Opr base, LIR_Opr index, Scale scale, intx disp, BasicType type): _base(base) , _index(index) -@@ -658,7 +663,13 @@ +@@ -658,7 +663,13 @@ class LIR_OprFact: public AllStatic { LIR_OprDesc::double_type | LIR_OprDesc::cpu_register | LIR_OprDesc::double_size); } @@ -112150,7 +112008,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp static LIR_Opr virtual_register(int index, BasicType type) { LIR_Opr res; -@@ -872,9 +883,11 @@ +@@ -872,9 +883,11 @@ class LIR_OpConvert; class LIR_OpAllocObj; class LIR_OpRoundFP; class LIR_Op2; @@ -112162,7 +112020,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp class LIR_OpCall; class LIR_OpJavaCall; class LIR_OpRTCall; -@@ -943,6 +956,8 @@ +@@ -943,6 +956,8 @@ enum LIR_Code { , lir_cmp_l2i , lir_ucmp_fd2i , lir_cmp_fd2i @@ -112171,7 +112029,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp , lir_cmove , lir_add , lir_sub -@@ -976,6 +991,9 @@ +@@ -976,6 +991,9 @@ enum LIR_Code { , lir_idiv , lir_irem , end_op3 @@ -112181,7 +112039,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp , begin_opJavaCall , lir_static_call , lir_optvirtual_call -@@ -1139,12 +1157,14 @@ +@@ -1139,12 +1157,14 @@ class LIR_Op: public CompilationResourceObj { virtual LIR_OpAllocObj* as_OpAllocObj() { return NULL; } virtual LIR_OpRoundFP* as_OpRoundFP() { return NULL; } virtual LIR_OpBranch* as_OpBranch() { return NULL; } @@ -112196,7 +112054,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; } virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; } virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; } -@@ -1474,37 +1494,18 @@ +@@ -1474,37 +1494,18 @@ class LIR_OpConvert: public LIR_Op1 { private: Bytecodes::Code _bytecode; ConversionStub* _stub; @@ -112238,7 +112096,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp virtual void emit_code(LIR_Assembler* masm); virtual LIR_OpConvert* as_OpConvert() { return this; } -@@ -1659,7 +1660,7 @@ +@@ -1659,7 +1660,7 @@ class LIR_Op2: public LIR_Op { , _tmp3(LIR_OprFact::illegalOpr) , _tmp4(LIR_OprFact::illegalOpr) , _tmp5(LIR_OprFact::illegalOpr) { @@ -112247,7 +112105,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } LIR_Op2(LIR_Code code, LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) -@@ -1691,7 +1692,7 @@ +@@ -1691,7 +1692,7 @@ class LIR_Op2: public LIR_Op { , _tmp3(LIR_OprFact::illegalOpr) , _tmp4(LIR_OprFact::illegalOpr) , _tmp5(LIR_OprFact::illegalOpr) { @@ -112256,7 +112114,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2 = LIR_OprFact::illegalOpr, -@@ -1707,7 +1708,7 @@ +@@ -1707,7 +1708,7 @@ class LIR_Op2: public LIR_Op { , _tmp3(tmp3) , _tmp4(tmp4) , _tmp5(tmp5) { @@ -112265,7 +112123,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } LIR_Opr in_opr1() const { return _opr1; } -@@ -1719,10 +1720,12 @@ +@@ -1719,10 +1720,12 @@ class LIR_Op2: public LIR_Op { LIR_Opr tmp4_opr() const { return _tmp4; } LIR_Opr tmp5_opr() const { return _tmp5; } LIR_Condition condition() const { @@ -112280,7 +112138,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } void set_fpu_stack_size(int size) { _fpu_stack_size = size; } -@@ -1736,6 +1739,43 @@ +@@ -1736,6 +1739,43 @@ class LIR_Op2: public LIR_Op { virtual void print_instr(outputStream* out) const PRODUCT_RETURN; }; @@ -112324,7 +112182,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp class LIR_OpAllocArray : public LIR_Op { friend class LIR_OpVisitState; -@@ -1776,7 +1816,6 @@ +@@ -1776,7 +1816,6 @@ class LIR_OpAllocArray : public LIR_Op { virtual void print_instr(outputStream* out) const PRODUCT_RETURN; }; @@ -112332,7 +112190,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp class LIR_Op3: public LIR_Op { friend class LIR_OpVisitState; -@@ -1800,6 +1839,48 @@ +@@ -1800,6 +1839,48 @@ class LIR_Op3: public LIR_Op { }; @@ -112381,7 +112239,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp //-------------------------------- class LabelObj: public CompilationResourceObj { private: -@@ -2141,17 +2222,9 @@ +@@ -2141,17 +2222,9 @@ class LIR_List: public CompilationResourceObj { void safepoint(LIR_Opr tmp, CodeEmitInfo* info) { append(new LIR_Op1(lir_safepoint, tmp, info)); } @@ -112401,7 +112259,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and, left, right, dst)); } void logical_or (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_or, left, right, dst)); } -@@ -2256,6 +2329,48 @@ +@@ -2256,6 +2329,48 @@ class LIR_List: public CompilationResourceObj { append(new LIR_OpBranch(cond, type, block, unordered)); } @@ -112450,9 +112308,623 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void shift_left(LIR_Opr value, LIR_Opr count, LIR_Opr dst, LIR_Opr tmp); void shift_right(LIR_Opr value, LIR_Opr count, LIR_Opr dst, LIR_Opr tmp); void unsigned_shift_right(LIR_Opr value, LIR_Opr count, LIR_Opr dst, LIR_Opr tmp); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp ---- a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp 2023-12-20 09:23:19.918146502 +0800 +diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +index e5cd19f17a..a18c53008b 100644 +--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp ++++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2022. These ++ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #include "precompiled.hpp" + #include "c1/c1_Compilation.hpp" + #include "c1/c1_Instruction.hpp" +@@ -34,6 +40,10 @@ + # include "nativeInst_x86.hpp" + # include "vmreg_x86.inline.hpp" + #endif ++#ifdef TARGET_ARCH_loongarch ++# include "nativeInst_loongarch.hpp" ++# include "vmreg_loongarch.inline.hpp" ++#endif + #ifdef TARGET_ARCH_aarch64 + # include "nativeInst_aarch64.hpp" + # include "vmreg_aarch64.inline.hpp" +@@ -811,6 +821,18 @@ void LIR_Assembler::emit_op2(LIR_Op2* op) { + } + + ++void LIR_Assembler::emit_op4(LIR_Op4* op) { ++ switch (op->code()) { ++ case lir_cmp_cmove: ++ cmp_cmove(op->condition(), op->in_opr1(), op->in_opr2(), op->in_opr3(), op->in_opr4(), op->result_opr(), op->type()); ++ break; ++ ++ default: ++ Unimplemented(); ++ break; ++ } ++} ++ + void LIR_Assembler::build_frame() { + _masm->build_frame(initial_frame_size_in_bytes(), bang_size_in_bytes()); + } +diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp +index 1a68d458d2..ac0f4e7a46 100644 +--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp ++++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2022. These ++ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #ifndef SHARE_VM_C1_C1_LIRASSEMBLER_HPP + #define SHARE_VM_C1_C1_LIRASSEMBLER_HPP + +@@ -195,7 +201,9 @@ class LIR_Assembler: public CompilationResourceObj { + void emit_op1(LIR_Op1* op); + void emit_op2(LIR_Op2* op); + void emit_op3(LIR_Op3* op); ++ void emit_op4(LIR_Op4* op); + void emit_opBranch(LIR_OpBranch* op); ++ void emit_opCmpBranch(LIR_OpCmpBranch* op); + void emit_opLabel(LIR_OpLabel* op); + void emit_arraycopy(LIR_OpArrayCopy* op); + void emit_updatecrc32(LIR_OpUpdateCRC32* op); +@@ -227,6 +235,7 @@ class LIR_Assembler: public CompilationResourceObj { + void volatile_move_op(LIR_Opr src, LIR_Opr result, BasicType type, CodeEmitInfo* info); + void comp_mem_op(LIR_Opr src, LIR_Opr result, BasicType type, CodeEmitInfo* info); // info set for null exceptions + void comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr result, LIR_Op2* op); ++ void cmp_cmove(LIR_Condition code, LIR_Opr left, LIR_Opr right, LIR_Opr src1, LIR_Opr src2, LIR_Opr result, BasicType type); + void cmove(LIR_Condition code, LIR_Opr left, LIR_Opr right, LIR_Opr result, BasicType type); + + void call( LIR_OpJavaCall* op, relocInfo::relocType rtype); +@@ -265,6 +274,9 @@ class LIR_Assembler: public CompilationResourceObj { + #ifdef TARGET_ARCH_x86 + # include "c1_LIRAssembler_x86.hpp" + #endif ++#ifdef TARGET_ARCH_loongarch ++# include "c1_LIRAssembler_loongarch.hpp" ++#endif + #ifdef TARGET_ARCH_aarch64 + # include "c1_LIRAssembler_aarch64.hpp" + #endif +diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +index e98834d03a..d1a987c699 100644 +--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp ++++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2022. These ++ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #include "precompiled.hpp" + #include "c1/c1_Defs.hpp" + #include "c1/c1_Compilation.hpp" +@@ -483,13 +489,11 @@ void LIRGenerator::array_range_check(LIR_Opr array, LIR_Opr index, + CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info) { + CodeStub* stub = new RangeCheckStub(range_check_info, index); + if (index->is_constant()) { +- cmp_mem_int(lir_cond_belowEqual, array, arrayOopDesc::length_offset_in_bytes(), +- index->as_jint(), null_check_info); +- __ branch(lir_cond_belowEqual, T_INT, stub); // forward branch ++ cmp_mem_int_branch(lir_cond_belowEqual, array, arrayOopDesc::length_offset_in_bytes(), ++ index->as_jint(), stub, null_check_info); // forward branch + } else { +- cmp_reg_mem(lir_cond_aboveEqual, index, array, +- arrayOopDesc::length_offset_in_bytes(), T_INT, null_check_info); +- __ branch(lir_cond_aboveEqual, T_INT, stub); // forward branch ++ cmp_reg_mem_branch(lir_cond_aboveEqual, index, array, arrayOopDesc::length_offset_in_bytes(), ++ T_INT, stub, null_check_info); // forward branch + } + } + +@@ -497,12 +501,10 @@ void LIRGenerator::array_range_check(LIR_Opr array, LIR_Opr index, + void LIRGenerator::nio_range_check(LIR_Opr buffer, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) { + CodeStub* stub = new RangeCheckStub(info, index, true); + if (index->is_constant()) { +- cmp_mem_int(lir_cond_belowEqual, buffer, java_nio_Buffer::limit_offset(), index->as_jint(), info); +- __ branch(lir_cond_belowEqual, T_INT, stub); // forward branch ++ cmp_mem_int_branch(lir_cond_belowEqual, buffer, java_nio_Buffer::limit_offset(), index->as_jint(), stub, info); // forward branch + } else { +- cmp_reg_mem(lir_cond_aboveEqual, index, buffer, +- java_nio_Buffer::limit_offset(), T_INT, info); +- __ branch(lir_cond_aboveEqual, T_INT, stub); // forward branch ++ cmp_reg_mem_branch(lir_cond_aboveEqual, index, buffer, ++ java_nio_Buffer::limit_offset(), T_INT, stub, info); // forward branch + } + __ move(index, result); + } +@@ -935,7 +937,7 @@ LIR_Opr LIRGenerator::force_to_spill(LIR_Opr value, BasicType t) { + return tmp; + } + +-void LIRGenerator::profile_branch(If* if_instr, If::Condition cond) { ++void LIRGenerator::profile_branch(If* if_instr, If::Condition cond, LIR_Opr left, LIR_Opr right) { + if (if_instr->should_profile()) { + ciMethod* method = if_instr->profiled_method(); + assert(method != NULL, "method should be set if branch is profiled"); +@@ -956,10 +958,17 @@ void LIRGenerator::profile_branch(If* if_instr, If::Condition cond) { + __ metadata2reg(md->constant_encoding(), md_reg); + + LIR_Opr data_offset_reg = new_pointer_register(); +- __ cmove(lir_cond(cond), +- LIR_OprFact::intptrConst(taken_count_offset), +- LIR_OprFact::intptrConst(not_taken_count_offset), +- data_offset_reg, as_BasicType(if_instr->x()->type())); ++ if (left == LIR_OprFact::illegalOpr && right == LIR_OprFact::illegalOpr) { ++ __ cmove(lir_cond(cond), ++ LIR_OprFact::intptrConst(taken_count_offset), ++ LIR_OprFact::intptrConst(not_taken_count_offset), ++ data_offset_reg, as_BasicType(if_instr->x()->type())); ++ } else { ++ __ cmp_cmove(lir_cond(cond), left, right, ++ LIR_OprFact::intptrConst(taken_count_offset), ++ LIR_OprFact::intptrConst(not_taken_count_offset), ++ data_offset_reg, as_BasicType(if_instr->x()->type())); ++ } + + // MDO cells are intptr_t, so the data_reg width is arch-dependent. + LIR_Opr data_reg = new_pointer_register(); +@@ -1306,8 +1315,8 @@ void LIRGenerator::do_isPrimitive(Intrinsic* x) { + } + + __ move(new LIR_Address(rcvr.result(), java_lang_Class::klass_offset_in_bytes(), T_ADDRESS), temp, info); +- __ cmp(lir_cond_notEqual, temp, LIR_OprFact::metadataConst(0)); +- __ cmove(lir_cond_notEqual, LIR_OprFact::intConst(0), LIR_OprFact::intConst(1), result, T_BOOLEAN); ++ __ cmp_cmove(lir_cond_notEqual, temp, LIR_OprFact::metadataConst(0), ++ LIR_OprFact::intConst(0), LIR_OprFact::intConst(1), result, T_BOOLEAN); + } + + // Example: Thread.currentThread() +@@ -1500,7 +1509,6 @@ void LIRGenerator::G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, LIR_Opr p + // Read the marking-in-progress flag. + LIR_Opr flag_val = new_register(T_INT); + __ load(mark_active_flag_addr, flag_val); +- __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0)); + + LIR_PatchCode pre_val_patch_code = lir_patch_none; + +@@ -1529,7 +1537,7 @@ void LIRGenerator::G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, LIR_Opr p + slow = new G1PreBarrierStub(pre_val); + } + +- __ branch(lir_cond_notEqual, T_INT, slow); ++ __ cmp_branch(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0), T_INT, slow); + __ branch_destination(slow->continuation()); + } + +@@ -1587,10 +1595,8 @@ void LIRGenerator::G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_Opr + } + assert(new_val->is_register(), "must be a register at this point"); + +- __ cmp(lir_cond_notEqual, xor_shift_res, LIR_OprFact::intptrConst(NULL_WORD)); +- + CodeStub* slow = new G1PostBarrierStub(addr, new_val); +- __ branch(lir_cond_notEqual, LP64_ONLY(T_LONG) NOT_LP64(T_INT), slow); ++ __ cmp_branch(lir_cond_notEqual, xor_shift_res, LIR_OprFact::intptrConst(NULL_WORD), T_INT, slow); + __ branch_destination(slow->continuation()); + } + +@@ -1860,12 +1866,10 @@ void LIRGenerator::do_NIOCheckIndex(Intrinsic* x) { + CodeEmitInfo* info = state_for(x); + CodeStub* stub = new RangeCheckStub(info, index.result(), true); + if (index.result()->is_constant()) { +- cmp_mem_int(lir_cond_belowEqual, buf.result(), java_nio_Buffer::limit_offset(), index.result()->as_jint(), info); +- __ branch(lir_cond_belowEqual, T_INT, stub); ++ cmp_mem_int_branch(lir_cond_belowEqual, buf.result(), java_nio_Buffer::limit_offset(), index.result()->as_jint(), stub, info); + } else { +- cmp_reg_mem(lir_cond_aboveEqual, index.result(), buf.result(), +- java_nio_Buffer::limit_offset(), T_INT, info); +- __ branch(lir_cond_aboveEqual, T_INT, stub); ++ cmp_reg_mem_branch(lir_cond_aboveEqual, index.result(), buf.result(), ++ java_nio_Buffer::limit_offset(), T_INT, stub, info); + } + __ move(index.result(), result); + } else { +@@ -1946,8 +1950,8 @@ void LIRGenerator::do_LoadIndexed(LoadIndexed* x) { + } else if (use_length) { + // TODO: use a (modified) version of array_range_check that does not require a + // constant length to be loaded to a register +- __ cmp(lir_cond_belowEqual, length.result(), index.result()); +- __ branch(lir_cond_belowEqual, T_INT, new RangeCheckStub(range_check_info, index.result())); ++ CodeStub* stub = new RangeCheckStub(range_check_info, index.result()); ++ __ cmp_branch(lir_cond_belowEqual, length.result(), index.result(), T_INT, stub); + } else { + array_range_check(array.result(), index.result(), null_check_info, range_check_info); + // The range check performs the null check, so clear it out for the load +@@ -2129,7 +2133,7 @@ void LIRGenerator::do_UnsafeGetRaw(UnsafeGetRaw* x) { + assert(index_op->type() == T_INT, "only int constants supported"); + addr = new LIR_Address(base_op, index_op->as_jint(), dst_type); + } else { +-#if defined(X86) || defined(AARCH64) ++#if defined(X86) || defined(AARCH64) || defined(LOONGARCH) + addr = new LIR_Address(base_op, index_op, LIR_Address::Scale(log2_scale), 0, dst_type); + #elif defined(GENERATE_ADDRESS_IS_PREFERRED) + addr = generate_address(base_op, index_op, log2_scale, 0, dst_type); +@@ -2344,19 +2348,18 @@ void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) { + + if (off.type()->is_int()) { + referent_off = LIR_OprFact::intConst(java_lang_ref_Reference::referent_offset); ++ __ cmp_branch(lir_cond_notEqual, off.result(), referent_off, T_INT, Lcont->label()); + } else { + assert(off.type()->is_long(), "what else?"); + referent_off = new_register(T_LONG); + __ move(LIR_OprFact::longConst(java_lang_ref_Reference::referent_offset), referent_off); ++ __ cmp_branch(lir_cond_notEqual, off.result(), referent_off, T_LONG, Lcont->label()); + } +- __ cmp(lir_cond_notEqual, off.result(), referent_off); +- __ branch(lir_cond_notEqual, as_BasicType(off.type()), Lcont->label()); + } + if (gen_source_check) { + // offset is a const and equals referent offset + // if (source == null) -> continue +- __ cmp(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL)); +- __ branch(lir_cond_equal, T_OBJECT, Lcont->label()); ++ __ cmp_branch(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL), T_OBJECT, Lcont->label()); + } + LIR_Opr src_klass = new_register(T_METADATA); + if (gen_type_check) { +@@ -2366,8 +2369,7 @@ void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) { + LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE); + LIR_Opr reference_type = new_register(T_INT); + __ move(reference_type_addr, reference_type); +- __ cmp(lir_cond_equal, reference_type, LIR_OprFact::intConst(REF_NONE)); +- __ branch(lir_cond_equal, T_INT, Lcont->label()); ++ __ cmp_branch(lir_cond_equal, reference_type, LIR_OprFact::intConst(REF_NONE), T_INT, Lcont->label()); + } + { + // We have determined that src->_klass->_reference_type != REF_NONE +@@ -2447,19 +2449,14 @@ void LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegi + int high_key = one_range->high_key(); + BlockBegin* dest = one_range->sux(); + if (low_key == high_key) { +- __ cmp(lir_cond_equal, value, low_key); +- __ branch(lir_cond_equal, T_INT, dest); ++ __ cmp_branch(lir_cond_equal, value, low_key, T_INT, dest); + } else if (high_key - low_key == 1) { +- __ cmp(lir_cond_equal, value, low_key); +- __ branch(lir_cond_equal, T_INT, dest); +- __ cmp(lir_cond_equal, value, high_key); +- __ branch(lir_cond_equal, T_INT, dest); ++ __ cmp_branch(lir_cond_equal, value, low_key, T_INT, dest); ++ __ cmp_branch(lir_cond_equal, value, high_key, T_INT, dest); + } else { + LabelObj* L = new LabelObj(); +- __ cmp(lir_cond_less, value, low_key); +- __ branch(lir_cond_less, T_INT, L->label()); +- __ cmp(lir_cond_lessEqual, value, high_key); +- __ branch(lir_cond_lessEqual, T_INT, dest); ++ __ cmp_branch(lir_cond_less, value, low_key, T_INT, L->label()); ++ __ cmp_branch(lir_cond_lessEqual, value, high_key, T_INT, dest); + __ branch_destination(L->label()); + } + } +@@ -2546,8 +2543,7 @@ void LIRGenerator::do_TableSwitch(TableSwitch* x) { + do_SwitchRanges(create_lookup_ranges(x), value, x->default_sux()); + } else { + for (int i = 0; i < len; i++) { +- __ cmp(lir_cond_equal, value, i + lo_key); +- __ branch(lir_cond_equal, T_INT, x->sux_at(i)); ++ __ cmp_branch(lir_cond_equal, value, i + lo_key, T_INT, x->sux_at(i)); + } + __ jump(x->default_sux()); + } +@@ -2572,8 +2568,7 @@ void LIRGenerator::do_LookupSwitch(LookupSwitch* x) { + } else { + int len = x->length(); + for (int i = 0; i < len; i++) { +- __ cmp(lir_cond_equal, value, x->key_at(i)); +- __ branch(lir_cond_equal, T_INT, x->sux_at(i)); ++ __ cmp_branch(lir_cond_equal, value, x->key_at(i), T_INT, x->sux_at(i)); + } + __ jump(x->default_sux()); + } +@@ -2625,7 +2620,6 @@ void LIRGenerator::do_Goto(Goto* x) { + } + LIR_Opr md_reg = new_register(T_METADATA); + __ metadata2reg(md->constant_encoding(), md_reg); +- + increment_counter(new LIR_Address(md_reg, offset, + NOT_LP64(T_INT) LP64_ONLY(T_LONG)), DataLayout::counter_increment); + } +@@ -3079,8 +3073,8 @@ void LIRGenerator::do_IfOp(IfOp* x) { + f_val.dont_load_item(); + LIR_Opr reg = rlock_result(x); + +- __ cmp(lir_cond(x->cond()), left.result(), right.result()); +- __ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type())); ++ __ cmp_cmove(lir_cond(x->cond()), left.result(), right.result(), ++ t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type())); + } + + #ifdef JFR_HAVE_INTRINSICS +@@ -3120,8 +3114,7 @@ void LIRGenerator::do_getEventWriter(Intrinsic* x) { + T_OBJECT); + LIR_Opr result = rlock_result(x); + __ move_wide(jobj_addr, result); +- __ cmp(lir_cond_equal, result, LIR_OprFact::oopConst(NULL)); +- __ branch(lir_cond_equal, T_OBJECT, L_end->label()); ++ __ cmp_branch(lir_cond_equal, result, LIR_OprFact::oopConst(0), T_OBJECT, L_end->label()); + __ move_wide(new LIR_Address(result, T_OBJECT), result); + + __ branch_destination(L_end->label()); +@@ -3485,10 +3478,9 @@ void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info, + LIR_Opr meth = new_register(T_METADATA); + __ metadata2reg(method->constant_encoding(), meth); + __ logical_and(result, mask, result); +- __ cmp(lir_cond_equal, result, LIR_OprFact::intConst(0)); + // The bci for info can point to cmp for if's we want the if bci + CodeStub* overflow = new CounterOverflowStub(info, bci, meth); +- __ branch(lir_cond_equal, T_INT, overflow); ++ __ cmp_branch(lir_cond_equal, result, LIR_OprFact::intConst(0), T_INT, overflow); + __ branch_destination(overflow->continuation()); + } + } +@@ -3600,8 +3592,7 @@ void LIRGenerator::do_RangeCheckPredicate(RangeCheckPredicate *x) { + CodeEmitInfo *info = state_for(x, x->state()); + CodeStub* stub = new PredicateFailedStub(info); + +- __ cmp(lir_cond(cond), left, right); +- __ branch(lir_cond(cond), right->type(), stub); ++ __ cmp_branch(lir_cond(cond), left, right, right->type(), stub); + } + } + +@@ -3749,8 +3740,7 @@ LIR_Opr LIRGenerator::maybe_mask_boolean(StoreIndexed* x, LIR_Opr array, LIR_Opr + __ move(new LIR_Address(klass, in_bytes(Klass::layout_helper_offset()), T_INT), layout); + int diffbit = Klass::layout_helper_boolean_diffbit(); + __ logical_and(layout, LIR_OprFact::intConst(diffbit), layout); +- __ cmp(lir_cond_notEqual, layout, LIR_OprFact::intConst(0)); +- __ cmove(lir_cond_notEqual, value_fixed, value, value_fixed, T_BYTE); ++ __ cmp_cmove(lir_cond_notEqual, layout, LIR_OprFact::intConst(0), value_fixed, value, value_fixed, T_BYTE); + value = value_fixed; + } + return value; +diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp +index 27be79fee1..57c253db69 100644 +--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp ++++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2015. These ++ * modifications are Copyright (c) 2015 Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #ifndef SHARE_VM_C1_C1_LIRGENERATOR_HPP + #define SHARE_VM_C1_C1_LIRGENERATOR_HPP + +@@ -246,6 +252,9 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { + void do_getClass(Intrinsic* x); + void do_currentThread(Intrinsic* x); + void do_MathIntrinsic(Intrinsic* x); ++#if defined(LOONGARCH64) ++ void do_LibmIntrinsic(Intrinsic* x); ++#endif + void do_ArrayCopy(Intrinsic* x); + void do_CompareAndSwap(Intrinsic* x, ValueType* type); + void do_NIOCheckIndex(Intrinsic* x); +@@ -335,8 +344,10 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { + void new_instance (LIR_Opr dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info); + + // machine dependent +- void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info); +- void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info); ++ template ++ void cmp_mem_int_branch(LIR_Condition condition, LIR_Opr base, int disp, int c, T tgt, CodeEmitInfo* info); ++ template ++ void cmp_reg_mem_branch(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, T tgt, CodeEmitInfo* info); + void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info); + + void arraycopy_helper(Intrinsic* x, int* flags, ciArrayKlass** expected_type); +@@ -364,7 +375,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { + + LIR_Opr safepoint_poll_register(); + +- void profile_branch(If* if_instr, If::Condition cond); ++ void profile_branch(If* if_instr, If::Condition cond, LIR_Opr left = LIR_OprFact::illegalOpr, LIR_Opr right = LIR_OprFact::illegalOpr); + void increment_event_counter_impl(CodeEmitInfo* info, + ciMethod *method, int frequency, + int bci, bool backedge, bool notify); +diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp +index 1f6281bf25..4549ff0928 100644 +--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp ++++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2022. These ++ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #include "precompiled.hpp" + #include "c1/c1_CFGPrinter.hpp" + #include "c1/c1_CodeStubs.hpp" +@@ -35,6 +41,9 @@ + #ifdef TARGET_ARCH_x86 + # include "vmreg_x86.inline.hpp" + #endif ++#ifdef TARGET_ARCH_loongarch ++# include "vmreg_loongarch.inline.hpp" ++#endif + #ifdef TARGET_ARCH_aarch64 + # include "vmreg_aarch64.inline.hpp" + #endif +@@ -1256,6 +1265,23 @@ void LinearScan::add_register_hints(LIR_Op* op) { + LIR_Opr move_from = cmove->in_opr1(); + LIR_Opr move_to = cmove->result_opr(); + ++ if (move_to->is_register() && move_from->is_register()) { ++ Interval* from = interval_at(reg_num(move_from)); ++ Interval* to = interval_at(reg_num(move_to)); ++ if (from != NULL && to != NULL) { ++ to->set_register_hint(from); ++ TRACE_LINEAR_SCAN(4, tty->print_cr("operation at op_id %d: added hint from interval %d to %d", cmove->id(), from->reg_num(), to->reg_num())); ++ } ++ } ++ break; ++ } ++ case lir_cmp_cmove: { ++ assert(op->as_Op4() != NULL, "lir_cmp_cmove must be LIR_Op4"); ++ LIR_Op4* cmove = (LIR_Op4*)op; ++ ++ LIR_Opr move_from = cmove->in_opr3(); ++ LIR_Opr move_to = cmove->result_opr(); ++ + if (move_to->is_register() && move_from->is_register()) { + Interval* from = interval_at(reg_num(move_from)); + Interval* to = interval_at(reg_num(move_to)); +@@ -2104,7 +2130,7 @@ LIR_Opr LinearScan::calc_operand_for_interval(const Interval* interval) { + #ifdef _LP64 + return LIR_OprFact::double_cpu(assigned_reg, assigned_reg); + #else +-#if defined(SPARC) || defined(PPC) ++#if defined(SPARC) || defined(PPC) || defined(LOONGARCH) + return LIR_OprFact::double_cpu(assigned_regHi, assigned_reg); + #else + return LIR_OprFact::double_cpu(assigned_reg, assigned_regHi); +@@ -3285,7 +3311,9 @@ void LinearScan::verify_no_oops_in_fixed_intervals() { + check_live = (move->patch_code() == lir_patch_none); + } + LIR_OpBranch* branch = op->as_OpBranch(); +- if (branch != NULL && branch->stub() != NULL && branch->stub()->is_exception_throw_stub()) { ++ LIR_OpCmpBranch* cmp_branch = op->as_OpCmpBranch(); ++ if ((branch != NULL && branch->stub() != NULL && branch->stub()->is_exception_throw_stub()) || ++ (cmp_branch != NULL && cmp_branch->stub() != NULL && cmp_branch->stub()->is_exception_throw_stub())) { + // Don't bother checking the stub in this case since the + // exception stub will never return to normal control flow. + check_live = false; +@@ -6142,6 +6170,16 @@ void ControlFlowOptimizer::substitute_branch_target(BlockBegin* block, BlockBegi + assert(op->as_OpBranch() != NULL, "branch must be of type LIR_OpBranch"); + LIR_OpBranch* branch = (LIR_OpBranch*)op; + ++ if (branch->block() == target_from) { ++ branch->change_block(target_to); ++ } ++ if (branch->ublock() == target_from) { ++ branch->change_ublock(target_to); ++ } ++ } else if (op->code() == lir_cmp_branch || op->code() == lir_cmp_float_branch) { ++ assert(op->as_OpCmpBranch() != NULL, "branch must be of type LIR_OpCmpBranch"); ++ LIR_OpCmpBranch* branch = (LIR_OpCmpBranch*)op; ++ + if (branch->block() == target_from) { + branch->change_block(target_to); + } +@@ -6252,6 +6290,20 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) { + instructions->truncate(instructions->length() - 1); + } + } ++ } else if (prev_op->code() == lir_cmp_branch || prev_op->code() == lir_cmp_float_branch) { ++ assert(prev_op->as_OpCmpBranch() != NULL, "branch must be of type LIR_OpCmpBranch"); ++ LIR_OpCmpBranch* prev_branch = (LIR_OpCmpBranch*)prev_op; ++ ++ if (prev_branch->stub() == NULL) { ++ if (prev_branch->block() == code->at(i + 1) && prev_branch->info() == NULL) { ++ TRACE_LINEAR_SCAN(3, tty->print_cr("Negating conditional branch and deleting unconditional branch at end of block B%d", block->block_id())); ++ ++ // eliminate a conditional branch to the immediate successor ++ prev_branch->change_block(last_branch->block()); ++ prev_branch->negate_cond(); ++ instructions->trunc_to(instructions->length() - 1); ++ } ++ } + } + } + } +@@ -6328,6 +6380,13 @@ void ControlFlowOptimizer::verify(BlockList* code) { + assert(op_branch->block() == NULL || code->index_of(op_branch->block()) != -1, "branch target not valid"); + assert(op_branch->ublock() == NULL || code->index_of(op_branch->ublock()) != -1, "branch target not valid"); + } ++ ++ LIR_OpCmpBranch* op_cmp_branch = instructions->at(j)->as_OpCmpBranch(); ++ ++ if (op_cmp_branch != NULL) { ++ assert(op_cmp_branch->block() == NULL || code->find(op_cmp_branch->block()) != -1, "branch target not valid"); ++ assert(op_cmp_branch->ublock() == NULL || code->find(op_cmp_branch->ublock()) != -1, "branch target not valid"); ++ } + } + + for (j = 0; j < block->number_of_sux() - 1; j++) { +@@ -6571,6 +6630,24 @@ void LinearScanStatistic::collect(LinearScan* allocator) { + break; + } + ++ case lir_cmp_branch: ++ case lir_cmp_float_branch: { ++ LIR_OpCmpBranch* branch = op->as_OpCmpBranch(); ++ if (branch->block() == NULL) { ++ inc_counter(counter_stub_branch); ++ } else { ++ inc_counter(counter_cond_branch); ++ } ++ inc_counter(counter_cmp); ++ break; ++ } ++ ++ case lir_cmp_cmove: { ++ inc_counter(counter_misc_inst); ++ inc_counter(counter_cmp); ++ break; ++ } ++ + case lir_neg: + case lir_add: + case lir_sub: +diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.hpp b/hotspot/src/share/vm/c1/c1_LinearScan.hpp +index 96e6b3babf..576a07d73d 100644 +--- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp ++++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2022. These ++ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #ifndef SHARE_VM_C1_C1_LINEARSCAN_HPP + #define SHARE_VM_C1_C1_LINEARSCAN_HPP + +@@ -976,6 +982,9 @@ class LinearScanTimers : public StackObj { + #ifdef TARGET_ARCH_x86 + # include "c1_LinearScan_x86.hpp" + #endif ++#ifdef TARGET_ARCH_loongarch ++# include "c1_LinearScan_loongarch.hpp" ++#endif + #ifdef TARGET_ARCH_aarch64 + # include "c1_LinearScan_aarch64.hpp" + #endif +diff --git a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp +index 7e22bbaa27..12aca7bf50 100644 +--- a/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp ++++ b/hotspot/src/share/vm/c1/c1_MacroAssembler.hpp @@ -22,6 +22,12 @@ * */ @@ -112466,7 +112938,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_C1_C1_MACROASSEMBLER_HPP #define SHARE_VM_C1_C1_MACROASSEMBLER_HPP -@@ -50,6 +56,9 @@ +@@ -50,6 +56,9 @@ class C1_MacroAssembler: public MacroAssembler { #ifdef TARGET_ARCH_x86 # include "c1_MacroAssembler_x86.hpp" #endif @@ -112476,9 +112948,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "c1_MacroAssembler_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp ---- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp 2023-12-20 09:23:19.918146502 +0800 +diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp +index aebc377527..f1253506f6 100644 +--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp ++++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -22,6 +22,12 @@ * */ @@ -112492,7 +112965,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "c1/c1_CodeStubs.hpp" -@@ -710,6 +716,7 @@ +@@ -710,6 +716,7 @@ JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread)) // Return to the now deoptimized frame. JRT_END @@ -112500,7 +112973,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp static Klass* resolve_field_return_klass(methodHandle caller, int bci, TRAPS) { Bytecode_field field_access(caller, bci); -@@ -1186,6 +1193,47 @@ +@@ -1186,6 +1193,47 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i } JRT_END @@ -112548,9 +113021,37 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // // Entry point for compiled code. We want to patch a nmethod. // We don't do a normal VM transition here because we want to -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp ---- a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp 2023-12-20 09:23:19.924813093 +0800 +diff --git a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp +index 8f7f9f61c9..0e2d926bdf 100644 +--- a/hotspot/src/share/vm/c1/c1_globals.hpp ++++ b/hotspot/src/share/vm/c1/c1_globals.hpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2022. These ++ * modifications are Copyright (c) 2015, 2022, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #ifndef SHARE_VM_C1_C1_GLOBALS_HPP + #define SHARE_VM_C1_C1_GLOBALS_HPP + +@@ -29,6 +35,9 @@ + #ifdef TARGET_ARCH_x86 + # include "c1_globals_x86.hpp" + #endif ++#ifdef TARGET_ARCH_loongarch ++# include "c1_globals_loongarch.hpp" ++#endif + #ifdef TARGET_ARCH_aarch64 + # include "c1_globals_aarch64.hpp" + #endif +diff --git a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp +index f067419ffc..5aa19dc84f 100644 +--- a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp ++++ b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp @@ -22,6 +22,12 @@ * */ @@ -112577,9 +113078,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_sparc # include "bytes_sparc.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/classfile/classFileStream.hpp b/hotspot/src/share/vm/classfile/classFileStream.hpp ---- a/hotspot/src/share/vm/classfile/classFileStream.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/classfile/classFileStream.hpp 2023-12-20 09:23:19.928146388 +0800 +diff --git a/hotspot/src/share/vm/classfile/classFileStream.hpp b/hotspot/src/share/vm/classfile/classFileStream.hpp +index 9632c8c8c2..fad25c44fc 100644 +--- a/hotspot/src/share/vm/classfile/classFileStream.hpp ++++ b/hotspot/src/share/vm/classfile/classFileStream.hpp @@ -22,6 +22,12 @@ * */ @@ -112606,9 +113108,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytes_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/classfile/stackMapTable.hpp b/hotspot/src/share/vm/classfile/stackMapTable.hpp ---- a/hotspot/src/share/vm/classfile/stackMapTable.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/classfile/stackMapTable.hpp 2023-12-20 09:23:19.931479683 +0800 +diff --git a/hotspot/src/share/vm/classfile/stackMapTable.hpp b/hotspot/src/share/vm/classfile/stackMapTable.hpp +index a36a7ba3cf..d7c1f08644 100644 +--- a/hotspot/src/share/vm/classfile/stackMapTable.hpp ++++ b/hotspot/src/share/vm/classfile/stackMapTable.hpp @@ -22,6 +22,12 @@ * */ @@ -112635,9 +113138,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytes_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp ---- a/hotspot/src/share/vm/classfile/verifier.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/classfile/verifier.cpp 2024-01-30 13:54:24.836041846 +0800 +diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp +index 2dddd1fded..4a20d15f31 100644 +--- a/hotspot/src/share/vm/classfile/verifier.cpp ++++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -22,6 +22,12 @@ * */ @@ -112664,9 +113168,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytes_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp ---- a/hotspot/src/share/vm/code/codeBlob.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/code/codeBlob.cpp 2023-12-20 09:23:19.931479683 +0800 +diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp +index aff2aaf0ca..9ba76007cd 100644 +--- a/hotspot/src/share/vm/code/codeBlob.cpp ++++ b/hotspot/src/share/vm/code/codeBlob.cpp @@ -22,6 +22,12 @@ * */ @@ -112693,9 +113198,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef COMPILER1 #include "c1/c1_Runtime1.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp ---- a/hotspot/src/share/vm/code/compiledIC.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/code/compiledIC.hpp 2023-12-20 09:23:19.934812978 +0800 +diff --git a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp +index f910f11886..e282a3f3af 100644 +--- a/hotspot/src/share/vm/code/compiledIC.hpp ++++ b/hotspot/src/share/vm/code/compiledIC.hpp @@ -22,6 +22,12 @@ * */ @@ -112722,9 +113228,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp //----------------------------------------------------------------------------- // The CompiledIC represents a compiled inline cache. -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/code/relocInfo.hpp b/hotspot/src/share/vm/code/relocInfo.hpp ---- a/hotspot/src/share/vm/code/relocInfo.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/code/relocInfo.hpp 2023-12-20 09:23:19.934812978 +0800 +diff --git a/hotspot/src/share/vm/code/relocInfo.hpp b/hotspot/src/share/vm/code/relocInfo.hpp +index ad55a2fd93..813504821d 100644 +--- a/hotspot/src/share/vm/code/relocInfo.hpp ++++ b/hotspot/src/share/vm/code/relocInfo.hpp @@ -22,6 +22,12 @@ * */ @@ -112738,7 +113245,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_CODE_RELOCINFO_HPP #define SHARE_VM_CODE_RELOCINFO_HPP -@@ -261,7 +267,11 @@ +@@ -261,7 +267,11 @@ class relocInfo VALUE_OBJ_CLASS_SPEC { poll_return_type = 11, // polling instruction for safepoints at return metadata_type = 12, // metadata that used to be oops trampoline_stub_type = 13, // stub-entry for trampoline @@ -112750,7 +113257,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp data_prefix_tag = 15, // tag for a prefix (carries data arguments) type_mask = 15 // A mask which selects only the above values }; -@@ -288,6 +298,7 @@ +@@ -288,6 +298,7 @@ class relocInfo VALUE_OBJ_CLASS_SPEC { ; #endif @@ -112758,7 +113265,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #define APPLY_TO_RELOCATIONS(visitor) \ visitor(oop) \ visitor(metadata) \ -@@ -300,9 +311,26 @@ +@@ -300,9 +311,26 @@ class relocInfo VALUE_OBJ_CLASS_SPEC { visitor(internal_word) \ visitor(poll) \ visitor(poll_return) \ @@ -112786,20 +113293,20 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp public: enum { -@@ -433,6 +461,12 @@ +@@ -432,6 +460,12 @@ class relocInfo VALUE_OBJ_CLASS_SPEC { + #endif #ifdef TARGET_ARCH_ppc # include "relocInfo_ppc.hpp" - #endif ++#endif +#ifdef TARGET_ARCH_mips +# include "relocInfo_mips.hpp" +#endif +#ifdef TARGET_ARCH_loongarch +# include "relocInfo_loongarch.hpp" -+#endif + #endif - protected: -@@ -1024,6 +1058,15 @@ +@@ -1024,6 +1058,15 @@ class metadata_Relocation : public DataRelocation { // Note: metadata_value transparently converts Universe::non_metadata_word to NULL. }; @@ -112815,9 +113322,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp class virtual_call_Relocation : public CallRelocation { relocInfo::relocType type() { return relocInfo::virtual_call_type; } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/code/vmreg.hpp b/hotspot/src/share/vm/code/vmreg.hpp ---- a/hotspot/src/share/vm/code/vmreg.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/code/vmreg.hpp 2023-12-20 09:23:19.938146274 +0800 +diff --git a/hotspot/src/share/vm/code/vmreg.hpp b/hotspot/src/share/vm/code/vmreg.hpp +index 07b595b60a..5bc7131a8a 100644 +--- a/hotspot/src/share/vm/code/vmreg.hpp ++++ b/hotspot/src/share/vm/code/vmreg.hpp @@ -22,6 +22,12 @@ * */ @@ -112844,7 +113352,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif //------------------------------VMReg------------------------------------------ -@@ -158,6 +170,12 @@ +@@ -158,6 +170,12 @@ public: #ifdef TARGET_ARCH_x86 # include "vmreg_x86.hpp" #endif @@ -112857,9 +113365,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "vmreg_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp ---- a/hotspot/src/share/vm/compiler/disassembler.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/compiler/disassembler.cpp 2023-12-20 09:23:19.938146274 +0800 +diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp +index dfdd5f77e7..2dd0ff69ac 100644 +--- a/hotspot/src/share/vm/compiler/disassembler.cpp ++++ b/hotspot/src/share/vm/compiler/disassembler.cpp @@ -22,6 +22,12 @@ * */ @@ -112886,9 +113395,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef SHARK #include "shark/sharkEntry.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/compiler/disassembler.hpp b/hotspot/src/share/vm/compiler/disassembler.hpp ---- a/hotspot/src/share/vm/compiler/disassembler.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/compiler/disassembler.hpp 2023-12-20 09:23:19.938146274 +0800 +diff --git a/hotspot/src/share/vm/compiler/disassembler.hpp b/hotspot/src/share/vm/compiler/disassembler.hpp +index 168851cc26..8b632748f2 100644 +--- a/hotspot/src/share/vm/compiler/disassembler.hpp ++++ b/hotspot/src/share/vm/compiler/disassembler.hpp @@ -22,6 +22,12 @@ * */ @@ -112902,23 +113412,24 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_COMPILER_DISASSEMBLER_HPP #define SHARE_VM_COMPILER_DISASSEMBLER_HPP -@@ -96,6 +102,12 @@ +@@ -95,6 +101,12 @@ class Disassembler { + #endif #ifdef TARGET_ARCH_ppc # include "disassembler_ppc.hpp" - #endif ++#endif +#ifdef TARGET_ARCH_mips +# include "disassembler_mips.hpp" +#endif +#ifdef TARGET_ARCH_loongarch +# include "disassembler_loongarch.hpp" -+#endif + #endif - public: -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp 2023-12-20 09:23:19.958146045 +0800 -@@ -86,6 +86,9 @@ +diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp +index 733b5c91ad..678a1ee836 100644 +--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp ++++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp +@@ -86,6 +86,9 @@ class CardTableExtension : public CardTableModRefBS { void inline_write_ref_field_gc(void* field, oop new_val) { jbyte* byte = byte_for(field); *byte = youngergen_card; @@ -112928,10 +113439,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } // Adaptive size policy support -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp 2023-12-20 09:23:19.958146045 +0800 -@@ -105,6 +105,9 @@ +diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp +index 1dde10746d..8b800b31c5 100644 +--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp ++++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp +@@ -105,6 +105,9 @@ ParMarkBitMap::mark_obj(HeapWord* addr, size_t size) assert(end_bit_ok, "concurrency problem"); DEBUG_ONLY(Atomic::inc_ptr(&mark_bitmap_count)); DEBUG_ONLY(Atomic::add_ptr(size, &mark_bitmap_size)); @@ -112941,10 +113453,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp return true; } return false; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp 2023-12-20 09:23:19.958146045 +0800 -@@ -33,6 +33,9 @@ +diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp +index 6cf76353d9..4d34bc209b 100644 +--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp ++++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp +@@ -33,6 +33,9 @@ void ParCompactionManager::push_objarray(oop obj, size_t index) ObjArrayTask task(obj, index); assert(task.is_valid(), "bad ObjArrayTask"); _objarray_stack.push(task); @@ -112954,7 +113467,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } void ParCompactionManager::push_region(size_t index) -@@ -44,6 +47,9 @@ +@@ -44,6 +47,9 @@ void ParCompactionManager::push_region(size_t index) assert(region_ptr->_pushed++ == 0, "should only be pushed once"); #endif region_stack()->push(index); @@ -112964,10 +113477,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2023-12-20 09:23:19.961479341 +0800 -@@ -499,6 +499,9 @@ +diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +index 0fa980ef83..2f66493e0a 100644 +--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ++++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +@@ -499,6 +499,9 @@ void ParallelCompactData::add_obj(HeapWord* addr, size_t len) if (beg_region == end_region) { // All in one region. _region_data[beg_region].add_live_obj(len); @@ -112977,7 +113491,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp return; } -@@ -517,6 +520,9 @@ +@@ -517,6 +520,9 @@ void ParallelCompactData::add_obj(HeapWord* addr, size_t len) const size_t end_ofs = region_offset(addr + len - 1); _region_data[end_region].set_partial_obj_size(end_ofs + 1); _region_data[end_region].set_partial_obj_addr(addr); @@ -112987,7 +113501,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } void -@@ -3229,6 +3235,9 @@ +@@ -3229,6 +3235,9 @@ void PSParallelCompact::fill_blocks(size_t region_idx) if (new_block != cur_block) { cur_block = new_block; sd.block(cur_block)->set_offset(bitmap->bits_to_words(live_bits)); @@ -112997,10 +113511,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } const size_t end_bit = bitmap->find_obj_end(beg_bit, range_end); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp 2023-12-20 09:23:19.961479341 +0800 -@@ -1329,6 +1329,9 @@ +diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +index 881f380cea..461b83930f 100644 +--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp ++++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +@@ -1329,6 +1329,9 @@ inline bool PSParallelCompact::mark_obj(oop obj) { const int obj_size = obj->size(); if (mark_bitmap()->mark_obj(obj, obj_size)) { _summary_data.add_obj(obj, obj_size); @@ -113010,7 +113525,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp return true; } else { return false; -@@ -1363,6 +1366,9 @@ +@@ -1363,6 +1366,9 @@ inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); if (mark_bitmap()->is_unmarked(obj) && mark_obj(obj)) { cm->push(obj); @@ -113020,10 +113535,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } } } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp 2023-12-20 09:23:19.961479341 +0800 -@@ -41,8 +41,9 @@ +diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp +index a33132009c..291019660a 100644 +--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp ++++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp +@@ -41,8 +41,9 @@ template inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) { if (p != NULL) { // XXX: error if p != NULL here oop o = oopDesc::load_decode_heap_oop_not_null(p); @@ -113035,7 +113551,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Card mark if (PSScavenge::is_obj_in_young(o)) { PSScavenge::card_table()->inline_write_ref_field_gc(p, o); -@@ -102,11 +103,19 @@ +@@ -102,11 +103,19 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) { oop new_obj = NULL; @@ -113055,7 +113571,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // The same test as "o->is_forwarded()" if (!test_mark->is_marked()) { bool new_obj_is_tenured = false; -@@ -141,6 +150,10 @@ +@@ -141,6 +150,10 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) { } } } @@ -113066,7 +113582,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } } -@@ -200,6 +213,9 @@ +@@ -200,6 +213,9 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) { // Copy obj Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)new_obj, new_obj_size); @@ -113076,7 +113592,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Now we have to CAS in the header. if (o->cas_forward_to(new_obj, test_mark)) { -@@ -247,6 +263,10 @@ +@@ -247,6 +263,10 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) { // don't update this before the unallocation! new_obj = o->forwardee(); } @@ -113087,10 +113603,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } else { assert(o->is_forwarded(), "Sanity"); new_obj = o->forwardee(); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp ---- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp 2023-12-20 09:23:19.961479341 +0800 -@@ -71,14 +71,22 @@ +diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp +index 1a722a7ca7..4980be3946 100644 +--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp ++++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp +@@ -71,14 +71,22 @@ inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm, assert(should_scavenge(p, true), "revisiting object?"); oop o = oopDesc::load_decode_heap_oop_not_null(p); @@ -113117,7 +113634,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", "forwarding", new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); -@@ -138,8 +146,9 @@ +@@ -138,8 +146,9 @@ class PSScavengeFromKlassClosure: public OopClosure { oop o = *p; oop new_obj; @@ -113129,9 +113646,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } else { new_obj = _pm->copy_to_survivor_space(o); } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp ---- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp +index e14c50bf01..8b3860070c 100644 +--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp ++++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp @@ -22,6 +22,12 @@ * */ @@ -113156,9 +113674,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif // This file contains the platform-independent parts -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/bytecode.hpp b/hotspot/src/share/vm/interpreter/bytecode.hpp ---- a/hotspot/src/share/vm/interpreter/bytecode.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/bytecode.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/bytecode.hpp b/hotspot/src/share/vm/interpreter/bytecode.hpp +index 7e55fd009a..a06dcd58bc 100644 +--- a/hotspot/src/share/vm/interpreter/bytecode.hpp ++++ b/hotspot/src/share/vm/interpreter/bytecode.hpp @@ -22,6 +22,12 @@ * */ @@ -113185,9 +113704,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytes_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp ---- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp +index 28843715c7..c17fe8d7e0 100644 +--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp ++++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp @@ -22,6 +22,12 @@ * */ @@ -113211,7 +113731,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytes_aarch64.hpp" #endif -@@ -592,6 +601,12 @@ +@@ -592,6 +601,12 @@ void print(); #ifdef TARGET_ARCH_x86 # include "bytecodeInterpreter_x86.hpp" #endif @@ -113224,9 +113744,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytecodeInterpreter_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp ---- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp +index f5db0b4d9d..8adbf95acb 100644 +--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp ++++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp @@ -22,6 +22,12 @@ * */ @@ -113253,9 +113774,40 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytecodeInterpreter_aarch64.inline.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/bytecodes.cpp b/hotspot/src/share/vm/interpreter/bytecodes.cpp ---- a/hotspot/src/share/vm/interpreter/bytecodes.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/bytecodes.cpp 2024-01-30 13:54:24.866041540 +0800 +diff --git a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp +index b814b88d5d..e1f2421600 100644 +--- a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp ++++ b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2020. These ++ * modifications are Copyright (c) 2015, 2020, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #ifndef SHARE_VM_INTERPRETER_BYTECODESTREAM_HPP + #define SHARE_VM_INTERPRETER_BYTECODESTREAM_HPP + +@@ -32,6 +38,12 @@ + #ifdef TARGET_ARCH_x86 + # include "bytes_x86.hpp" + #endif ++#ifdef TARGET_ARCH_mips ++# include "bytes_mips.hpp" ++#endif ++#ifdef TARGET_ARCH_loongarch ++# include "bytes_loongarch.hpp" ++#endif + #ifdef TARGET_ARCH_aarch64 + # include "bytes_aarch64.hpp" + #endif +diff --git a/hotspot/src/share/vm/interpreter/bytecodes.cpp b/hotspot/src/share/vm/interpreter/bytecodes.cpp +index ce5632ea19..7f8e880199 100644 +--- a/hotspot/src/share/vm/interpreter/bytecodes.cpp ++++ b/hotspot/src/share/vm/interpreter/bytecodes.cpp @@ -22,6 +22,12 @@ * */ @@ -113282,9 +113834,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytes_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/bytecodes.hpp b/hotspot/src/share/vm/interpreter/bytecodes.hpp ---- a/hotspot/src/share/vm/interpreter/bytecodes.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/bytecodes.hpp b/hotspot/src/share/vm/interpreter/bytecodes.hpp +index c3463cd76d..bdf4c487f0 100644 +--- a/hotspot/src/share/vm/interpreter/bytecodes.hpp ++++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp @@ -22,6 +22,12 @@ * */ @@ -113298,7 +113851,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_INTERPRETER_BYTECODES_HPP #define SHARE_VM_INTERPRETER_BYTECODES_HPP -@@ -292,6 +298,12 @@ +@@ -292,6 +298,12 @@ class Bytecodes: AllStatic { #ifdef TARGET_ARCH_x86 # include "bytecodes_x86.hpp" #endif @@ -113311,9 +113864,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "bytecodes_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp ---- a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp +index 6a6447503c..f9c540fb4a 100644 +--- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp ++++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp @@ -22,6 +22,12 @@ * */ @@ -113324,25 +113878,26 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * available on the same license terms set forth above. + */ + - #ifndef SHARE_VM_INTERPRETER_BYTECODESTREAM_HPP - #define SHARE_VM_INTERPRETER_BYTECODESTREAM_HPP + #ifndef SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP + #define SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP -@@ -32,6 +38,12 @@ +@@ -84,6 +90,12 @@ class CppInterpreter: public AbstractInterpreter { #ifdef TARGET_ARCH_x86 - # include "bytes_x86.hpp" + # include "cppInterpreter_x86.hpp" #endif +#ifdef TARGET_ARCH_mips -+# include "bytes_mips.hpp" ++# include "cppInterpreter_mips.hpp" +#endif +#ifdef TARGET_ARCH_loongarch -+# include "bytes_loongarch.hpp" ++# include "cppInterpreter_loongarch.hpp" +#endif #ifdef TARGET_ARCH_aarch64 - # include "bytes_aarch64.hpp" + # include "cppInterpreter_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp ---- a/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp +index 6a08a3f43f..1fd19994d7 100644 +--- a/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp ++++ b/hotspot/src/share/vm/interpreter/cppInterpreterGenerator.hpp @@ -22,6 +22,12 @@ * */ @@ -113356,7 +113911,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_INTERPRETER_CPPINTERPRETERGENERATOR_HPP #define SHARE_VM_INTERPRETER_CPPINTERPRETERGENERATOR_HPP -@@ -50,6 +56,12 @@ +@@ -50,6 +56,12 @@ class CppInterpreterGenerator: public AbstractInterpreterGenerator { #ifdef TARGET_ARCH_x86 # include "cppInterpreterGenerator_x86.hpp" #endif @@ -113369,9 +113924,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "cppInterpreterGenerator_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp ---- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/interpreter.hpp b/hotspot/src/share/vm/interpreter/interpreter.hpp +index ebfb68d36b..610949f3f7 100644 +--- a/hotspot/src/share/vm/interpreter/interpreter.hpp ++++ b/hotspot/src/share/vm/interpreter/interpreter.hpp @@ -22,6 +22,12 @@ * */ @@ -113382,25 +113938,26 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * available on the same license terms set forth above. + */ + - #ifndef SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP - #define SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP + #ifndef SHARE_VM_INTERPRETER_INTERPRETER_HPP + #define SHARE_VM_INTERPRETER_INTERPRETER_HPP -@@ -84,6 +90,12 @@ +@@ -148,6 +154,12 @@ class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateI #ifdef TARGET_ARCH_x86 - # include "cppInterpreter_x86.hpp" + # include "interpreter_x86.hpp" #endif +#ifdef TARGET_ARCH_mips -+# include "cppInterpreter_mips.hpp" ++# include "interpreter_mips.hpp" +#endif +#ifdef TARGET_ARCH_loongarch -+# include "cppInterpreter_loongarch.hpp" ++# include "interpreter_loongarch.hpp" +#endif #ifdef TARGET_ARCH_aarch64 - # include "cppInterpreter_aarch64.hpp" + # include "interpreter_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp ---- a/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp +index 1dc7cb2983..92bbe6b440 100644 +--- a/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp ++++ b/hotspot/src/share/vm/interpreter/interpreterGenerator.hpp @@ -22,6 +22,12 @@ * */ @@ -113414,7 +113971,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_INTERPRETER_INTERPRETERGENERATOR_HPP #define SHARE_VM_INTERPRETER_INTERPRETERGENERATOR_HPP -@@ -44,6 +50,12 @@ +@@ -44,6 +50,12 @@ InterpreterGenerator(StubQueue* _code); #ifdef TARGET_ARCH_x86 # include "interpreterGenerator_x86.hpp" #endif @@ -113427,38 +113984,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "interpreterGenerator_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/interpreter.hpp b/hotspot/src/share/vm/interpreter/interpreter.hpp ---- a/hotspot/src/share/vm/interpreter/interpreter.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/interpreter.hpp 2023-12-20 09:23:19.968145932 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2020. These -+ * modifications are Copyright (c) 2015, 2020, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #ifndef SHARE_VM_INTERPRETER_INTERPRETER_HPP - #define SHARE_VM_INTERPRETER_INTERPRETER_HPP - -@@ -148,6 +154,12 @@ - #ifdef TARGET_ARCH_x86 - # include "interpreter_x86.hpp" - #endif -+#ifdef TARGET_ARCH_mips -+# include "interpreter_mips.hpp" -+#endif -+#ifdef TARGET_ARCH_loongarch -+# include "interpreter_loongarch.hpp" -+#endif - #ifdef TARGET_ARCH_aarch64 - # include "interpreter_aarch64.hpp" - #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp ---- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp +index cad9d29008..85303e4b73 100644 +--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp ++++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp @@ -22,6 +22,12 @@ * */ @@ -113485,7 +114014,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "vm_version_aarch64.hpp" #endif -@@ -1290,7 +1302,7 @@ +@@ -1290,7 +1302,7 @@ IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, Meth // preparing the same method will be sure to see non-null entry & mirror. IRT_END @@ -113494,9 +114023,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp IRT_LEAF(void, InterpreterRuntime::popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address)) if (src_address == dest_address) { return; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp ---- a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp 2023-12-20 09:23:19.968145932 +0800 +diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp +index 472bf4d94c..9a98d5559c 100644 +--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp ++++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp @@ -22,6 +22,12 @@ * */ @@ -113510,7 +114040,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_INTERPRETER_INTERPRETERRUNTIME_HPP #define SHARE_VM_INTERPRETER_INTERPRETERRUNTIME_HPP -@@ -156,7 +162,7 @@ +@@ -156,7 +162,7 @@ class InterpreterRuntime: AllStatic { Method* method, intptr_t* from, intptr_t* to); @@ -113519,7 +114049,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Popframe support (only needed on x86, AMD64 and ARM) static void popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address); #endif -@@ -165,6 +171,12 @@ +@@ -165,6 +171,12 @@ class InterpreterRuntime: AllStatic { #ifdef TARGET_ARCH_x86 # include "interpreterRT_x86.hpp" #endif @@ -113532,9 +114062,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "interpreterRT_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp ---- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp 2023-12-20 09:23:19.971479225 +0800 +diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp +index 5f76dca8a6..757860f43c 100644 +--- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp ++++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp @@ -22,6 +22,12 @@ * */ @@ -113545,25 +114076,26 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * available on the same license terms set forth above. + */ + - #ifndef SHARE_VM_INTERPRETER_TEMPLATEINTERPRETERGENERATOR_HPP - #define SHARE_VM_INTERPRETER_TEMPLATEINTERPRETERGENERATOR_HPP + #ifndef SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP + #define SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP -@@ -89,6 +95,12 @@ +@@ -190,6 +196,12 @@ class TemplateInterpreter: public AbstractInterpreter { #ifdef TARGET_ARCH_x86 - # include "templateInterpreterGenerator_x86.hpp" + # include "templateInterpreter_x86.hpp" #endif +#ifdef TARGET_ARCH_mips -+# include "templateInterpreterGenerator_mips.hpp" ++# include "templateInterpreter_mips.hpp" +#endif +#ifdef TARGET_ARCH_loongarch -+# include "templateInterpreterGenerator_loongarch.hpp" ++# include "templateInterpreter_loongarch.hpp" +#endif #ifdef TARGET_ARCH_aarch64 - # include "templateInterpreterGenerator_aarch64.hpp" + # include "templateInterpreter_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp ---- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp 2023-12-20 09:23:19.971479225 +0800 +diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp +index bd94bd02bc..28ca437eb2 100644 +--- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp ++++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp @@ -22,6 +22,12 @@ * */ @@ -113574,25 +114106,26 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * available on the same license terms set forth above. + */ + - #ifndef SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP - #define SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP + #ifndef SHARE_VM_INTERPRETER_TEMPLATEINTERPRETERGENERATOR_HPP + #define SHARE_VM_INTERPRETER_TEMPLATEINTERPRETERGENERATOR_HPP -@@ -190,6 +196,12 @@ +@@ -89,6 +95,12 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator { #ifdef TARGET_ARCH_x86 - # include "templateInterpreter_x86.hpp" + # include "templateInterpreterGenerator_x86.hpp" #endif +#ifdef TARGET_ARCH_mips -+# include "templateInterpreter_mips.hpp" ++# include "templateInterpreterGenerator_mips.hpp" +#endif +#ifdef TARGET_ARCH_loongarch -+# include "templateInterpreter_loongarch.hpp" ++# include "templateInterpreterGenerator_loongarch.hpp" +#endif #ifdef TARGET_ARCH_aarch64 - # include "templateInterpreter_aarch64.hpp" + # include "templateInterpreterGenerator_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp ---- a/hotspot/src/share/vm/interpreter/templateTable.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/interpreter/templateTable.hpp 2023-12-20 09:23:19.971479225 +0800 +diff --git a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp +index 60d243c16a..1b73822abd 100644 +--- a/hotspot/src/share/vm/interpreter/templateTable.hpp ++++ b/hotspot/src/share/vm/interpreter/templateTable.hpp @@ -22,6 +22,12 @@ * */ @@ -113617,7 +114150,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif #ifndef CC_INTERP -@@ -367,6 +377,10 @@ +@@ -367,6 +377,10 @@ class TemplateTable: AllStatic { # include "templateTable_zero.hpp" #elif defined TARGET_ARCH_MODEL_ppc_64 # include "templateTable_ppc_64.hpp" @@ -113628,10 +114161,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif }; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/jfr/utilities/jfrBigEndian.hpp b/hotspot/src/share/vm/jfr/utilities/jfrBigEndian.hpp ---- a/hotspot/src/share/vm/jfr/utilities/jfrBigEndian.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/jfr/utilities/jfrBigEndian.hpp 2023-12-20 09:23:19.984812406 +0800 -@@ -116,7 +116,7 @@ +diff --git a/hotspot/src/share/vm/jfr/utilities/jfrBigEndian.hpp b/hotspot/src/share/vm/jfr/utilities/jfrBigEndian.hpp +index 6d9ab39fdd..f4e9a4ca69 100644 +--- a/hotspot/src/share/vm/jfr/utilities/jfrBigEndian.hpp ++++ b/hotspot/src/share/vm/jfr/utilities/jfrBigEndian.hpp +@@ -116,7 +116,7 @@ inline T JfrBigEndian::read_unaligned(const address location) { inline bool JfrBigEndian::platform_supports_unaligned_reads(void) { #if defined(IA32) || defined(AMD64) || defined(PPC) || defined(S390) return true; @@ -113640,9 +114174,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp return false; #else #warning "Unconfigured platform" -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/jfr/writers/jfrEncoders.hpp b/hotspot/src/share/vm/jfr/writers/jfrEncoders.hpp ---- a/hotspot/src/share/vm/jfr/writers/jfrEncoders.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/jfr/writers/jfrEncoders.hpp 2023-12-20 09:23:19.984812406 +0800 +diff --git a/hotspot/src/share/vm/jfr/writers/jfrEncoders.hpp b/hotspot/src/share/vm/jfr/writers/jfrEncoders.hpp +index 42a8b719cd..f08f6ee13a 100644 +--- a/hotspot/src/share/vm/jfr/writers/jfrEncoders.hpp ++++ b/hotspot/src/share/vm/jfr/writers/jfrEncoders.hpp @@ -22,6 +22,12 @@ * */ @@ -113669,9 +114204,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // // The Encoding policy prescribes a template -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/memory/barrierSet.hpp b/hotspot/src/share/vm/memory/barrierSet.hpp ---- a/hotspot/src/share/vm/memory/barrierSet.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/memory/barrierSet.hpp 2023-12-20 09:23:19.988145701 +0800 +diff --git a/hotspot/src/share/vm/memory/barrierSet.hpp b/hotspot/src/share/vm/memory/barrierSet.hpp +index 13ff9b2738..081b70744d 100644 +--- a/hotspot/src/share/vm/memory/barrierSet.hpp ++++ b/hotspot/src/share/vm/memory/barrierSet.hpp @@ -27,6 +27,7 @@ #include "memory/memRegion.hpp" @@ -113680,7 +114216,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // This class provides the interface between a barrier implementation and // the rest of the system. -@@ -95,8 +96,16 @@ +@@ -95,8 +96,16 @@ private: // Keep this private so as to catch violations at build time. virtual void write_ref_field_pre_work( void* field, oop new_val) { guarantee(false, "Not needed"); }; protected: @@ -113699,7 +114235,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp public: // ...then the post-write version. -@@ -132,9 +141,17 @@ +@@ -132,9 +141,17 @@ public: // Below length is the # array elements being written virtual void write_ref_array_pre(oop* dst, int length, @@ -113719,10 +114255,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Below count is the # array elements being written, starting // at the address "start", which may not necessarily be HeapWord-aligned inline void write_ref_array(HeapWord* start, size_t count); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp ---- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp 2023-12-20 09:23:19.988145701 +0800 -@@ -316,6 +316,9 @@ +diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +index 01e4688836..80bd151873 100644 +--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp ++++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +@@ -316,6 +316,9 @@ public: inline void inline_write_ref_array(MemRegion mr) { dirty_MemRegion(mr); @@ -113732,7 +114269,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } protected: void write_ref_array_work(MemRegion mr) { -@@ -329,7 +332,11 @@ +@@ -329,7 +332,11 @@ public: // *** Card-table-barrier-specific things. @@ -113745,7 +114282,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp template inline void inline_write_ref_field(T* field, oop newVal, bool release) { jbyte* byte = byte_for((void*)field); -@@ -339,6 +346,9 @@ +@@ -339,6 +346,9 @@ public: } else { *byte = dirty_card; } @@ -113755,10 +114292,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } // These are used by G1, when it uses the card table as a temporary data -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp ---- a/hotspot/src/share/vm/memory/cardTableRS.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp 2023-12-20 09:23:19.988145701 +0800 -@@ -252,6 +252,9 @@ +diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp +index fb33a708ae..da22acba47 100644 +--- a/hotspot/src/share/vm/memory/cardTableRS.cpp ++++ b/hotspot/src/share/vm/memory/cardTableRS.cpp +@@ -252,6 +252,9 @@ void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) { // cur_youngergen_and_prev_nonclean_card ==> no change. void CardTableRS::write_ref_field_gc_par(void* field, oop new_val) { jbyte* entry = ct_bs()->byte_for(field); @@ -113768,7 +114306,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp do { jbyte entry_val = *entry; // We put this first because it's probably the most common case. -@@ -266,7 +269,12 @@ +@@ -266,7 +269,12 @@ void CardTableRS::write_ref_field_gc_par(void* field, oop new_val) { jbyte new_val = cur_youngergen_and_prev_nonclean_card; jbyte res = Atomic::cmpxchg(new_val, entry, entry_val); // Did the CAS succeed? @@ -113782,10 +114320,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Otherwise, retry, to see the new value. continue; } else { -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp ---- a/hotspot/src/share/vm/memory/cardTableRS.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/memory/cardTableRS.hpp 2023-12-20 09:23:19.988145701 +0800 -@@ -121,7 +121,14 @@ +diff --git a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp +index 25884feac8..5d4e77f269 100644 +--- a/hotspot/src/share/vm/memory/cardTableRS.hpp ++++ b/hotspot/src/share/vm/memory/cardTableRS.hpp +@@ -121,7 +121,14 @@ public: void inline_write_ref_field_gc(void* field, oop new_val) { jbyte* byte = _ct_bs->byte_for(field); @@ -113801,9 +114340,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } void write_ref_field_gc_work(void* field, oop new_val) { inline_write_ref_field_gc(field, new_val); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp ---- a/hotspot/src/share/vm/memory/metaspace.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/memory/metaspace.cpp 2023-12-20 09:23:19.991478997 +0800 +diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp +index fb0564ac27..9cec7d4375 100644 +--- a/hotspot/src/share/vm/memory/metaspace.cpp ++++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -21,6 +21,13 @@ * questions. * @@ -113818,7 +114358,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "precompiled.hpp" #include "gc_interface/collectedHeap.hpp" #include "memory/allocation.hpp" -@@ -3065,12 +3072,12 @@ +@@ -3065,12 +3072,12 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a // Don't use large pages for the class space. bool large_pages = false; @@ -113833,7 +114373,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp ReservedSpace metaspace_rs; // Our compressed klass pointers may fit nicely into the lower 32 -@@ -3107,7 +3114,7 @@ +@@ -3107,7 +3114,7 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a } } @@ -113842,9 +114382,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp if (!metaspace_rs.is_reserved()) { #if INCLUDE_CDS -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp ---- a/hotspot/src/share/vm/oops/constantPool.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/oops/constantPool.hpp 2023-12-20 09:23:19.998145587 +0800 +diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp +index 635bf6d1bc..18822d9fcf 100644 +--- a/hotspot/src/share/vm/oops/constantPool.hpp ++++ b/hotspot/src/share/vm/oops/constantPool.hpp @@ -22,6 +22,12 @@ * */ @@ -113872,9 +114413,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // A constantPool is an array containing class constants as described in the // class file. -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/oops/klass.hpp b/hotspot/src/share/vm/oops/klass.hpp ---- a/hotspot/src/share/vm/oops/klass.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/oops/klass.hpp 2023-12-20 09:23:20.001478882 +0800 +diff --git a/hotspot/src/share/vm/oops/klass.hpp b/hotspot/src/share/vm/oops/klass.hpp +index acef334849..23fc0b9988 100644 +--- a/hotspot/src/share/vm/oops/klass.hpp ++++ b/hotspot/src/share/vm/oops/klass.hpp @@ -32,6 +32,9 @@ #include "oops/klassPS.hpp" #include "oops/metadata.hpp" @@ -113885,7 +114427,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "utilities/accessFlags.hpp" #include "utilities/macros.hpp" #if INCLUDE_ALL_GCS -@@ -289,8 +292,18 @@ +@@ -289,8 +292,18 @@ protected: // The Klasses are not placed in the Heap, so the Card Table or // the Mod Union Table can't be used to mark when klasses have modified oops. // The CT and MUT bits saves this information for the individual Klasses. @@ -113906,10 +114448,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp bool has_modified_oops() { return _modified_oops == 1; } void accumulate_modified_oops() { if (has_modified_oops()) _accumulated_modified_oops = 1; } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/oops/oop.hpp b/hotspot/src/share/vm/oops/oop.hpp ---- a/hotspot/src/share/vm/oops/oop.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/oops/oop.hpp 2023-12-20 09:23:20.001478882 +0800 -@@ -72,7 +72,13 @@ +diff --git a/hotspot/src/share/vm/oops/oop.hpp b/hotspot/src/share/vm/oops/oop.hpp +index 0678c6b3fb..1cb20e351f 100644 +--- a/hotspot/src/share/vm/oops/oop.hpp ++++ b/hotspot/src/share/vm/oops/oop.hpp +@@ -72,7 +72,13 @@ class oopDesc { markOop mark() const { return _mark; } markOop* mark_addr() const { return (markOop*) &_mark; } @@ -113924,9 +114467,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp void release_set_mark(markOop m); markOop cas_set_mark(markOop new_mark, markOop old_mark); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp ---- a/hotspot/src/share/vm/oops/oop.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/oops/oop.inline.hpp 2023-12-20 09:23:20.001478882 +0800 +diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp +index beec739d38..8660c1e331 100644 +--- a/hotspot/src/share/vm/oops/oop.inline.hpp ++++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -22,6 +22,12 @@ * */ @@ -113953,9 +114497,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Implementation of all inlined member functions defined in oop.hpp // We need a separate file to avoid circular references -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp ---- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp 2023-12-20 09:23:20.001478882 +0800 +diff --git a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp +index 8a4603944e..b28bb99189 100644 +--- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp ++++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp @@ -22,6 +22,12 @@ * */ @@ -113969,7 +114514,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP #define SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP -@@ -75,7 +81,7 @@ +@@ -75,7 +81,7 @@ inline oop oopDesc::forward_to_atomic(oop p) { // forwarding pointer. oldMark = curMark; } @@ -113978,9 +114523,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/buildOopMap.cpp b/hotspot/src/share/vm/opto/buildOopMap.cpp ---- a/hotspot/src/share/vm/opto/buildOopMap.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/buildOopMap.cpp 2023-12-20 09:23:20.004812178 +0800 +diff --git a/hotspot/src/share/vm/opto/buildOopMap.cpp b/hotspot/src/share/vm/opto/buildOopMap.cpp +index 91642f1d7d..5df185df04 100644 +--- a/hotspot/src/share/vm/opto/buildOopMap.cpp ++++ b/hotspot/src/share/vm/opto/buildOopMap.cpp @@ -22,6 +22,12 @@ * */ @@ -114007,10 +114553,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // The functions in this file builds OopMaps after all scheduling is done. // -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp ---- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp 2023-12-20 09:23:20.004812178 +0800 -@@ -361,9 +361,20 @@ +diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp +index 7fd615d35f..ad472e8722 100644 +--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp ++++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp +@@ -361,9 +361,20 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, } else if (forced_inline()) { // Inlining was forced by CompilerOracle, ciReplay or annotation } else if (profile.count() == 0) { @@ -114031,36 +114578,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp ---- a/hotspot/src/share/vm/opto/c2compiler.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/c2compiler.cpp 2023-12-20 09:23:20.004812178 +0800 -@@ -22,6 +22,12 @@ - * - */ - -+/* -+ * This file has been modified by Loongson Technology in 2020. These -+ * modifications are Copyright (c) 2015, 2020, Loongson Technology, and are made -+ * available on the same license terms set forth above. -+ */ -+ - #include "precompiled.hpp" - #include "opto/c2compiler.hpp" - #include "opto/runtime.hpp" -@@ -39,6 +45,10 @@ - # include "adfiles/ad_zero.hpp" - #elif defined TARGET_ARCH_MODEL_ppc_64 - # include "adfiles/ad_ppc_64.hpp" -+#elif defined TARGET_ARCH_MODEL_mips_64 -+# include "adfiles/ad_mips_64.hpp" -+#elif defined TARGET_ARCH_MODEL_loongarch_64 -+# include "adfiles/ad_loongarch_64.hpp" - #endif - - // register information defined by ADLC -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp ---- a/hotspot/src/share/vm/opto/c2_globals.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/c2_globals.hpp 2023-12-20 09:23:20.004812178 +0800 +diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp +index 82d2efef92..d373b20456 100644 +--- a/hotspot/src/share/vm/opto/c2_globals.hpp ++++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -22,6 +22,12 @@ * */ @@ -114087,9 +114608,38 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_arm # include "c2_globals_arm.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/chaitin.hpp b/hotspot/src/share/vm/opto/chaitin.hpp ---- a/hotspot/src/share/vm/opto/chaitin.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/chaitin.hpp 2023-12-20 09:23:20.008145473 +0800 +diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp +index 137f49600d..f689d64a38 100644 +--- a/hotspot/src/share/vm/opto/c2compiler.cpp ++++ b/hotspot/src/share/vm/opto/c2compiler.cpp +@@ -22,6 +22,12 @@ + * + */ + ++/* ++ * This file has been modified by Loongson Technology in 2020. These ++ * modifications are Copyright (c) 2015, 2020, Loongson Technology, and are made ++ * available on the same license terms set forth above. ++ */ ++ + #include "precompiled.hpp" + #include "opto/c2compiler.hpp" + #include "opto/runtime.hpp" +@@ -39,6 +45,10 @@ + # include "adfiles/ad_zero.hpp" + #elif defined TARGET_ARCH_MODEL_ppc_64 + # include "adfiles/ad_ppc_64.hpp" ++#elif defined TARGET_ARCH_MODEL_mips_64 ++# include "adfiles/ad_mips_64.hpp" ++#elif defined TARGET_ARCH_MODEL_loongarch_64 ++# include "adfiles/ad_loongarch_64.hpp" + #endif + + // register information defined by ADLC +diff --git a/hotspot/src/share/vm/opto/chaitin.hpp b/hotspot/src/share/vm/opto/chaitin.hpp +index de6d443cd3..0b27dc9335 100644 +--- a/hotspot/src/share/vm/opto/chaitin.hpp ++++ b/hotspot/src/share/vm/opto/chaitin.hpp @@ -22,6 +22,12 @@ * */ @@ -114103,7 +114653,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_OPTO_CHAITIN_HPP #define SHARE_VM_OPTO_CHAITIN_HPP -@@ -136,8 +142,12 @@ +@@ -136,8 +142,12 @@ public: // Number of registers this live range uses when it colors private: @@ -114116,7 +114666,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp public: int num_regs() const { return _num_regs; } void set_num_regs( int reg ) { assert( _num_regs == reg || !_num_regs, "" ); _num_regs = reg; } -@@ -145,7 +155,11 @@ +@@ -145,7 +155,11 @@ public: private: // Number of physical registers this live range uses when it colors // Architecture and register-set dependent @@ -114128,9 +114678,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp public: void set_reg_pressure(int i) { _reg_pressure = i; } int reg_pressure() const { return _reg_pressure; } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp ---- a/hotspot/src/share/vm/opto/compile.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/compile.cpp 2023-12-20 09:23:20.008145473 +0800 +diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp +index ae22ba84d9..9004dc0d72 100644 +--- a/hotspot/src/share/vm/opto/compile.cpp ++++ b/hotspot/src/share/vm/opto/compile.cpp @@ -22,6 +22,12 @@ * */ @@ -114155,10 +114706,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif // -------------------- Compile::mach_constant_base_node ----------------------- -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp ---- a/hotspot/src/share/vm/opto/compile.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/compile.hpp 2023-12-20 09:23:20.008145473 +0800 -@@ -1025,7 +1025,7 @@ +diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp +index b4f4cfefed..d263ee2fc4 100644 +--- a/hotspot/src/share/vm/opto/compile.hpp ++++ b/hotspot/src/share/vm/opto/compile.hpp +@@ -1025,7 +1025,7 @@ class Compile : public Phase { bool in_scratch_emit_size() const { return _in_scratch_emit_size; } enum ScratchBufferBlob { @@ -114167,9 +114719,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp MAX_locs_size = 128, // number of relocInfo elements MAX_const_size = 128, MAX_stubs_size = 128 -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp ---- a/hotspot/src/share/vm/opto/gcm.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/gcm.cpp 2023-12-20 09:23:20.011478768 +0800 +diff --git a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp +index f51484efb0..12457b7c34 100644 +--- a/hotspot/src/share/vm/opto/gcm.cpp ++++ b/hotspot/src/share/vm/opto/gcm.cpp @@ -22,6 +22,12 @@ * */ @@ -114194,9 +114747,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp ---- a/hotspot/src/share/vm/opto/lcm.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/lcm.cpp 2023-12-20 09:23:20.011478768 +0800 +diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp +index c6178a715b..2d492568d9 100644 +--- a/hotspot/src/share/vm/opto/lcm.cpp ++++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -22,6 +22,12 @@ * */ @@ -114221,9 +114775,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif // Optimization - Graph Style -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/locknode.hpp b/hotspot/src/share/vm/opto/locknode.hpp ---- a/hotspot/src/share/vm/opto/locknode.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/locknode.hpp 2023-12-20 09:23:20.014812063 +0800 +diff --git a/hotspot/src/share/vm/opto/locknode.hpp b/hotspot/src/share/vm/opto/locknode.hpp +index b320f6bfb2..4bfb0ff072 100644 +--- a/hotspot/src/share/vm/opto/locknode.hpp ++++ b/hotspot/src/share/vm/opto/locknode.hpp @@ -22,6 +22,12 @@ * */ @@ -114248,9 +114803,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif //------------------------------BoxLockNode------------------------------------ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp ---- a/hotspot/src/share/vm/opto/matcher.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/matcher.cpp 2023-12-20 09:23:20.018145359 +0800 +diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp +index 6660b4b467..dec46861d3 100644 +--- a/hotspot/src/share/vm/opto/matcher.cpp ++++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -22,6 +22,12 @@ * */ @@ -114275,9 +114831,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif OptoReg::Name OptoReg::c_frame_pointer; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp ---- a/hotspot/src/share/vm/opto/output.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/output.cpp 2023-12-20 09:23:20.018145359 +0800 +diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp +index 6032b72a9b..7fb4dea28e 100644 +--- a/hotspot/src/share/vm/opto/output.cpp ++++ b/hotspot/src/share/vm/opto/output.cpp @@ -22,6 +22,12 @@ * */ @@ -114291,7 +114848,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/compiledIC.hpp" -@@ -844,6 +850,27 @@ +@@ -844,6 +850,27 @@ void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) { // Add the safepoint in the DebugInfoRecorder if( !mach->is_MachCall() ) { mcall = NULL; @@ -114319,7 +114876,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp debug_info()->add_safepoint(safepoint_pc_offset, sfn->_oop_map); } else { mcall = mach->as_MachCall(); -@@ -1502,6 +1529,22 @@ +@@ -1502,6 +1529,22 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { DEBUG_ONLY( uint instr_offset = cb->insts_size(); ) n->emit(*cb, _regalloc); current_offset = cb->insts_size(); @@ -114342,9 +114899,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Above we only verified that there is enough space in the instruction section. // However, the instruction may emit stubs that cause code buffer expansion. -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/output.hpp b/hotspot/src/share/vm/opto/output.hpp ---- a/hotspot/src/share/vm/opto/output.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/output.hpp 2023-12-20 09:23:20.018145359 +0800 +diff --git a/hotspot/src/share/vm/opto/output.hpp b/hotspot/src/share/vm/opto/output.hpp +index ba72841363..37f954de9b 100644 +--- a/hotspot/src/share/vm/opto/output.hpp ++++ b/hotspot/src/share/vm/opto/output.hpp @@ -22,6 +22,12 @@ * */ @@ -114369,9 +114927,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif class Arena; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/regmask.cpp b/hotspot/src/share/vm/opto/regmask.cpp ---- a/hotspot/src/share/vm/opto/regmask.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/regmask.cpp 2023-12-20 09:23:20.021478654 +0800 +diff --git a/hotspot/src/share/vm/opto/regmask.cpp b/hotspot/src/share/vm/opto/regmask.cpp +index 352ccfb9d9..9a656d03ee 100644 +--- a/hotspot/src/share/vm/opto/regmask.cpp ++++ b/hotspot/src/share/vm/opto/regmask.cpp @@ -22,6 +22,12 @@ * */ @@ -114396,9 +114955,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif #define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/regmask.hpp b/hotspot/src/share/vm/opto/regmask.hpp ---- a/hotspot/src/share/vm/opto/regmask.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/regmask.hpp 2023-12-20 09:23:20.021478654 +0800 +diff --git a/hotspot/src/share/vm/opto/regmask.hpp b/hotspot/src/share/vm/opto/regmask.hpp +index 5ceebb3fb8..6d08b68731 100644 +--- a/hotspot/src/share/vm/opto/regmask.hpp ++++ b/hotspot/src/share/vm/opto/regmask.hpp @@ -22,6 +22,12 @@ * */ @@ -114423,9 +114983,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif // Some fun naming (textual) substitutions: -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp ---- a/hotspot/src/share/vm/opto/runtime.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/runtime.cpp 2023-12-20 09:23:20.021478654 +0800 +diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp +index a43b37f2c5..f2bcafa2c5 100644 +--- a/hotspot/src/share/vm/opto/runtime.cpp ++++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -22,6 +22,12 @@ * */ @@ -114450,9 +115011,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp ---- a/hotspot/src/share/vm/opto/type.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/opto/type.cpp 2023-12-20 09:23:20.024811948 +0800 +diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp +index 58572f137d..299d48b12a 100644 +--- a/hotspot/src/share/vm/opto/type.cpp ++++ b/hotspot/src/share/vm/opto/type.cpp @@ -22,6 +22,12 @@ * */ @@ -114466,7 +115028,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "precompiled.hpp" #include "ci/ciMethodData.hpp" #include "ci/ciTypeFlow.hpp" -@@ -68,6 +74,16 @@ +@@ -68,6 +74,16 @@ const Type::TypeInfo Type::_type_info[Type::lastype] = { { Bad, T_ILLEGAL, "vectord:", false, Op_RegD, relocInfo::none }, // VectorD { Bad, T_ILLEGAL, "vectorx:", false, 0, relocInfo::none }, // VectorX { Bad, T_ILLEGAL, "vectory:", false, 0, relocInfo::none }, // VectorY @@ -114483,9 +115045,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #elif defined(PPC64) { Bad, T_ILLEGAL, "vectors:", false, 0, relocInfo::none }, // VectorS { Bad, T_ILLEGAL, "vectord:", false, Op_RegL, relocInfo::none }, // VectorD -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp ---- a/hotspot/src/share/vm/prims/jniCheck.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/prims/jniCheck.cpp 2023-12-20 09:23:20.028145243 +0800 +diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp +index 593ca8a1e3..82813b71fe 100644 +--- a/hotspot/src/share/vm/prims/jniCheck.cpp ++++ b/hotspot/src/share/vm/prims/jniCheck.cpp @@ -22,6 +22,12 @@ * */ @@ -114512,9 +115075,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Complain every extra number of unplanned local refs #define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32 -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/prims/jni_md.h b/hotspot/src/share/vm/prims/jni_md.h ---- a/hotspot/src/share/vm/prims/jni_md.h 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/prims/jni_md.h 2023-12-20 09:23:20.028145243 +0800 +diff --git a/hotspot/src/share/vm/prims/jni_md.h b/hotspot/src/share/vm/prims/jni_md.h +index 6209a66449..271715d4a2 100644 +--- a/hotspot/src/share/vm/prims/jni_md.h ++++ b/hotspot/src/share/vm/prims/jni_md.h @@ -22,6 +22,12 @@ * or visit www.oracle.com if you need additional information or have any * questions. @@ -114541,9 +115105,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp /* -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp ---- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp 2023-12-20 09:23:20.031478538 +0800 +diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp +index ab31d0d91e..0d8570b764 100644 +--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp ++++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp @@ -22,6 +22,12 @@ * */ @@ -114570,9 +115135,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // FIXME: add Deprecated attribute // FIXME: fix Synthetic attribute // FIXME: per Serguei, add error return handling for ConstantPool::copy_cpool_bytes() -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp ---- a/hotspot/src/share/vm/prims/methodHandles.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/prims/methodHandles.hpp 2023-12-20 09:23:20.034811834 +0800 +diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp +index db6e06180d..841082859a 100644 +--- a/hotspot/src/share/vm/prims/methodHandles.hpp ++++ b/hotspot/src/share/vm/prims/methodHandles.hpp @@ -22,6 +22,12 @@ * */ @@ -114586,7 +115152,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_PRIMS_METHODHANDLES_HPP #define SHARE_VM_PRIMS_METHODHANDLES_HPP -@@ -198,6 +204,13 @@ +@@ -198,6 +204,13 @@ public: #ifdef TARGET_ARCH_ppc # include "methodHandles_ppc.hpp" #endif @@ -114600,9 +115166,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Tracing static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/atomic.inline.hpp b/hotspot/src/share/vm/runtime/atomic.inline.hpp ---- a/hotspot/src/share/vm/runtime/atomic.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/atomic.inline.hpp 2023-12-20 09:23:20.038145129 +0800 +diff --git a/hotspot/src/share/vm/runtime/atomic.inline.hpp b/hotspot/src/share/vm/runtime/atomic.inline.hpp +index 222f29cbf4..7c7c6edb27 100644 +--- a/hotspot/src/share/vm/runtime/atomic.inline.hpp ++++ b/hotspot/src/share/vm/runtime/atomic.inline.hpp @@ -22,6 +22,12 @@ * */ @@ -114629,9 +115196,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_OS_ARCH_linux_sparc # include "atomic_linux_sparc.inline.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp ---- a/hotspot/src/share/vm/runtime/deoptimization.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp 2023-12-20 09:23:20.038145129 +0800 +diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp +index f91afdc416..36a924fd4f 100644 +--- a/hotspot/src/share/vm/runtime/deoptimization.cpp ++++ b/hotspot/src/share/vm/runtime/deoptimization.cpp @@ -22,6 +22,12 @@ * */ @@ -114671,9 +115239,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif // COMPILER2 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp ---- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp 2023-12-20 09:23:20.038145129 +0800 +diff --git a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp +index db568def34..490c5f5a4e 100644 +--- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp ++++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp @@ -22,6 +22,12 @@ * */ @@ -114700,9 +115269,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp class RegisteredProbes; typedef jlong OpaqueProbes; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/frame.cpp b/hotspot/src/share/vm/runtime/frame.cpp ---- a/hotspot/src/share/vm/runtime/frame.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/frame.cpp 2023-12-20 09:23:20.041478424 +0800 +diff --git a/hotspot/src/share/vm/runtime/frame.cpp b/hotspot/src/share/vm/runtime/frame.cpp +index 338b7ad3a7..5a161133ba 100644 +--- a/hotspot/src/share/vm/runtime/frame.cpp ++++ b/hotspot/src/share/vm/runtime/frame.cpp @@ -22,6 +22,12 @@ * */ @@ -114730,9 +115300,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/frame.hpp b/hotspot/src/share/vm/runtime/frame.hpp ---- a/hotspot/src/share/vm/runtime/frame.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/frame.hpp 2023-12-20 09:23:20.041478424 +0800 +diff --git a/hotspot/src/share/vm/runtime/frame.hpp b/hotspot/src/share/vm/runtime/frame.hpp +index 2d80ecc208..4a9e6edb54 100644 +--- a/hotspot/src/share/vm/runtime/frame.hpp ++++ b/hotspot/src/share/vm/runtime/frame.hpp @@ -22,6 +22,12 @@ * */ @@ -114757,7 +115328,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif #endif // COMPILER2 #ifdef TARGET_ARCH_zero -@@ -489,6 +499,12 @@ +@@ -489,6 +499,12 @@ class frame VALUE_OBJ_CLASS_SPEC { #ifdef TARGET_ARCH_x86 # include "frame_x86.hpp" #endif @@ -114770,9 +115341,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "frame_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/frame.inline.hpp b/hotspot/src/share/vm/runtime/frame.inline.hpp ---- a/hotspot/src/share/vm/runtime/frame.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/frame.inline.hpp 2023-12-20 09:23:20.041478424 +0800 +diff --git a/hotspot/src/share/vm/runtime/frame.inline.hpp b/hotspot/src/share/vm/runtime/frame.inline.hpp +index 710b82306a..704cc8df8f 100644 +--- a/hotspot/src/share/vm/runtime/frame.inline.hpp ++++ b/hotspot/src/share/vm/runtime/frame.inline.hpp @@ -22,6 +22,12 @@ * */ @@ -114799,7 +115371,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_zero # include "entryFrame_zero.hpp" # include "fakeStubFrame_zero.hpp" -@@ -115,6 +127,12 @@ +@@ -115,6 +127,12 @@ inline oop* frame::interpreter_frame_temp_oop_addr() const { #ifdef TARGET_ARCH_ppc # include "frame_ppc.inline.hpp" #endif @@ -114812,9 +115384,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif // SHARE_VM_RUNTIME_FRAME_INLINE_HPP -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp ---- a/hotspot/src/share/vm/runtime/globals.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/globals.hpp 2023-12-20 09:23:20.041478424 +0800 +diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp +index 23ce8af569..f36137aabf 100644 +--- a/hotspot/src/share/vm/runtime/globals.hpp ++++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -55,6 +55,12 @@ #ifdef TARGET_ARCH_ppc # include "globals_ppc.hpp" @@ -114867,7 +115440,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_arm # include "c2_globals_arm.hpp" #endif -@@ -3209,7 +3233,7 @@ +@@ -3209,7 +3233,7 @@ class CommandLineFlags { product(uintx, InitialHeapSize, 0, \ "Initial heap size (in bytes); zero means use ergonomics") \ \ @@ -114876,9 +115449,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp "Maximum heap size (in bytes)") \ \ product(uintx, OldSize, ScaleForWordSize(4*M), \ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/icache.hpp b/hotspot/src/share/vm/runtime/icache.hpp ---- a/hotspot/src/share/vm/runtime/icache.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/icache.hpp 2023-12-20 09:23:20.041478424 +0800 +diff --git a/hotspot/src/share/vm/runtime/icache.hpp b/hotspot/src/share/vm/runtime/icache.hpp +index ba81a06ff5..9c0cfdb7d7 100644 +--- a/hotspot/src/share/vm/runtime/icache.hpp ++++ b/hotspot/src/share/vm/runtime/icache.hpp @@ -22,6 +22,12 @@ * */ @@ -114892,7 +115466,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_RUNTIME_ICACHE_HPP #define SHARE_VM_RUNTIME_ICACHE_HPP -@@ -86,7 +92,12 @@ +@@ -86,7 +92,12 @@ class AbstractICache : AllStatic { #ifdef TARGET_ARCH_ppc # include "icache_ppc.hpp" #endif @@ -114906,9 +115480,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp class ICacheStubGenerator : public StubCodeGenerator { -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/javaCalls.hpp b/hotspot/src/share/vm/runtime/javaCalls.hpp ---- a/hotspot/src/share/vm/runtime/javaCalls.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/javaCalls.hpp 2023-12-20 09:23:20.041478424 +0800 +diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp +index 0a263b017c..9ba0decaae 100644 +--- a/hotspot/src/share/vm/runtime/java.cpp ++++ b/hotspot/src/share/vm/runtime/java.cpp @@ -22,6 +22,12 @@ * */ @@ -114919,25 +115494,26 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * available on the same license terms set forth above. + */ + - #ifndef SHARE_VM_RUNTIME_JAVACALLS_HPP - #define SHARE_VM_RUNTIME_JAVACALLS_HPP - -@@ -49,6 +55,12 @@ + #include "precompiled.hpp" + #include "classfile/classLoader.hpp" + #include "classfile/symbolTable.hpp" +@@ -84,6 +90,12 @@ #ifdef TARGET_ARCH_ppc - # include "jniTypes_ppc.hpp" + # include "vm_version_ppc.hpp" #endif +#ifdef TARGET_ARCH_mips -+# include "jniTypes_mips.hpp" ++# include "vm_version_mips.hpp" +#endif +#ifdef TARGET_ARCH_loongarch -+# include "jniTypes_loongarch.hpp" ++# include "vm_version_loongarch.hpp" +#endif - - // A JavaCallWrapper is constructed before each JavaCall and destructed after the call. - // Its purpose is to allocate/deallocate a new handle block and to save/restore the last -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp ---- a/hotspot/src/share/vm/runtime/java.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/java.cpp 2023-12-20 09:23:20.041478424 +0800 + #if INCLUDE_ALL_GCS + #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" + #include "gc_implementation/parallelScavenge/psScavenge.hpp" +diff --git a/hotspot/src/share/vm/runtime/javaCalls.hpp b/hotspot/src/share/vm/runtime/javaCalls.hpp +index 6126bbe75e..1747e2b2ee 100644 +--- a/hotspot/src/share/vm/runtime/javaCalls.hpp ++++ b/hotspot/src/share/vm/runtime/javaCalls.hpp @@ -22,6 +22,12 @@ * */ @@ -114948,25 +115524,26 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp + * available on the same license terms set forth above. + */ + - #include "precompiled.hpp" - #include "classfile/classLoader.hpp" - #include "classfile/symbolTable.hpp" -@@ -84,6 +90,12 @@ + #ifndef SHARE_VM_RUNTIME_JAVACALLS_HPP + #define SHARE_VM_RUNTIME_JAVACALLS_HPP + +@@ -49,6 +55,12 @@ #ifdef TARGET_ARCH_ppc - # include "vm_version_ppc.hpp" + # include "jniTypes_ppc.hpp" #endif +#ifdef TARGET_ARCH_mips -+# include "vm_version_mips.hpp" ++# include "jniTypes_mips.hpp" +#endif +#ifdef TARGET_ARCH_loongarch -+# include "vm_version_loongarch.hpp" ++# include "jniTypes_loongarch.hpp" +#endif - #if INCLUDE_ALL_GCS - #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" - #include "gc_implementation/parallelScavenge/psScavenge.hpp" -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp ---- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp 2023-12-20 09:23:20.044811719 +0800 + + // A JavaCallWrapper is constructed before each JavaCall and destructed after the call. + // Its purpose is to allocate/deallocate a new handle block and to save/restore the last +diff --git a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp +index 129a01e293..c2b1b2e6c3 100644 +--- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp ++++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp @@ -22,6 +22,12 @@ * */ @@ -114980,7 +115557,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP #define SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP -@@ -80,6 +86,12 @@ +@@ -80,6 +86,12 @@ friend class JavaCallWrapper; #ifdef TARGET_ARCH_x86 # include "javaFrameAnchor_x86.hpp" #endif @@ -114993,10 +115570,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_ARCH_aarch64 # include "javaFrameAnchor_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp ---- a/hotspot/src/share/vm/runtime/os.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/os.cpp 2023-12-20 09:23:20.044811719 +0800 -@@ -1122,7 +1122,8 @@ +diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp +index 96eed03670..28c78409e7 100644 +--- a/hotspot/src/share/vm/runtime/os.cpp ++++ b/hotspot/src/share/vm/runtime/os.cpp +@@ -1122,7 +1122,8 @@ bool os::is_first_C_frame(frame* fr) { uintptr_t old_fp = (uintptr_t)fr->link(); if ((old_fp & fp_align_mask) != 0) return true; @@ -115006,9 +115584,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // stack grows downwards; if old_fp is below current fp or if the stack // frame is too large, either the stack is corrupted or fp is not saved -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp ---- a/hotspot/src/share/vm/runtime/os.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/os.hpp 2023-12-20 09:23:20.044811719 +0800 +diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp +index 836c231b03..0ca6e64598 100644 +--- a/hotspot/src/share/vm/runtime/os.hpp ++++ b/hotspot/src/share/vm/runtime/os.hpp @@ -22,6 +22,12 @@ * */ @@ -115022,7 +115601,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_RUNTIME_OS_HPP #define SHARE_VM_RUNTIME_OS_HPP -@@ -857,6 +863,12 @@ +@@ -857,6 +863,12 @@ class os: AllStatic { #ifdef TARGET_OS_ARCH_linux_x86 # include "os_linux_x86.hpp" #endif @@ -115035,9 +115614,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_OS_ARCH_linux_aarch64 # include "os_linux_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/prefetch.inline.hpp b/hotspot/src/share/vm/runtime/prefetch.inline.hpp ---- a/hotspot/src/share/vm/runtime/prefetch.inline.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/prefetch.inline.hpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/prefetch.inline.hpp b/hotspot/src/share/vm/runtime/prefetch.inline.hpp +index f4e30de34d..fec16f842c 100644 +--- a/hotspot/src/share/vm/runtime/prefetch.inline.hpp ++++ b/hotspot/src/share/vm/runtime/prefetch.inline.hpp @@ -46,6 +46,12 @@ #ifdef TARGET_OS_ARCH_linux_ppc # include "prefetch_linux_ppc.inline.hpp" @@ -115051,9 +115631,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Solaris #ifdef TARGET_OS_ARCH_solaris_x86 -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/registerMap.hpp b/hotspot/src/share/vm/runtime/registerMap.hpp ---- a/hotspot/src/share/vm/runtime/registerMap.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/registerMap.hpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/registerMap.hpp b/hotspot/src/share/vm/runtime/registerMap.hpp +index 67ef212d65..1e26dfcba4 100644 +--- a/hotspot/src/share/vm/runtime/registerMap.hpp ++++ b/hotspot/src/share/vm/runtime/registerMap.hpp @@ -22,6 +22,12 @@ * */ @@ -115080,7 +115661,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp class JavaThread; -@@ -156,6 +168,12 @@ +@@ -156,6 +168,12 @@ class RegisterMap : public StackObj { #ifdef TARGET_ARCH_ppc # include "registerMap_ppc.hpp" #endif @@ -115093,9 +115674,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp }; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/relocator.hpp b/hotspot/src/share/vm/runtime/relocator.hpp ---- a/hotspot/src/share/vm/runtime/relocator.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/relocator.hpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/relocator.hpp b/hotspot/src/share/vm/runtime/relocator.hpp +index bb19c75fe6..53f3c9f6bd 100644 +--- a/hotspot/src/share/vm/runtime/relocator.hpp ++++ b/hotspot/src/share/vm/runtime/relocator.hpp @@ -22,6 +22,12 @@ * */ @@ -115122,9 +115704,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // This code has been converted from the 1.1E java virtual machine // Thanks to the JavaTopics group for using the code -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp ---- a/hotspot/src/share/vm/runtime/safepoint.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/safepoint.cpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp +index 440617c802..be0e4dd13c 100644 +--- a/hotspot/src/share/vm/runtime/safepoint.cpp ++++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -22,6 +22,12 @@ * */ @@ -115153,9 +115736,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #if INCLUDE_ALL_GCS #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" #include "gc_implementation/shared/suspendibleThreadSet.hpp" -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp ---- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp +index 5f540247f9..abcd6066b9 100644 +--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp ++++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -22,6 +22,12 @@ * */ @@ -115185,7 +115769,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef COMPILER1 #include "c1/c1_Runtime1.hpp" #endif -@@ -220,7 +235,6 @@ +@@ -220,7 +235,6 @@ void SharedRuntime::print_ic_miss_histogram() { } } #endif // PRODUCT @@ -115193,9 +115777,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #if INCLUDE_ALL_GCS // G1 write-barrier pre: executed before a pointer store. -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp b/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp ---- a/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp b/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp +index 37880d8a5c..3987880b16 100644 +--- a/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp ++++ b/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp @@ -22,6 +22,12 @@ * */ @@ -115209,7 +115794,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "precompiled.hpp" #include "prims/jni.h" #include "runtime/interfaceSupport.hpp" -@@ -534,6 +540,15 @@ +@@ -534,6 +540,15 @@ static SAFEBUF int __ieee754_rem_pio2(double x, double *y) { * then 3 2 * sin(x) = x + (S1*x + (x *(r-y/2)+y)) */ @@ -115225,9 +115810,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp static const double S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/stackValueCollection.cpp b/hotspot/src/share/vm/runtime/stackValueCollection.cpp ---- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/stackValueCollection.cpp b/hotspot/src/share/vm/runtime/stackValueCollection.cpp +index 8774768311..fe81c1bfd8 100644 +--- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp ++++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp @@ -22,6 +22,12 @@ * */ @@ -115254,9 +115840,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp ---- a/hotspot/src/share/vm/runtime/statSampler.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/statSampler.cpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp +index 41f469622f..3b43089062 100644 +--- a/hotspot/src/share/vm/runtime/statSampler.cpp ++++ b/hotspot/src/share/vm/runtime/statSampler.cpp @@ -22,6 +22,12 @@ * */ @@ -115283,9 +115870,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // -------------------------------------------------------- // StatSamplerTask -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp ---- a/hotspot/src/share/vm/runtime/stubRoutines.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp 2023-12-20 09:23:20.048145015 +0800 +diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp +index e18b9127df..9bf933762a 100644 +--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp ++++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp @@ -22,6 +22,12 @@ * */ @@ -115312,7 +115900,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // StubRoutines provides entry points to assembly routines used by // compiled code and the run-time system. Platform-specific entry -@@ -116,6 +128,10 @@ +@@ -116,6 +128,10 @@ class StubRoutines: AllStatic { # include "stubRoutines_zero.hpp" #elif defined TARGET_ARCH_MODEL_ppc_64 # include "stubRoutines_ppc_64.hpp" @@ -115323,9 +115911,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif static jint _verify_oop_count; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp ---- a/hotspot/src/share/vm/runtime/thread.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/thread.cpp 2023-12-20 09:23:20.051478310 +0800 +diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp +index e6586c40cb..3db678ff48 100644 +--- a/hotspot/src/share/vm/runtime/thread.cpp ++++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -22,6 +22,12 @@ * */ @@ -115339,9 +115928,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include "precompiled.hpp" #include "classfile/classLoader.hpp" #include "classfile/javaClasses.hpp" -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp ---- a/hotspot/src/share/vm/runtime/thread.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/thread.hpp 2023-12-20 09:23:20.051478310 +0800 +diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp +index 1c19ab7290..aa69217eef 100644 +--- a/hotspot/src/share/vm/runtime/thread.hpp ++++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -22,6 +22,12 @@ * */ @@ -115355,7 +115945,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_RUNTIME_THREAD_HPP #define SHARE_VM_RUNTIME_THREAD_HPP -@@ -1711,6 +1717,12 @@ +@@ -1711,6 +1717,12 @@ public: #ifdef TARGET_OS_ARCH_linux_x86 # include "thread_linux_x86.hpp" #endif @@ -115368,9 +115958,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_OS_ARCH_linux_aarch64 # include "thread_linux_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp ---- a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp 2023-12-20 09:23:20.051478310 +0800 +diff --git a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp +index 58c1afc810..0938b2edda 100644 +--- a/hotspot/src/share/vm/runtime/threadLocalStorage.hpp ++++ b/hotspot/src/share/vm/runtime/threadLocalStorage.hpp @@ -22,6 +22,12 @@ * */ @@ -115384,7 +115975,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_RUNTIME_THREADLOCALSTORAGE_HPP #define SHARE_VM_RUNTIME_THREADLOCALSTORAGE_HPP -@@ -51,6 +57,12 @@ +@@ -51,6 +57,12 @@ class ThreadLocalStorage : AllStatic { #ifdef TARGET_OS_ARCH_linux_x86 # include "threadLS_linux_x86.hpp" #endif @@ -115397,9 +115988,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifdef TARGET_OS_ARCH_linux_aarch64 # include "threadLS_linux_aarch64.hpp" #endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp ---- a/hotspot/src/share/vm/runtime/virtualspace.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp 2023-12-20 09:23:20.051478310 +0800 +diff --git a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp +index 66392b75f1..5ced38d838 100644 +--- a/hotspot/src/share/vm/runtime/virtualspace.cpp ++++ b/hotspot/src/share/vm/runtime/virtualspace.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. @@ -115407,7 +115999,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it -@@ -147,6 +148,15 @@ +@@ -147,6 +148,15 @@ void ReservedSpace::initialize(size_t size, size_t alignment, bool large, bool special = large && !os::can_commit_large_page_memory(); char* base = NULL; @@ -115423,7 +116015,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp if (requested_address != 0) { requested_address -= noaccess_prefix; // adjust requested address assert(requested_address != NULL, "huge noaccess prefix?"); -@@ -193,6 +203,12 @@ +@@ -193,6 +203,12 @@ void ReservedSpace::initialize(size_t size, size_t alignment, bool large, if (failed_to_reserve_as_requested(base, requested_address, size, false)) { // OS ignored requested address. Try different address. base = NULL; @@ -115436,9 +116028,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } } else { base = os::reserve_memory(size, NULL, alignment); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp ---- a/hotspot/src/share/vm/runtime/vmStructs.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp 2023-12-20 09:23:20.054811605 +0800 +diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp +index 32e3921b2b..c6cc4c4329 100644 +--- a/hotspot/src/share/vm/runtime/vmStructs.cpp ++++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -22,6 +22,12 @@ * */ @@ -115489,9 +116082,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #endif #endif // COMPILER2 -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp ---- a/hotspot/src/share/vm/runtime/vm_version.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/runtime/vm_version.cpp 2023-12-20 09:23:20.054811605 +0800 +diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp +index 91f9c70f5a..d8dcfcfcca 100644 +--- a/hotspot/src/share/vm/runtime/vm_version.cpp ++++ b/hotspot/src/share/vm/runtime/vm_version.cpp @@ -22,6 +22,12 @@ * */ @@ -115518,7 +116112,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release(); const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string(); -@@ -193,6 +205,14 @@ +@@ -193,6 +205,14 @@ const char* Abstract_VM_Version::jre_release_version() { #else #define CPU "ppc64" #endif @@ -115533,9 +116127,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #else #define CPU IA32_ONLY("x86") \ IA64_ONLY("ia64") \ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/utilities/copy.hpp b/hotspot/src/share/vm/utilities/copy.hpp ---- a/hotspot/src/share/vm/utilities/copy.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/utilities/copy.hpp 2024-01-30 13:54:24.896041236 +0800 +diff --git a/hotspot/src/share/vm/utilities/copy.hpp b/hotspot/src/share/vm/utilities/copy.hpp +index c1d82c7083..73b858b86e 100644 +--- a/hotspot/src/share/vm/utilities/copy.hpp ++++ b/hotspot/src/share/vm/utilities/copy.hpp @@ -22,6 +22,12 @@ * */ @@ -115549,7 +116144,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_UTILITIES_COPY_HPP #define SHARE_VM_UTILITIES_COPY_HPP -@@ -350,6 +356,13 @@ +@@ -350,6 +356,13 @@ class Copy : AllStatic { #ifdef TARGET_ARCH_ppc # include "copy_ppc.hpp" #endif @@ -115563,10 +116158,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp }; -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp ---- a/hotspot/src/share/vm/utilities/debug.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/utilities/debug.cpp 2023-12-20 09:23:20.061478196 +0800 -@@ -690,6 +690,7 @@ +diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp +index 58a32a2b83..1026585f84 100644 +--- a/hotspot/src/share/vm/utilities/debug.cpp ++++ b/hotspot/src/share/vm/utilities/debug.cpp +@@ -690,6 +690,7 @@ void help() { tty->print_cr(" pns($sp, $ebp, $pc) on Linux/x86 or"); tty->print_cr(" pns($sp, $fp, $pc) on Linux/AArch64 or"); tty->print_cr(" pns($sp, 0, $pc) on Linux/ppc64 or"); @@ -115574,9 +116170,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp tty->print_cr(" pns($sp + 0x7ff, 0, $pc) on Solaris/SPARC"); tty->print_cr(" - in gdb do 'set overload-resolution off' before calling pns()"); tty->print_cr(" - in dbx do 'frame 1' before calling pns()"); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp ---- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp 2023-12-20 09:23:20.064811491 +0800 +diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp +index 81866b8409..61fc0c48a2 100644 +--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp ++++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -22,6 +22,12 @@ * */ @@ -115590,7 +116187,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP #define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP -@@ -455,6 +461,12 @@ +@@ -455,6 +461,12 @@ enum RTMState { #ifdef TARGET_ARCH_ppc # include "globalDefinitions_ppc.hpp" #endif @@ -115603,9 +116200,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp /* * If a platform does not support native stack walking -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp ---- a/hotspot/src/share/vm/utilities/macros.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/utilities/macros.hpp 2023-12-20 09:23:20.064811491 +0800 +diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp +index 599e1074de..41ef06e27f 100644 +--- a/hotspot/src/share/vm/utilities/macros.hpp ++++ b/hotspot/src/share/vm/utilities/macros.hpp @@ -22,6 +22,12 @@ * */ @@ -115650,10 +116248,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #if defined(PPC32) || defined(PPC64) #ifndef PPC #define PPC -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp ---- a/hotspot/src/share/vm/utilities/taskqueue.hpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp 2023-12-20 09:23:20.068144786 +0800 -@@ -121,11 +121,22 @@ +diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp +index bc06caccb4..46be35a325 100644 +--- a/hotspot/src/share/vm/utilities/taskqueue.hpp ++++ b/hotspot/src/share/vm/utilities/taskqueue.hpp +@@ -121,11 +121,22 @@ protected: Age(const Age& age) { _data = age._data; } Age(idx_t top, idx_t tag) { _fields._top = top; _fields._tag = tag; } @@ -115676,7 +116275,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // Increment top; if it wraps, increment tag also. void increment() { -@@ -195,23 +206,50 @@ +@@ -195,23 +206,50 @@ protected: public: TaskQueueSuper() : _bottom(0), _age() {} @@ -115728,7 +116327,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp _age.set(0); } -@@ -263,7 +301,9 @@ +@@ -263,7 +301,9 @@ protected: typedef typename TaskQueueSuper::Age Age; typedef typename TaskQueueSuper::idx_t idx_t; @@ -115738,7 +116337,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp using TaskQueueSuper::_age; using TaskQueueSuper::increment_index; using TaskQueueSuper::decrement_index; -@@ -327,7 +367,11 @@ +@@ -327,7 +367,11 @@ template void GenericTaskQueue::oops_do(OopClosure* f) { // tty->print_cr("START OopTaskQueue::oops_do"); uint iters = size(); @@ -115750,7 +116349,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp for (uint i = 0; i < iters; ++i) { index = decrement_index(index); // tty->print_cr(" doing entry %d," INTPTR_T " -> " INTPTR_T, -@@ -345,14 +389,22 @@ +@@ -345,14 +389,22 @@ template bool GenericTaskQueue::push_slow(E t, uint dirty_n_elems) { if (dirty_n_elems == N - 1) { // Actually means 0, so do the push. @@ -115773,7 +116372,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp TASKQUEUE_STATS_ONLY(stats.record_push()); return true; } -@@ -407,7 +459,11 @@ +@@ -407,7 +459,11 @@ bool GenericTaskQueue::pop_global(volatile E& t) { #if !(defined SPARC || defined IA32 || defined AMD64) OrderAccess::fence(); #endif @@ -115785,7 +116384,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp uint n_elems = size(localBot, oldAge.top()); if (n_elems == 0) { return false; -@@ -662,7 +718,11 @@ +@@ -662,7 +718,11 @@ public: template inline bool GenericTaskQueue::push(E t) { @@ -115797,7 +116396,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp assert(localBot < N, "_bottom out of range."); idx_t top = _age.top(); uint dirty_n_elems = dirty_size(localBot, top); -@@ -674,7 +734,11 @@ +@@ -674,7 +734,11 @@ GenericTaskQueue::push(E t) { // assignment. However, casting to E& means that we trigger an // unused-value warning. So, we cast the E& to void. (void) const_cast(_elems[localBot] = t); @@ -115809,7 +116408,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp TASKQUEUE_STATS_ONLY(stats.record_push()); return true; } else { -@@ -684,7 +748,11 @@ +@@ -684,7 +748,11 @@ GenericTaskQueue::push(E t) { template inline bool GenericTaskQueue::pop_local(volatile E& t) { @@ -115821,7 +116420,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // This value cannot be N-1. That can only occur as a result of // the assignment to bottom in this method. If it does, this method // resets the size to 0 before the next call (which is sequential, -@@ -693,7 +761,11 @@ +@@ -693,7 +761,11 @@ GenericTaskQueue::pop_local(volatile E& t) { assert(dirty_n_elems != N - 1, "Shouldn't be possible..."); if (dirty_n_elems == 0) return false; localBot = decrement_index(localBot); @@ -115833,9 +116432,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp // This is necessary to prevent any read below from being reordered // before the store just above. OrderAccess::fence(); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp ---- a/hotspot/src/share/vm/utilities/vmError.cpp 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/src/share/vm/utilities/vmError.cpp 2023-12-20 09:23:20.068144786 +0800 +diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp +index fa7a32508e..7098a98a9f 100644 +--- a/hotspot/src/share/vm/utilities/vmError.cpp ++++ b/hotspot/src/share/vm/utilities/vmError.cpp @@ -22,6 +22,13 @@ * */ @@ -115850,7 +116450,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp #include #include "precompiled.hpp" #include "compiler/compileBroker.hpp" -@@ -488,7 +495,12 @@ +@@ -488,7 +495,12 @@ void VMError::report(outputStream* st) { JDK_Version::runtime_name() : ""; const char* runtime_version = JDK_Version::runtime_version() != NULL ? JDK_Version::runtime_version() : ""; @@ -115864,9 +116464,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp st->print_cr("# Java VM: %s (%s %s %s %s)", Abstract_VM_Version::vm_name(), Abstract_VM_Version::vm_release(), -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh b/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh ---- a/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh 2023-12-20 09:23:20.104811033 +0800 +diff --git a/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh b/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh +index fcf1d04b6a..5b8e7dcce5 100644 +--- a/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh ++++ b/hotspot/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh @@ -24,6 +24,12 @@ # questions. # @@ -115880,7 +116481,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp ## @test Test8167409.sh ## @bug 8167409 ## @summary Invalid value passed to critical JNI function -@@ -68,6 +74,18 @@ +@@ -68,6 +74,18 @@ if [ $VM_CPU = "aarch64" ]; then exit 0; fi @@ -115899,10 +116500,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp THIS_DIR=. cp ${TESTSRC}${FS}*.java ${THIS_DIR} -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java ---- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java 2023-12-20 09:23:20.114810919 +0800 -@@ -34,11 +34,12 @@ +diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java +index fa9a6f208b..885957cf1c 100644 +--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java ++++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java +@@ -34,11 +34,12 @@ import com.oracle.java.testlibrary.cli.predicate.OrPredicate; public class GenericTestCaseForOtherCPU extends SHAOptionsBase.TestCase { public GenericTestCaseForOtherCPU(String optionName) { @@ -115917,10 +116519,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp } @Override -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java ---- a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java 2023-12-20 09:23:20.128144100 +0800 -@@ -62,18 +62,24 @@ +diff --git a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java +index dc8c398408..2427b2bf7b 100644 +--- a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java ++++ b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java +@@ -62,18 +62,24 @@ public class IntrinsicPredicates { = new OrPredicate( new CPUSpecificPredicate("sparc.*", new String[] { "sha1" }, null), @@ -115947,10 +116550,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE = new OrPredicate( -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/test/runtime/6929067/Test6929067.sh b/hotspot/test/runtime/6929067/Test6929067.sh ---- a/hotspot/test/runtime/6929067/Test6929067.sh 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/test/runtime/6929067/Test6929067.sh 2023-12-20 09:23:20.144810575 +0800 -@@ -97,6 +97,10 @@ +diff --git a/hotspot/test/runtime/6929067/Test6929067.sh b/hotspot/test/runtime/6929067/Test6929067.sh +index 2bbb3401ce..1a5482e645 100644 +--- a/hotspot/test/runtime/6929067/Test6929067.sh ++++ b/hotspot/test/runtime/6929067/Test6929067.sh +@@ -97,6 +97,10 @@ case "$ARCH" in i686) ARCH=i386 ;; @@ -115961,10 +116565,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp # Assuming other ARCH values need no translation esac -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/test/runtime/Unsafe/RangeCheck.java b/hotspot/test/runtime/Unsafe/RangeCheck.java ---- a/hotspot/test/runtime/Unsafe/RangeCheck.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/test/runtime/Unsafe/RangeCheck.java 2023-12-20 09:23:20.154810460 +0800 -@@ -43,6 +43,7 @@ +diff --git a/hotspot/test/runtime/Unsafe/RangeCheck.java b/hotspot/test/runtime/Unsafe/RangeCheck.java +index 9ded944cb2..4d4ea2e048 100644 +--- a/hotspot/test/runtime/Unsafe/RangeCheck.java ++++ b/hotspot/test/runtime/Unsafe/RangeCheck.java +@@ -43,6 +43,7 @@ public class RangeCheck { true, "-Xmx32m", "-XX:-TransmitErrorReport", @@ -115972,10 +116577,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp DummyClassWithMainRangeCheck.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/test/test_env.sh b/hotspot/test/test_env.sh ---- a/hotspot/test/test_env.sh 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/test/test_env.sh 2023-12-20 09:23:20.161477051 +0800 -@@ -211,6 +211,29 @@ +diff --git a/hotspot/test/test_env.sh b/hotspot/test/test_env.sh +index 5ba4f28c45..d9d8bb6b6b 100644 +--- a/hotspot/test/test_env.sh ++++ b/hotspot/test/test_env.sh +@@ -211,6 +211,29 @@ if [ $? = 0 ] then VM_CPU="aarch64" fi @@ -116005,10 +116611,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp export VM_TYPE VM_BITS VM_OS VM_CPU echo "VM_TYPE=${VM_TYPE}" echo "VM_BITS=${VM_BITS}" -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java ---- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java 2023-12-20 09:23:20.164810346 +0800 -@@ -126,6 +126,10 @@ +diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java +index 6a14079347..56a6375b5f 100644 +--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java ++++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java +@@ -126,6 +126,10 @@ public class Platform { return isArch("aarch64"); } @@ -116019,7 +116626,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp private static boolean isArch(String archnameRE) { return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE) .matcher(osArch) -@@ -136,6 +140,10 @@ +@@ -136,6 +140,10 @@ public class Platform { return osArch; } @@ -116030,10 +116637,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp /** * Return a boolean for whether we expect to be able to attach * the SA to our own processes on this system. -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java ---- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java 2023-12-20 09:23:20.168143641 +0800 -@@ -43,7 +43,7 @@ +diff --git a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java +index 7d56a4a3bc..41825e18b3 100644 +--- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java ++++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java +@@ -43,7 +43,7 @@ import java.util.Set; */ public class TestMutuallyExclusivePlatformPredicates { private static enum MethodGroup { @@ -116042,33 +116650,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/hotsp BITNESS("is32bit", "is64bit"), OS("isAix", "isLinux", "isSolaris", "isWindows", "isOSX"), VM_TYPE("isClient", "isServer", "isGraal", "isMinimal"), -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/make/gensrc/GensrcMisc.gmk b/jdk/make/gensrc/GensrcMisc.gmk ---- a/jdk/make/gensrc/GensrcMisc.gmk 2024-01-11 09:53:23.000000000 +0800 -+++ b/jdk/make/gensrc/GensrcMisc.gmk 2023-12-20 09:23:20.694804279 +0800 -@@ -23,6 +23,12 @@ - # questions. - # - -+# -+# This file has been modified by Loongson Technology in 2018. These -+# modifications are Copyright (c) 2018, Loongson Technology, and are made -+# available on the same license terms set forth above. -+# -+ - include ProfileNames.gmk - - ################################################################################ -@@ -39,6 +45,7 @@ - $(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \ - -e 's/@@java_version@@/$(RELEASE)/g' \ - -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \ -+ -e 's/@@loongson_runtime_name@@/$(LOONGSON_RUNTIME_NAME)/g' \ - -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \ - -e 's/@@java_profile_name@@/$(call profile_version_name, $@)/g' \ - $< > $@.tmp -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/make/Images.gmk b/jdk/make/Images.gmk ---- a/jdk/make/Images.gmk 2024-01-11 09:53:23.000000000 +0800 -+++ b/jdk/make/Images.gmk 2023-12-20 09:23:20.618138492 +0800 +diff --git a/jdk/make/Images.gmk b/jdk/make/Images.gmk +index 991c0af7b4..9171685655 100644 +--- a/jdk/make/Images.gmk ++++ b/jdk/make/Images.gmk @@ -23,6 +23,12 @@ # questions. # @@ -116082,7 +116667,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/m include $(SPEC) include MakeBase.gmk include JavaCompilation.gmk -@@ -650,6 +656,11 @@ +@@ -650,6 +656,11 @@ $(JDK_IMAGE_DIR)/src.zip: $(IMAGES_OUTPUTDIR)/src.zip $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(install-file) @@ -116094,10 +116679,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/m ################################################################################ # Post processing (strip etc) -@@ -729,6 +740,14 @@ +@@ -728,6 +739,14 @@ ifneq ($(POST_STRIP_CMD), ) + endif - ################################################################################ ++################################################################################ +# Loongson added list, architecture dependent files +ifeq ($(OPENJDK_TARGET_CPU), mips64) + ifeq ($(OPENJDK_TARGET_CPU_ENDIAN), little) @@ -116105,11 +116691,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/m + endif +endif + -+################################################################################ + ################################################################################ # Include the custom makefile right here, after all variables have been defined - # so that they may be overridden, but before the main targets are declared, so -@@ -753,6 +772,7 @@ +@@ -753,6 +772,7 @@ jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \ $(JDKJRE_DOC_TARGETS) $(JDK_DOC_TARGETS) \ $(JDK_INFO_FILE) $(JDKJRE_STRIP_LIST) $(JDK_BIN_STRIP_LIST) \ $(JDK_IMAGE_DIR)/src.zip \ @@ -116117,9 +116702,35 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/m $(JDK_BIN_ISADIR_LINK_TARGETS) $(JDKJRE_BIN_ISADIR_LINK_TARGETS) jre-overlay-image: $(JRE_OVERLAY_BIN_TARGETS) $(JRE_OVERLAY_LIB_TARGETS) \ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk ---- a/jdk/make/lib/SoundLibraries.gmk 2024-01-11 09:53:23.000000000 +0800 -+++ b/jdk/make/lib/SoundLibraries.gmk 2023-12-20 09:23:20.694804279 +0800 +diff --git a/jdk/make/gensrc/GensrcMisc.gmk b/jdk/make/gensrc/GensrcMisc.gmk +index 0e3dee5ca3..66f19f4d25 100644 +--- a/jdk/make/gensrc/GensrcMisc.gmk ++++ b/jdk/make/gensrc/GensrcMisc.gmk +@@ -23,6 +23,12 @@ + # questions. + # + ++# ++# This file has been modified by Loongson Technology in 2018. These ++# modifications are Copyright (c) 2018, Loongson Technology, and are made ++# available on the same license terms set forth above. ++# ++ + include ProfileNames.gmk + + ################################################################################ +@@ -39,6 +45,7 @@ $(PROFILE_VERSION_JAVA_TARGETS): \ + $(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \ + -e 's/@@java_version@@/$(RELEASE)/g' \ + -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \ ++ -e 's/@@loongson_runtime_name@@/$(LOONGSON_RUNTIME_NAME)/g' \ + -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \ + -e 's/@@java_profile_name@@/$(call profile_version_name, $@)/g' \ + $< > $@.tmp +diff --git a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk +index b59a9462ec..8ce97dc854 100644 +--- a/jdk/make/lib/SoundLibraries.gmk ++++ b/jdk/make/lib/SoundLibraries.gmk @@ -23,6 +23,12 @@ # questions. # @@ -116133,7 +116744,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/m LIBJSOUND_SRC_DIRS := \ $(JDK_TOPDIR)/src/share/native/com/sun/media/sound \ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/media/sound -@@ -136,6 +142,14 @@ +@@ -136,6 +142,14 @@ else LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC endif @@ -116148,9 +116759,10 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/m ifeq ($(OPENJDK_TARGET_CPU), ppc64) LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC64 endif -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/src/share/classes/sun/misc/Version.java.template b/jdk/src/share/classes/sun/misc/Version.java.template ---- a/jdk/src/share/classes/sun/misc/Version.java.template 2024-01-11 09:53:23.000000000 +0800 -+++ b/jdk/src/share/classes/sun/misc/Version.java.template 2023-12-20 09:23:21.388129678 +0800 +diff --git a/jdk/src/share/classes/sun/misc/Version.java.template b/jdk/src/share/classes/sun/misc/Version.java.template +index 32e2586e79..e38541a9f7 100644 +--- a/jdk/src/share/classes/sun/misc/Version.java.template ++++ b/jdk/src/share/classes/sun/misc/Version.java.template @@ -23,6 +23,13 @@ * questions. */ @@ -116165,7 +116777,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/s package sun.misc; import java.io.PrintStream; -@@ -44,6 +51,9 @@ +@@ -44,6 +51,9 @@ public class Version { private static final String java_runtime_version = "@@java_runtime_version@@"; @@ -116175,7 +116787,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/s static { init(); } -@@ -103,7 +113,11 @@ +@@ -103,7 +113,11 @@ public class Version { /* Second line: runtime version (ie, libraries). */ @@ -116188,9 +116800,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/s if (java_profile_name.length() > 0) { // profile name -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/src/solaris/bin/loongarch64/jvm.cfg b/jdk/src/solaris/bin/loongarch64/jvm.cfg ---- a/jdk/src/solaris/bin/loongarch64/jvm.cfg 1970-01-01 08:00:00.000000000 +0800 -+++ b/jdk/src/solaris/bin/loongarch64/jvm.cfg 2023-12-20 09:23:21.804791575 +0800 +diff --git a/jdk/src/solaris/bin/loongarch64/jvm.cfg b/jdk/src/solaris/bin/loongarch64/jvm.cfg +new file mode 100644 +index 0000000000..42a06755da +--- /dev/null ++++ b/jdk/src/solaris/bin/loongarch64/jvm.cfg @@ -0,0 +1,36 @@ +# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. @@ -116228,9 +116842,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/s +# +-server KNOWN +-client IGNORE -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/src/solaris/bin/mips64/jvm.cfg b/jdk/src/solaris/bin/mips64/jvm.cfg ---- a/jdk/src/solaris/bin/mips64/jvm.cfg 1970-01-01 08:00:00.000000000 +0800 -+++ b/jdk/src/solaris/bin/mips64/jvm.cfg 2023-12-20 09:23:21.804791575 +0800 +diff --git a/jdk/src/solaris/bin/mips64/jvm.cfg b/jdk/src/solaris/bin/mips64/jvm.cfg +new file mode 100644 +index 0000000000..42a06755da +--- /dev/null ++++ b/jdk/src/solaris/bin/mips64/jvm.cfg @@ -0,0 +1,36 @@ +# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2022, Loongson Technology. All rights reserved. @@ -116268,10 +116884,11 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/s +# +-server KNOWN +-client IGNORE -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/test/jdk/jfr/event/os/TestCPUInformation.java b/jdk/test/jdk/jfr/event/os/TestCPUInformation.java ---- a/jdk/test/jdk/jfr/event/os/TestCPUInformation.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/jdk/test/jdk/jfr/event/os/TestCPUInformation.java 2024-01-30 13:54:25.486035237 +0800 -@@ -54,8 +54,8 @@ +diff --git a/jdk/test/jdk/jfr/event/os/TestCPUInformation.java b/jdk/test/jdk/jfr/event/os/TestCPUInformation.java +index 17c8419cbc..a8b76cb71a 100644 +--- a/jdk/test/jdk/jfr/event/os/TestCPUInformation.java ++++ b/jdk/test/jdk/jfr/event/os/TestCPUInformation.java +@@ -54,8 +54,8 @@ public class TestCPUInformation { Events.assertField(event, "hwThreads").atLeast(1); Events.assertField(event, "cores").atLeast(1); Events.assertField(event, "sockets").atLeast(1); @@ -116282,49 +116899,18 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/t } } } -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/test/sun/management/jmxremote/bootstrap/linux-loongarch64/launcher b/jdk/test/sun/management/jmxremote/bootstrap/linux-loongarch64/launcher ---- a/jdk/test/sun/management/jmxremote/bootstrap/linux-loongarch64/launcher 1970-01-01 08:00:00.000000000 +0800 -+++ b/jdk/test/sun/management/jmxremote/bootstrap/linux-loongarch64/launcher 2023-12-20 09:23:22.678114913 +0800 -@@ -0,0 +1,8 @@ -+ELFÀ @XJ@8 @@@ @ øø88 8   PP@ > ~  ~ x€@0>0~ 0~ ÐÐHH H DDPåtd  QåtdRåtd > ~  ~ àà/lib64/ld.so.1GNUGNU³úØk³ÑÎa43±b 2v…   -+ € ÚÍãžkš| ➃ |n‹agHYBu( ¸ x ”˜ T  ¨  libdl.so.2_ITM_deregisterTMCloneTable_ITM_registerTMCloneTabledlsymdlopenlibc.so.6sprintfabortstrlenmallocstderrfwritefprintf__libc_start_mainGLIBC_2.27__libc_csu_fini__libc_csu_init ‡‘–O‡‘–P€ X€ `€ h€ p€  x€ €€  ˆ€  € €  € (€ 0€ 8€  @€  -+­½ÏAã(­aÿÌAã­EŒ!À(àLïã( àLïáâ( àLïÁâ( àLï¡â( àLïâ( àLïaâ( àLïAâ( àL‰ä Т Œ„0 8eÀ(f ÀcEcAç ¢ Œç0 8è P¡ Œ1 8já 0¡ Œ!0 8!Lá ð  Œ!0 8!L@„àìŒáß„XìŒñß(€ @€L@ L@ä„@ßå¥ ß¥¥ I¬üE…•¥I @쌡ß(€ @€L L@cÀÿw'÷÷bßì*a À)€DÿwÿW €ì)a À(w&c@À Lÿ‹ÿS@c@ÿa À)v€À)vÀÀÄbÿ)€Äbÿ(ÿþWÄ¢ÿ)Ì¢ÿ(€ D P¥ÐÏÄ¢ÿ(ÿ{þWŒ„a À(v€À(cÀÀ Lc€ýa`Â)v@Â)v€ÂŒÅ‚ý)Œ@̲½)̲½( €¬5`ìŒÜ(&Ì‚ý(Œ&†¥€Î¤ÿ¯ýW ü¿´PÌ‚ý(ŒAÀŒ&„ÿÃýWŒŒMÀ„ÿ£ýWŒÌ¢ÿ)Ì‚ý(ŒAÀŒ&‡ÆÐÍ¥ÎÄ¢ÿ(ÿ£ýWÌ¢ÿ(Ìâý) Œ €Ì"¾)ÌâýÌBþ) €Ì2¾) €Ìb>)Ì‚ý(Œ!ÀŒ&„ÿ»þWŒÌ‚ÿ)Ì‚ÿ(€1D쌱Ø(Œ&‡˜€€„PÌÿïüW ü¿äPÏ"þ΢þÍ‚þÌ‚ÿ(æÅ¤LŒÌr¿)Ìr¿(€1dìŒA×(Œ&‡T€€„€Ëÿ“üW ü¿ˆPÌ¢þ(Œ&ŒÁÀ(΢þ(Í‚ý(­aÀ­&¥ÄLÄBÿ)ÌBÿ(€å@Ì¢þ(Œ&Œ!Î(Í¢þ(ç€ÊÆÀÊÅBÿ(¤LÄ"ÿ)Ì"ÿ(€µ@Ì¢þ(Œ&ŒáÔ(Í¢þ(¥ ʤLÄÿ)Ìÿ(€‘@Ì¢þ(Œ&ŒÁÀ(Í¢þ(¥°É¤LÄâþ)Ì¢þ(Œ&ŒÕ(Í¢þ(Çÿ(Æâþ(€¤LÄÂþ)ÌÂþ(€E@Ì¢þ(Œ&Œ¡Ñ(Í¢þ(ÇÂþ(Æ"ÿ(ÅBÿ(¤L P@P@P@P@Ì¢þ(Œ&ŒáÁ(Í¢þ(¤LŒ€@Ì¢þ(Œ&ŒÂ(Í¢þ(¤LÌ‚þ(Œ&ŒaÀ(Í‚þ(¤L „a`Â(v@Â(c€Â L@cÿwÀÀ)y€À)÷÷rÆù9sÆ9ßaàÀ)x À)z`À){@À)| À)9I ;@Ü»š@ì&†eDÀL÷"À8çÿ_aàÀ(wÀÀ(x À(y€À(z`À({@À(| À(cÁ L@ L@JNI_CreateJavaVMUsage: %s jvm-path classpath class -+-Djava.class.path=%s%scan't get address of JNI_CreateJavaVM -+Can't create Java VM -+([Ljava/lang/String;)Vmain from C!java/lang/String;¼ùÿÿ,zR| À „ð ¸ O ~ (~  õþÿoè ˜   -+È € ¨€ À h þÿÿo€ ÿÿÿoðÿÿo` ÿÿÿÿÿÿÿÿ0 0 0 0 0 0 0 0~ GCC: (Loongnix 8.3.0-6.lnd.vec.24+b1) 8.3.08 H h  è  ˜ `  €  -+À  €  0  À     ~ (~ 0~ € H€ € ˜€ ñÿ  H  x ! ¸ 7˜€ F(~ m ð y ~ ˜ñÿñÿ£L ñÿ±(~ Â0~ Ë ~ Þ ñH€   + GZm˜€ t’¤· ø \Ì€ Ù èû x ”½ €  6 À „1˜€ = T  BUH€ a crtstuff.cderegister_tm_clones__do_global_dtors_auxcompleted.6858__do_global_dtors_aux_fini_array_entryframe_dummy__frame_dummy_init_array_entrylauncher.c__FRAME_END____init_array_end_DYNAMIC__init_array_start__GNU_EH_FRAME_HDR_GLOBAL_OFFSET_TABLE___libc_csu_finifprintf@@GLIBC_2.27_ITM_deregisterTMCloneTablefwrite@@GLIBC_2.27malloc@@GLIBC_2.27_edata__libc_start_main@@GLIBC_2.27abort@@GLIBC_2.27strlen@@GLIBC_2.27JNU_FindCreateJavaVM__dso_handle_IO_stdin_useddlopen@@GLIBC_2.27__libc_csu_initsprintf@@GLIBC_2.27dlsym@@GLIBC_2.27__bss_startmainstderr@@GLIBC_2.27__TMC_END___ITM_registerTMCloneTable.symtab.strtab.shstrtab.interp.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.text.rodata.eh_frame_hdr.eh_frame.init_array.fini_array.dynamic.got.plt.got.sdata.bss.comment8 8#H H 1h h$H TDöÿÿoè è0N  €V˜ ˜È^ÿÿÿo` ` kþÿÿo€ €@zÀ ÀÀ„B€ €¨‰0 0ŽÀ ÀX”  éœ ª 8´ ~  >À(~ (>Ì0~ 0>ÐÕ€ @HÞH€ H@H〠@ꘀ ˜@ï0˜@,È@* àF{[Iø -\ 文件末尾没有æ¢è¡Œç¬¦ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/test/sun/management/jmxremote/bootstrap/linux-mips64el/launcher b/jdk/test/sun/management/jmxremote/bootstrap/linux-mips64el/launcher ---- a/jdk/test/sun/management/jmxremote/bootstrap/linux-mips64el/launcher 1970-01-01 08:00:00.000000000 +0800 -+++ b/jdk/test/sun/management/jmxremote/bootstrap/linux-mips64el/launcher 2023-12-20 09:23:22.678114913 +0800 -@@ -0,0 +1,22 @@ -+ELF` @Ø"€@8 @! @@@øø   p888TTXXX0Hààà@@¸¸¸$$444 @(ö²€”(€”(€”(²€”(<²€”(üò€”(p?²€”(€”(°€”GNUT·EîïÁ±¤o—"M‚Pê±L·¿# ðX`  Ð -+< 5pÐà -+@ppp -+pppp -+ûÿÿoþÿÿo€ -+ÿÿÿoðÿÿoL -+ -+   , Xñÿè 0  € °¨I À è& y àТ ½Àʰ< ÒN"Ù€ýp¶`Ã] “"_DYNAMIC_LINKING__RLD_MAP__libc_csu_init__libc_csu_fini__libc_start_main__gmon_start___ITM_deregisterTMCloneTable_ITM_registerTMCloneTable__cxa_finalize_Jv_RegisterClassesdlopendlsymstderrfprintfstrlenmallocsprintfJNU_FindCreateJavaVMfwritelibdl.so.2libc.so.6_IO_stdin_usedGLIBC_2.0GLIBC_2.20ii (ii 2ii (ii 2X`€ðÿ½g¼ÿ<-à™¿ÿ`‰œgÈ€‚ß@È€™ß ø ¿ß¼ßà½g%à%È€<‰œ'-àŸ%ø €„ߥߦgðÿ$$è¡(€‡ß0€ˆß%H@%P ¸€™ß ø ÿÿ<-yÀˆcd8€dÜ@€b܈„dBd/DB,@ð€yÜ  à<-yxˆcd8€dÜ@€e܈„d/(¤û(þ-(E{( €yÜ  ààÿ½g¼ÿ<-à™(ˆœg°ÿ8€ß¿ÿ’ @ø€‚ß@H€‚ßø€™ß ø DÜP€™ßÀ 9gÇÿ$¢¿ß¼ß°ßà ½gðÿ½g¼ÿ<-à™¸‡œg8€‚ß¿ÿhDd‚Ü@ €™ßP€™ß¿ß¼ß 9gÀÿ½gøÿ  ø õÿP€™ßÀÿ½g8¿ÿ0¾ÿ(¼ÿ%ð <-à™P‡œgÄÿ$Äßà€‚ß%È@ ø ÂÿÂß@%P€‚ß0EdÄߨ€‚ß%È@ ø %èÀ8¿ß0¾ß(¼ß@½gàPÿ½g¨¿ÿ ¾ÿ˜¼ÿ%ð <-à™À†œg%€ˆÅÿ€Â¯€ÂB(@耂ßC܈ÂßBÜ%0@P€‚ßHEd% `°€‚ß%È@ ø ÿÿ$ÕˆÂßBdBÜ% @À€‚ß%È@ ø Bd% @Ѐ‚ß%È@ ø ÂÿˆÂßBdBÜ%8@P€‚ßpFdP€‚߈EdÄߘ€‚ß%È@ ø ÂßhÂÿ<B4P¯hÂgXÂÿ$T¯$`£ˆÂßBdBÜ% @X€‚ß%È@ÿÂÿÂß@耂ßBÜ%8@&$$P€‚ßDdØ€‚ß%È@ ø ÿÿ$”PÅg@ÄgHÃgÂß%0 %(€% `%È@ ø ¯ÂA耂ßBÜ%8@$$P€‚߸DdØ€‚ß%È@ ø ÿÿ$x@ÂßBÜ0BÜ@Ä߈ÃßcdcÜ%(`%È@ ø ÂÿÂßD@@ÂßB܈BÜ@ÄßP€ƒßÐgdP€ƒßèfdÅß%È@ ø  Âÿ Âß7@@ÂßBÜ8BÜ@ÄßP€ƒßðed%È@ ø (Âÿ(Âß-@@ÂßBÜ0BÜ@ÄßP€ƒßed%È@ ø 0Âÿ@ÂßBÜ`BÜ@Ãß(Çß0Æß$% `%È@ ø 8Âÿ8Âß@@ÂßBÜhBÜ@Ãß8Çß ÆßÅß% `%È@ ø  @ÂßBÜxBÜ@Ãß% `%È@ ø  @@ÂßBÜ€BÜ@Ãß% `%È@ ø HÂßBÜBÜHÃß% `%È@ ø %%èÀ¨¿ß ¾ß˜¼ß°½gàÀÿ½g0¼ÿ<-à™Ђœg²ÿ°ÿ`€’ßh€ßp€™ß/P(µÿ ´ÿ³ÿ8¿ÿ±ÿû%˜€%  Hþ%¨À -+@%ˆÞ%0 %(€% ` ø 1fùÿQf8¿ß0¼ß(µß ´ß³ß²ß±ß°ßà@½gà€™ß%xà ø d€™ß%xà ø d€™ß%xà ø d€™ß%xà ø d€™ß%xà ø d€™ß%xà ø d€™ß%xà ø  d€™ß%xà ø  dðÿ½g¼ÿ<-à™¿ÿœg¿ß¼ßà½gJNI_CreateJavaVMUsage: %s jvm-path classpath class -+-Djava.class.path=%s%scan't get address of JNI_CreateJavaVM -+Can't create Java VM -+([Ljava/lang/String;)Vmain from C!java/lang/String/lib64/ld.so.1GNUÈ X €À °Xˆ€0 `X ÐÀ° €p`€GCC: (Debian 6.3.0-18+deb9u1) 6.3.0 201705160 Ðøÿÿÿ@À Ðøÿÿÿ°°?øÿÿÿ@XAgnu8P¸à Ð L -+ € -+ -+à -+  `  `ð  04X`hp€€ñÿQ ° Uñÿ`hm À o  ‚ X ˜§`Î È ÚXùñÿUñÿ0hñÿ `+`<€IñÿàRXeˆqñÿ‡€”‹ X›"µñÿÆ H!pâôˆ•ðû` p€1 0 FpS"b qpxŠ §°º€Ä °¨ÔÀ7 åˆñ À èö ` þ `  Ð,ˆ2 Î /usr/lib/gcc/mips64el-linux-gnuabi64/6/../../../mips64el-linux-gnuabi64/Scrt1.ohltcrtstuff.c__JCR_LIST__deregister_tm_clones__do_global_dtors_auxcompleted.6216__do_global_dtors_aux_fini_array_entryframe_dummy__frame_dummy_init_array_entrylauncher.c__FRAME_END____JCR_END___MIPS_STUBS___init_array_end__dso_handle_DYNAMIC__init_array_start__TMC_END___GLOBAL_OFFSET_TABLE__gp__libc_csu_fini__cxa_finalize@@GLIBC_2.2_DYNAMIC_LINKING_ITM_deregisterTMCloneTablestderr@@GLIBC_2.0_edatadlopen@@GLIBC_2.2fwrite@@GLIBC_2.0malloc@@GLIBC_2.0JNU_FindCreateJavaVM__data_start__gmon_start___IO_stdin_used_fdatastrlen@@GLIBC_2.0__libc_start_main@@GLIBC_2.0fprintf@@GLIBC_2.0__RLD_MAP__libc_csu_initdlsym@@GLIBC_2.0__bss_startmain__start_ftext_Jv_RegisterClassessprintf@@GLIBC_2.0_fbss_ITM_registerTMCloneTable.symtab.strtab.shstrtab.MIPS.abiflags.MIPS.options.note.gnu.build-id.dynamic.hash.dynsym.dynstr.gnu.version.gnu.version_r.rel.dyn.init.text.MIPS.stubs.fini.rodata.interp.eh_frame.note.ABI-tag.init_array.fini_array.jcr.data.rld_map.got.sdata.bss.comment.pdr.gnu.attributes*p88* pPPh8¸¸$Kàà@T  ¬Z ÐÐ@b  <jÿÿÿoL -+L -+0wþÿÿo€ -+€ -+`† à -+à -+@ @•` ` ›``§ðð(­  µ  ½00Ç44 ÕXXá``íhhòppø€€ð€€ ˆ0ˆ-¸€ õÿÿo8H6 XL¤!0 -\ 文件末尾没有æ¢è¡Œç¬¦ -diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/test/sun/security/pkcs11/PKCS11Test.java b/jdk/test/sun/security/pkcs11/PKCS11Test.java ---- a/jdk/test/sun/security/pkcs11/PKCS11Test.java 2024-01-11 09:53:23.000000000 +0800 -+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java 2023-12-20 09:23:22.824779901 +0800 +diff --git a/jdk/test/sun/management/jmxremote/bootstrap/linux-loongarch64/launcher b/jdk/test/sun/management/jmxremote/bootstrap/linux-loongarch64/launcher +new file mode 100755 +index 0000000000..66291c7522 +Binary files /dev/null and b/jdk/test/sun/management/jmxremote/bootstrap/linux-loongarch64/launcher differ +diff --git a/jdk/test/sun/management/jmxremote/bootstrap/linux-mips64el/launcher b/jdk/test/sun/management/jmxremote/bootstrap/linux-mips64el/launcher +new file mode 100644 +index 0000000000..5c8385ca12 +Binary files /dev/null and b/jdk/test/sun/management/jmxremote/bootstrap/linux-mips64el/launcher differ +diff --git a/jdk/test/sun/security/pkcs11/PKCS11Test.java b/jdk/test/sun/security/pkcs11/PKCS11Test.java +index 5fc9c605de..9db6a17d66 100644 +--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java ++++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java @@ -21,6 +21,11 @@ * questions. */ @@ -116337,7 +116923,7 @@ diff -Naur -x .git -x .github -x .gitattributes -x .gitignore -x .jcheck a/jdk/t // common infrastructure for SunPKCS11 tests -@@ -589,6 +594,9 @@ +@@ -589,6 +594,9 @@ public abstract class PKCS11Test { "/usr/lib64/"}); osMap.put("Linux-ppc64-64", new String[]{"/usr/lib64/"}); osMap.put("Linux-ppc64le-64", new String[]{"/usr/lib64/"}); diff --git a/add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch b/add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch index 8e17274c4597f408163f946040cd684224ad93f1..5adaf4b3e15f28e0b7aad3d6fd97d7e149493a0f 100644 --- a/add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch +++ b/add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch @@ -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 diff --git a/add-riscv64-support.patch b/add-riscv64-support.patch index 2e1d7ab449e8500c014c98b29e9a8b9468fd90f0..8dda639edb126fd67e2c9647ca17501be2921039 100644 --- a/add-riscv64-support.patch +++ b/add-riscv64-support.patch @@ -33,12 +33,12 @@ index 1aab2b30..662b002a 100644 | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 -index 51df988f..1cce0e4f 100644 +index f54942ac..790e28aa 100644 --- a/common/autoconf/platform.m4 +++ b/common/autoconf/platform.m4 -@@ -96,6 +96,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], +@@ -102,6 +102,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], VAR_CPU_BITS=64 - VAR_CPU_ENDIAN=big + VAR_CPU_ENDIAN=little ;; + riscv64) + VAR_CPU=riscv64 @@ -49,19 +49,19 @@ index 51df988f..1cce0e4f 100644 *) AC_MSG_ERROR([unsupported cpu $1]) ;; -@@ -381,6 +387,7 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], +@@ -387,6 +393,7 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], sparc*) ZERO_ARCHDEF=SPARC ;; x86_64*) ZERO_ARCHDEF=AMD64 ;; x86) ZERO_ARCHDEF=IA32 ;; -+ riscv*) ZERO_ARCHDEF=RISCV ;; ++ riscv*) ZERO_ARCHDEF=RISCV ;; *) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z) esac AC_SUBST(ZERO_ARCHDEF) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp -index 2d3880b3..6ec35ec1 100644 +index 54cfcdd1..88eb8acd 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp -@@ -367,7 +367,7 @@ void os::init_system_properties_values() { +@@ -363,7 +363,7 @@ void os::init_system_properties_values() { // 1: ... // ... // 7: The default directories, normally /lib and /usr/lib. @@ -70,38 +70,38 @@ index 2d3880b3..6ec35ec1 100644 #define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib" #else #define DEFAULT_LIBPATH "/lib:/usr/lib" -@@ -1953,6 +1953,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) +@@ -1949,6 +1949,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) #ifndef EM_AARCH64 #define EM_AARCH64 183 /* ARM AARCH64 */ #endif + #ifndef EM_RISCV + #define EM_RISCV 243 /* RISC-V */ + #endif - - static const arch_t arch_array[]={ - {EM_386, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"}, + #ifndef EM_LOONGARCH + #define EM_LOONGARCH 258 /* LoongArch */ + #endif @@ -1976,6 +1979,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) - {EM_PARISC, EM_PARISC, ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"}, {EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"}, {EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"}, + {EM_LOONGARCH, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB, (char*)"LoongArch"}, + {EM_RISCV, EM_RISCV, ELFCLASSNONE, ELFDATA2MSB, (char*)"RISCV"}, }; #if (defined IA32) -@@ -2008,9 +2012,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) - static Elf32_Half running_arch_code=EM_68K; - #elif (defined AARCH64) +@@ -2010,9 +2014,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) static Elf32_Half running_arch_code=EM_AARCH64; + #elif (defined LOONGARCH) + static Elf32_Half running_arch_code=EM_LOONGARCH; + #elif (defined RISCV) + static Elf32_Half running_arch_code=EM_RISCV; #else #error Method os::dll_load requires that one of following is defined:\ -- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64 -+ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, RISCV +- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH ++ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH, RISCV #endif // Identify compatability class for VM's architecture and library's architecture -@@ -2043,10 +2049,12 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) +@@ -2045,10 +2051,12 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) } #ifndef S390 @@ -114,5 +114,3 @@ index 2d3880b3..6ec35ec1 100644 #endif // !S390 if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) { --- -2.17.1 diff --git a/add-safe-compilation-flags.patch b/add-safe-compilation-flags.patch index ccd57a663bffc015999a8ec329536871ffc64114..bf61aca88aea52986c7822813f650d9323c6f446 100644 --- a/add-safe-compilation-flags.patch +++ b/add-safe-compilation-flags.patch @@ -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" diff --git a/fix-log-bug-enhance-aes-hmac-performance.patch b/fix-log-bug-enhance-aes-hmac-performance.patch index c4110a17189c104a70107927ecc75b781e52fa47..a859556836293730380f8df8f4dea0a13aa9427d 100644 --- a/fix-log-bug-enhance-aes-hmac-performance.patch +++ b/fix-log-bug-enhance-aes-hmac-performance.patch @@ -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 diff --git a/fix_X509TrustManagerImpl_symantec_distrust.patch b/fix_X509TrustManagerImpl_symantec_distrust.patch index 65eeab574e11fab612e15f7535da3be6218528fa..777cba018c375417c2a84ce8dc20f495af652f24 100644 --- a/fix_X509TrustManagerImpl_symantec_distrust.patch +++ b/fix_X509TrustManagerImpl_symantec_distrust.patch @@ -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") diff --git a/jdk8u-jdk8u412-b08.tar.xz b/jdk8u-jdk8u422-b05.tar.xz similarity index 82% rename from jdk8u-jdk8u412-b08.tar.xz rename to jdk8u-jdk8u422-b05.tar.xz index 41cfa2c9f1415ac1eb687d9ce7f4919ee9e95725..3fba88a6361cbf5235899dfc1b8713f5b489101a 100644 Binary files a/jdk8u-jdk8u412-b08.tar.xz and b/jdk8u-jdk8u422-b05.tar.xz differ diff --git a/openjdk-1.8.0.spec b/openjdk-1.8.0.spec index d05e97b19300342dbbe6e1d125163689379bc265..cab489fdd901c7e6c687fdc85ebc26e33518a3ca 100644 --- a/openjdk-1.8.0.spec +++ b/openjdk-1.8.0.spec @@ -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: 2 +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 @@ -1320,7 +1327,19 @@ Patch428: 8223486-split-if-update_uses-accesses-stale-idom-dat.patch #412 Patch429: 8256488-Use-ldpq-stpq-instead-of-ld4-st4-for-small-c.patch -Patch430: 8138922-StubCodeDesc-constructor-publishes-partially-constructed.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 @@ -1964,6 +1983,18 @@ pushd %{top_level_dir_name} %patch428 -p1 %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 @@ -2622,9 +2653,53 @@ cjc.mainProgram(arg) %endif %changelog -* Mon May 6 2024 neu-mobi -1:1.8.0.412-b08.2 +* Thu Tue 16 2024 Autistic_boyya -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 -1:1.8.0.412-b08.9 +- Add support-KAE-zip.patch + +* Fri Jun 21 2024 songliyang -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 -1:1.8.0.412-b08.7 +- update LoongArch64 port to 8u412 + +* Wed Jun 19 2024 neu-mobi -1:1.8.0.412-b08.6 +- Fix aarch64 runtime thread signal transfer bug + +* Thu May 23 2024 Dingli Zhang -1:1.8.0.412-b08.5 +- Fix build on riscv64 in prep stage + +* Wed May 15 2024 songliyang -1:1.8.0.412-b08.4 +- fix LoongArch64-support.patch error that apply patch on loongarch64 in prep stage +- fix loongson vendor error + +* Tue May 7 2024 kuenking111 -1:1.8.0.412-b08.3 +- add DependencyContext-mark_dependent_nmethods-crash-in-Dynamic-cds-mode.patch - add 8138922-StubCodeDesc-constructor-publishes-partially-constructed.patch +* Tue May 07 2024 zhangxianting -1:1.8.0.412-b08.2 +- fix LoongArch64-support.patch for prep error + * Sun Apr 28 2024 Autistic_boyya -1:1.8.0.412-b08.1 - add 8256488-Use-ldpq-stpq-instead-of-ld4-st4-for-small-c.patch diff --git a/support-KAE-zip.patch b/support-KAE-zip.patch new file mode 100644 index 0000000000000000000000000000000000000000..3f584e597e26891f23e09c364f7b882605c185f9 --- /dev/null +++ b/support-KAE-zip.patch @@ -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 + diff --git a/update-cacerts-and-VerifyCACerts.java-test.patch b/update-cacerts-and-VerifyCACerts.java-test.patch index 4128a07b63afd355bbe18e3a7cfd327cd31e7e86..3bcc6f44392f5b2669c39d87c37b3b43ebcd0dfc 100644 --- a/update-cacerts-and-VerifyCACerts.java-test.patch +++ b/update-cacerts-and-VerifyCACerts.java-test.patch @@ -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