Skip to content

Commit 61000e9

Browse files
committed
LOONGSON: LoongArch port
Squashed commit of the following: commit 06f00bc81c7d0dc3e83363fd2b00dd6b03f4d62a Merge: 15f5afd71be3 eed263c Author: aoqi <[email protected]> Date: Thu Oct 17 10:41:06 2024 +0800 Merge commit 15f5afd71be34dd61b9044dff02e004eb2bb34b6 Author: loongson-jvm <[email protected]> Date: Thu Oct 17 10:27:02 2024 +0800 Update (2024.10.17) 11541: Prevent load reorder of VarHandle::getOpaque 34943: 8338748: [17u,21u] Test Disconnect.java compile error: cannot find symbol after JDK-8299813 commit 76487ad345f72808f2dbed45bde1fbe52f91f7b0 Merge: c6583c8c5cbd 33cd4b4 Author: aoqi <[email protected]> Date: Wed Oct 16 18:04:00 2024 +0800 Merge commit c6583c8c5cbd49c33df3dc3e65eb9644b8755bfc Author: loongson-jvm <[email protected]> Date: Wed Oct 16 18:02:45 2024 +0800 Update (2024.10.16) 34860: [MIPS] build with gtest failed after JDK-8300806 commit 6d0dc6b25f6441f3d37672ea377cc9c75e958693 Merge: 0389c6ca1b08 03cbfaa Author: aoqi <[email protected]> Date: Wed Oct 16 17:28:09 2024 +0800 Merge commit 0389c6ca1b08f91f75c63ed72edbe16abe2210c0 Merge: 00ca185ba7ea 833f65e Author: aoqi <[email protected]> Date: Fri Jul 26 14:48:30 2024 +0800 Merge commit 00ca185ba7eaf8a3bf9412bad9305fe742c3378c Merge: 4cc0b3e97643 c1c9011 Author: aoqi <[email protected]> Date: Fri Jul 26 14:47:58 2024 +0800 Merge commit 4cc0b3e97643ac46a8e64ea4f3c62510fe49e10a Author: loongson-jvm <[email protected]> Date: Fri Jul 26 11:32:26 2024 +0800 Update (2024.07.26) 33980: Fix generate__kernel_rem_pio2 commit c5070ec1c962df668c876c96554747da28c35520 Merge: c53840e66c90 c9d83d3 Author: aoqi <[email protected]> Date: Fri Jul 26 09:24:27 2024 +0800 Merge commit c53840e66c908f283ba8cf2b167cb3f5d68008fd Author: loongson-jvm <[email protected]> Date: Fri Apr 26 18:35:30 2024 +0800 Update (2024.04.26, 2nd) 34058: LA port of 8322122: Enhance generation of addresses commit af76bcbea0b9c4b802af19ba09b062ef510e1d97 Merge: 38b11e8e0166 1c40f89 Author: aoqi <[email protected]> Date: Fri Apr 26 18:25:16 2024 +0800 Merge commit 38b11e8e016687f029cad4c183de4aaaf49020d0 Author: loongson-jvm <[email protected]> Date: Fri Apr 26 18:24:13 2024 +0800 Update (2024.04.26) 33160: LA port of 8261837: SIGSEGV in ciVirtualCallTypeData::translate_from commit a41749611bd86a21d5021378bc8b0cf6c9caa1f7 Merge: 202b0ef58d93 39c9e9d Author: aoqi <[email protected]> Date: Fri Apr 26 18:07:56 2024 +0800 Merge commit 202b0ef58d9311f534f9bd10606e0e45accf92b7 Merge: 5f77562ba03d ca760c8 Author: aoqi <[email protected]> Date: Fri Jan 26 16:40:44 2024 +0800 Merge commit 5f77562ba03d1713d3615d84f8a3229a39258d41 Author: loongson-jvm <[email protected]> Date: Fri Jan 26 16:39:46 2024 +0800 Update (2024.01.26, 2nd) 24527: Fix a typo for invokeinterface in openjdk#8604 commit fe193bcbc1cb971738db7fa2d38a9d69456a2c6c Author: loongson-jvm <[email protected]> Date: Fri Jan 26 16:29:44 2024 +0800 Update (2024.01.26) 29494: Fix assert(_succ != current) failed: invariant 30985: Insert acqure membar for load-exclusive with acquire 26386: Fix atomic ops with memory order relaxed 28135: Add linux-loongarch64 to CheckedFeatures.notImplemented 33199: GHA testing failed commit a6ce2246d45bfb51c72d93e48dcf48cd6ad24917 Merge: 84bd3bf8f104 b78a848 Author: aoqi <[email protected]> Date: Fri Jan 26 16:13:03 2024 +0800 Merge commit 84bd3bf8f104c294b595be579fa4268c5c83ed82 Merge: 99147f782457 9c16e89 Author: aoqi <[email protected]> Date: Thu Dec 7 22:42:44 2023 +0800 Merge commit 99147f78245703b07fbbf35b7198521eada4cf2c Author: loongson-jvm <[email protected]> Date: Thu Dec 7 20:59:32 2023 +0800 Update (2023.12.07, 2nd) 32519: Fix for 31967 set default MaxGCPauseMillis 31967: [G1GC] Set default MaxGCPauseMillis=150ms 32564: MIPS port of 8284273: Early crashes in os::print_context on AArch64 32563: MIPS port of 8283326: Implement SafeFetch statically 32186: LA port of 8314020: Print instruction blocks in byte units 31295: Provide information when hitting a HaltNode 28314: Misc crash dump improvements 28096: LA port of 8293851: hs_err should print more stack in hex dump 26263: LA port of 8284273: Early crashes in os::print_context on AArch64 32079: LA port of 8313796: AsyncGetCallTrace crash on unreadable interpreter method pointer 30410: LA port of 8303154: Investigate and improve instruction cache flushing during compilation 23671: MIPS/LA port of 8277417: C1 LIR instruction for load-klass 25388: LA port of 8283326: Implement SafeFetch statically commit 52397e8a10845dc42966971478c0c50a75330dff Merge: e7efed5c455e dc00ae4 Author: aoqi <[email protected]> Date: Thu Dec 7 18:25:10 2023 +0800 Merge commit e7efed5c455e2af269d45f1761fb8a22a0834b78 Author: loongson-jvm <[email protected]> Date: Thu Dec 7 18:05:56 2023 +0800 Update (2023.12.07) 30457: Use membars when accessing volatile _thread_state 32163: The size of is_wide_vector should be greater than 8 bytes commit 983f139f47a778dcb225d3a514f5ca5f9f949e06 Merge: 0ca05554a068 3197a9b Author: aoqi <[email protected]> Date: Mon Aug 14 19:28:14 2023 +0800 Merge commit 0ca05554a0681d353bc743c741cec776f2e9bf5e Author: loongson-jvm <[email protected]> Date: Mon Aug 14 19:24:05 2023 +0800 Update (2023.08.14, 2nd) 30943: LA port of 8303588: [JVMCI] make JVMCI source directories conform with standard layout 22702: MIPS/LA port of 8252990: Intrinsify Unsafe.storeStoreFence commit 1f64aa86dc7214e3587472b98886550f777c890f Merge: d833eebe2384 0f531da Author: aoqi <[email protected]> Date: Mon Aug 14 17:52:34 2023 +0800 Merge commit d833eebe238495b3493dc760d56a5da4490118b7 Author: loongson-jvm <[email protected]> Date: Mon Aug 14 17:49:18 2023 +0800 Update (2023.08.14) 30285: ArrayCopy: Align destination address 27957: Mark stub code without alignment padding commit cece1917fcfc054ec2d8e7db859536b2d19b208d Author: loongson-jvm <[email protected]> Date: Mon Jul 3 21:07:28 2023 +0800 Update (2023.07.03) 31006: Fix VectorInsert 30358: Add support for ordering memory barriers 9854: Implement cross modify fence commit 2eceaca5eb843f2c040de99e82cd17a24b7167c1 Merge: f3b0a23f659e 22cdf79 Author: aoqi <[email protected]> Date: Wed May 17 14:31:52 2023 +0800 Merge commit f3b0a23f659eef01237010d69ea71d0aee9bf1a1 Author: loongson-jvm <[email protected]> Date: Wed May 17 14:29:44 2023 +0800 Update (2023.05.17) 29453: Some cpu features use hwcap detect commit 4d654249359c20b98708cb4c4c3866ea6d6657e7 Author: loongson-jvm <[email protected]> Date: Fri Feb 24 09:17:04 2023 +0800 Update (2023.02.23) 29653: windows debug build failed 29652: 8301397: [11u, 17u] Bump jtreg to fix issue with build JDK 29655: ppc64le build failed 23864: Fix caller saved fpu regset 28680: [MIPS] Fix a typo in PosixSignals::pd_hotspot_signal_handler 28678: Fix a typo in PosixSignals::pd_hotspot_signal_handler commit 9f3079d058b332d7cec1c0b4568786aa8c84c363 Merge: d4dcc0bf7b8b 2fe4285 Author: aoqi <[email protected]> Date: Tue Jan 31 19:07:27 2023 +0800 Merge commit d4dcc0bf7b8bca2f2a0095278bc573879726eb0f Author: loongson-jvm <[email protected]> Date: Tue Jan 31 16:17:39 2023 +0800 Initial commit by Loongson A LoongArch64 port (template interpreter, C1 JIT compiler and C2 JIT compiler) and a MIPS64 port (template interpreter and C2 JIT compiler). Co-authored-by: Loongson JVM team
1 parent 0b592b7 commit 61000e9

File tree

322 files changed

+118647
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+118647
-189
lines changed

make/autoconf/jvm-features.m4

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
# questions.
2424
#
2525

26+
#
27+
# This file has been modified by Loongson Technology in 2021. These
28+
# modifications are Copyright (c) 2020, 2021, Loongson Technology, and are made
29+
# available on the same license terms set forth above.
30+
#
31+
2632
###############################################################################
2733
# Terminology used in this file:
2834
#
@@ -242,6 +248,23 @@ AC_DEFUN_ONCE([JVM_FEATURES_CHECK_CDS],
242248
])
243249
])
244250

251+
###############################################################################
252+
# Check if the feature 'compiler1' is available on this platform.
253+
#
254+
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_COMPILER1],
255+
[
256+
JVM_FEATURES_CHECK_AVAILABILITY(compiler1, [
257+
AC_MSG_CHECKING([if platform is supported by COMPILER1])
258+
if test "x$HOTSPOT_TARGET_CPU_ARCH" != "xmips"; then
259+
# Disable compiler1 on mips
260+
AC_MSG_RESULT([yes])
261+
else
262+
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS])
263+
AVAILABLE=false
264+
fi
265+
])
266+
])
267+
245268
###############################################################################
246269
# Check if the feature 'dtrace' is available on this platform.
247270
#
@@ -295,6 +318,8 @@ AC_DEFUN_ONCE([JVM_FEATURES_CHECK_JVMCI],
295318
AC_MSG_RESULT([yes])
296319
elif test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
297320
AC_MSG_RESULT([yes])
321+
elif test "x$OPENJDK_TARGET_CPU" = "xloongarch64"; then
322+
AC_MSG_RESULT([yes])
298323
else
299324
AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU])
300325
AVAILABLE=false
@@ -312,7 +337,8 @@ AC_DEFUN_ONCE([JVM_FEATURES_CHECK_SHENANDOAHGC],
312337
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || \
313338
test "x$OPENJDK_TARGET_CPU" = "xaarch64" || \
314339
test "x$OPENJDK_TARGET_CPU" = "xppc64le" || \
315-
test "x$OPENJDK_TARGET_CPU" = "xriscv64"; then
340+
test "x$OPENJDK_TARGET_CPU" = "xriscv64" || \
341+
test "x$OPENJDK_TARGET_CPU" = "xloongarch64"; then
316342
AC_MSG_RESULT([yes])
317343
else
318344
AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU])
@@ -370,6 +396,13 @@ AC_DEFUN_ONCE([JVM_FEATURES_CHECK_ZGC],
370396
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
371397
AVAILABLE=false
372398
fi
399+
elif test "x$OPENJDK_TARGET_CPU" = "xloongarch64"; then
400+
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
401+
AC_MSG_RESULT([yes])
402+
else
403+
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
404+
AVAILABLE=false
405+
fi
373406
else
374407
AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
375408
AVAILABLE=false
@@ -404,6 +437,7 @@ AC_DEFUN_ONCE([JVM_FEATURES_PREPARE_PLATFORM],
404437
# JVM_FEATURES_PLATFORM_UNAVAILABLE.
405438
406439
JVM_FEATURES_CHECK_CDS
440+
JVM_FEATURES_CHECK_COMPILER1
407441
JVM_FEATURES_CHECK_DTRACE
408442
JVM_FEATURES_CHECK_JFR
409443
JVM_FEATURES_CHECK_JVMCI

make/autoconf/platform.m4

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
# questions.
2424
#
2525

26+
#
27+
# This file has been modified by Loongson Technology in 2021. These
28+
# modifications are Copyright (c) 2018, 2021, Loongson Technology, and are made
29+
# available on the same license terms set forth above.
30+
#
31+
2632
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
2733
# Converts autoconf style CPU name to OpenJDK style, into
2834
# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
@@ -539,11 +545,26 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
539545
HOTSPOT_$1_CPU=ppc_64
540546
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
541547
HOTSPOT_$1_CPU=ppc_64
548+
elif test "x$OPENJDK_$1_CPU" = xmips64; then
549+
HOTSPOT_$1_CPU=mips_64
550+
elif test "x$OPENJDK_$1_CPU" = xmips64el; then
551+
HOTSPOT_$1_CPU=mips_64
552+
elif test "x$OPENJDK_$1_CPU" = xloongarch; then
553+
HOTSPOT_$1_CPU=loongarch_64
554+
elif test "x$OPENJDK_$1_CPU" = xloongarch64; then
555+
HOTSPOT_$1_CPU=loongarch_64
542556
fi
543557
AC_SUBST(HOTSPOT_$1_CPU)
544558
545559
# This is identical with OPENJDK_*, but define anyway for consistency.
546560
HOTSPOT_$1_CPU_ARCH=${OPENJDK_$1_CPU_ARCH}
561+
# Override hotspot cpu definitions for MIPS platforms
562+
if test "x$OPENJDK_$1_CPU" = xmips64el; then
563+
HOTSPOT_TARGET_CPU_ARCH=mips
564+
elif test "x$OPENJDK_$1_CPU" = xloongarch64; then
565+
HOTSPOT_TARGET_CPU_ARCH=loongarch
566+
fi
567+
547568
AC_SUBST(HOTSPOT_$1_CPU_ARCH)
548569
549570
# Setup HOTSPOT_$1_CPU_DEFINE
@@ -563,6 +584,12 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
563584
HOTSPOT_$1_CPU_DEFINE=PPC64
564585
elif test "x$OPENJDK_$1_CPU" = xriscv64; then
565586
HOTSPOT_$1_CPU_DEFINE=RISCV64
587+
elif test "x$OPENJDK_$1_CPU" = xmips64; then
588+
HOTSPOT_$1_CPU_DEFINE=MIPS64
589+
elif test "x$OPENJDK_$1_CPU" = xmips64el; then
590+
HOTSPOT_$1_CPU_DEFINE=MIPS64
591+
elif test "x$OPENJDK_$1_CPU" = xloongarch64; then
592+
HOTSPOT_$1_CPU_DEFINE=LOONGARCH64
566593
567594
# The cpu defines below are for zero, we don't support them directly.
568595
elif test "x$OPENJDK_$1_CPU" = xsparc; then
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2015, 2021, Loongson Technology. All rights reserved.
4+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5+
*
6+
* This code is free software; you can redistribute it and/or modify it
7+
* under the terms of the GNU General Public License version 2 only, as
8+
* published by the Free Software Foundation.
9+
*
10+
* This code is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
* version 2 for more details (a copy is included in the LICENSE file that
14+
* accompanied this code).
15+
*
16+
* You should have received a copy of the GNU General Public License version
17+
* 2 along with this work; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19+
*
20+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21+
* or visit www.oracle.com if you need additional information or have any
22+
* questions.
23+
*
24+
*/
25+
26+
#include "precompiled.hpp"
27+
#include "ci/ciMethod.hpp"
28+
#include "interpreter/interpreter.hpp"
29+
#include "oops/klass.inline.hpp"
30+
#include "runtime/frame.inline.hpp"
31+
32+
// asm based interpreter deoptimization helpers
33+
int AbstractInterpreter::size_activation(int max_stack,
34+
int temps,
35+
int extra_args,
36+
int monitors,
37+
int callee_params,
38+
int callee_locals,
39+
bool is_top_frame) {
40+
// Note: This calculation must exactly parallel the frame setup
41+
// in AbstractInterpreterGenerator::generate_method_entry.
42+
43+
// fixed size of an interpreter frame:
44+
int overhead = frame::sender_sp_offset -
45+
frame::interpreter_frame_initial_sp_offset;
46+
// Our locals were accounted for by the caller (or last_frame_adjust
47+
// on the transistion) Since the callee parameters already account
48+
// for the callee's params we only need to account for the extra
49+
// locals.
50+
int size = overhead +
51+
(callee_locals - callee_params)*Interpreter::stackElementWords +
52+
monitors * frame::interpreter_frame_monitor_size() +
53+
temps* Interpreter::stackElementWords + extra_args;
54+
55+
return size;
56+
}
57+
58+
// How much stack a method activation needs in words.
59+
int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
60+
61+
const int entry_size = frame::interpreter_frame_monitor_size();
62+
63+
// total overhead size: entry_size + (saved ebp thru expr stack bottom).
64+
// be sure to change this if you add/subtract anything to/from the overhead area
65+
const int overhead_size = -(frame::interpreter_frame_initial_sp_offset) + entry_size;
66+
67+
const int stub_code = 6; // see generate_call_stub
68+
// return overhead_size + method->max_locals() + method->max_stack() + stub_code;
69+
const int method_stack = (method->max_locals() + method->max_stack()) *
70+
Interpreter::stackElementWords;
71+
return overhead_size + method_stack + stub_code;
72+
}
73+
74+
void AbstractInterpreter::layout_activation(Method* method,
75+
int tempcount,
76+
int popframe_extra_args,
77+
int moncount,
78+
int caller_actual_parameters,
79+
int callee_param_count,
80+
int callee_locals,
81+
frame* caller,
82+
frame* interpreter_frame,
83+
bool is_top_frame,
84+
bool is_bottom_frame) {
85+
// Note: This calculation must exactly parallel the frame setup
86+
// in AbstractInterpreterGenerator::generate_method_entry.
87+
// If interpreter_frame!=NULL, set up the method, locals, and monitors.
88+
// The frame interpreter_frame, if not NULL, is guaranteed to be the
89+
// right size, as determined by a previous call to this method.
90+
// It is also guaranteed to be walkable even though it is in a skeletal state
91+
92+
// fixed size of an interpreter frame:
93+
94+
int max_locals = method->max_locals() * Interpreter::stackElementWords;
95+
int extra_locals = (method->max_locals() - method->size_of_parameters()) * Interpreter::stackElementWords;
96+
97+
#ifdef ASSERT
98+
assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)");
99+
#endif
100+
101+
interpreter_frame->interpreter_frame_set_method(method);
102+
// NOTE the difference in using sender_sp and interpreter_frame_sender_sp
103+
// interpreter_frame_sender_sp is the original sp of the caller (the unextended_sp)
104+
// and sender_sp is fp+8
105+
intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1;
106+
107+
#ifdef ASSERT
108+
if (caller->is_interpreted_frame()) {
109+
assert(locals < caller->fp() + frame::interpreter_frame_initial_sp_offset, "bad placement");
110+
}
111+
#endif
112+
113+
interpreter_frame->interpreter_frame_set_locals(locals);
114+
BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin();
115+
BasicObjectLock* monbot = montop - moncount;
116+
interpreter_frame->interpreter_frame_set_monitor_end(montop - moncount);
117+
118+
//set last sp;
119+
intptr_t* esp = (intptr_t*) monbot - tempcount*Interpreter::stackElementWords -
120+
popframe_extra_args;
121+
interpreter_frame->interpreter_frame_set_last_sp(esp);
122+
// All frames but the initial interpreter frame we fill in have a
123+
// value for sender_sp that allows walking the stack but isn't
124+
// truly correct. Correct the value here.
125+
//
126+
if (extra_locals != 0 &&
127+
interpreter_frame->sender_sp() == interpreter_frame->interpreter_frame_sender_sp() ) {
128+
interpreter_frame->set_interpreter_frame_sender_sp(caller->sp() + extra_locals);
129+
}
130+
*interpreter_frame->interpreter_frame_cache_addr() = method->constants()->cache();
131+
*interpreter_frame->interpreter_frame_mirror_addr() = method->method_holder()->java_mirror();
132+
}
133+

0 commit comments

Comments
 (0)