MIPS: Follow-up to "Add two special runtime methods"
This is a MIPS-specific follow-up to
https://android-review.googlesource.com/449659.
Test: booted MIPS64 (with 2nd arch MIPS32R6) in QEMU
Test: test-art-target-gtest
Test: testrunner.py --target --optimizing
Test: same tests as above on CI20
Test: booted MIPS32R2 in QEMU
Bug: 33616143
Change-Id: I6428e7dccf2a5dcd0dd1135cf11cbcc0cf201c27
diff --git a/runtime/arch/mips/quick_entrypoints_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S
index 59a2c10..bb82d58 100644
--- a/runtime/arch/mips/quick_entrypoints_mips.S
+++ b/runtime/arch/mips/quick_entrypoints_mips.S
@@ -341,7 +341,7 @@
* Reserves FRAME_SIZE_SAVE_EVERYTHING + ARG_SLOT_SIZE bytes on the stack.
* This macro sets up $gp; entrypoints using it should start with ENTRY_NO_GP.
*/
-.macro SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP
+.macro SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP runtime_method_offset = RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET
// Ugly compile-time check, but we only have the preprocessor.
#if (FRAME_SIZE_SAVE_EVERYTHING != 256)
#error "FRAME_SIZE_SAVE_EVERYTHING(MIPS) size not as expected."
@@ -433,7 +433,7 @@
lw $t0, %got(_ZN3art7Runtime9instance_E)($gp)
lw $t0, 0($t0)
- lw $t0, RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET($t0)
+ lw $t0, \runtime_method_offset($t0)
sw $t0, 0($sp) # Place Method* at bottom of stack.
sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame.
addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack
@@ -450,10 +450,10 @@
* Reserves FRAME_SIZE_SAVE_EVERYTHING + ARG_SLOT_SIZE bytes on the stack.
* This macro sets up $gp; entrypoints using it should start with ENTRY_NO_GP.
*/
-.macro SETUP_SAVE_EVERYTHING_FRAME
+.macro SETUP_SAVE_EVERYTHING_FRAME runtime_method_offset = RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET
addiu $sp, $sp, -(FRAME_SIZE_SAVE_EVERYTHING)
.cfi_adjust_cfa_offset (FRAME_SIZE_SAVE_EVERYTHING)
- SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP
+ SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP \runtime_method_offset
.endm
.macro RESTORE_SAVE_EVERYTHING_FRAME restore_a0=1
@@ -2008,10 +2008,10 @@
// Macro for string and type resolution and initialization.
// $a0 is both input and output.
-.macro ONE_ARG_SAVE_EVERYTHING_DOWNCALL name, entrypoint
+.macro ONE_ARG_SAVE_EVERYTHING_DOWNCALL name, entrypoint, runtime_method_offset = RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET
.extern \entrypoint
ENTRY_NO_GP \name
- SETUP_SAVE_EVERYTHING_FRAME # Save everything in case of GC.
+ SETUP_SAVE_EVERYTHING_FRAME \runtime_method_offset # Save everything in case of GC.
move $s2, $gp # Preserve $gp across the call for exception delivery.
la $t9, \entrypoint
jalr $t9 # (uint32_t index, Thread*)
@@ -2027,6 +2027,10 @@
END \name
.endm
+.macro ONE_ARG_SAVE_EVERYTHING_DOWNCALL_FOR_CLINIT name, entrypoint
+ ONE_ARG_SAVE_EVERYTHING_DOWNCALL \name, \entrypoint, RUNTIME_SAVE_EVERYTHING_FOR_CLINIT_METHOD_OFFSET
+.endm
+
/*
* Entry from managed code to resolve a string, this stub will allocate a String and deliver an
* exception on error. On success the String is returned. A0 holds the string index. The fast
@@ -2039,12 +2043,12 @@
* initializer and deliver the exception on error. On success the static storage base is
* returned.
*/
-ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode
+ONE_ARG_SAVE_EVERYTHING_DOWNCALL_FOR_CLINIT art_quick_initialize_static_storage, artInitializeStaticStorageFromCode
/*
* Entry from managed code when dex cache misses for a type_idx.
*/
-ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode
+ONE_ARG_SAVE_EVERYTHING_DOWNCALL_FOR_CLINIT art_quick_initialize_type, artInitializeTypeFromCode
/*
* Entry from managed code when type_idx needs to be checked for access and dex cache may also
@@ -2063,7 +2067,8 @@
jalr $zero, $ra
nop
1:
- SETUP_SAVE_EVERYTHING_FRAME # save everything for stack crawl
+ SETUP_SAVE_EVERYTHING_FRAME RUNTIME_SAVE_EVERYTHING_FOR_SUSPEND_CHECK_METHOD_OFFSET
+ # save everything for stack crawl
la $t9, artTestSuspendFromCode
jalr $t9 # (Thread*)
move $a0, rSELF
diff --git a/runtime/arch/mips64/quick_entrypoints_mips64.S b/runtime/arch/mips64/quick_entrypoints_mips64.S
index 3b92daa..7350c85 100644
--- a/runtime/arch/mips64/quick_entrypoints_mips64.S
+++ b/runtime/arch/mips64/quick_entrypoints_mips64.S
@@ -345,7 +345,7 @@
* $f0-$f31; 28(GPR)+ 32(FPR) + 1x8 bytes padding + method*
* This macro sets up $gp; entrypoints using it should start with ENTRY_NO_GP.
*/
-.macro SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP
+.macro SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP runtime_method_offset = RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET
// Ugly compile-time check, but we only have the preprocessor.
#if (FRAME_SIZE_SAVE_EVERYTHING != 496)
#error "FRAME_SIZE_SAVE_EVERYTHING(MIPS64) size not as expected."
@@ -452,7 +452,7 @@
# load appropriate callee-save-method
ld $t1, %got(_ZN3art7Runtime9instance_E)($gp)
ld $t1, 0($t1)
- ld $t1, RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET($t1)
+ ld $t1, \runtime_method_offset($t1)
sd $t1, 0($sp) # Place ArtMethod* at bottom of stack.
# Place sp in Thread::Current()->top_quick_frame.
sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF)
@@ -465,10 +465,10 @@
* $f0-$f31; 28(GPR)+ 32(FPR) + 1x8 bytes padding + method*
* This macro sets up $gp; entrypoints using it should start with ENTRY_NO_GP.
*/
-.macro SETUP_SAVE_EVERYTHING_FRAME
+.macro SETUP_SAVE_EVERYTHING_FRAME runtime_method_offset = RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET
daddiu $sp, $sp, -(FRAME_SIZE_SAVE_EVERYTHING)
.cfi_adjust_cfa_offset (FRAME_SIZE_SAVE_EVERYTHING)
- SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP
+ SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP \runtime_method_offset
.endm
.macro RESTORE_SAVE_EVERYTHING_FRAME restore_a0=1
@@ -1925,10 +1925,10 @@
// Macro for string and type resolution and initialization.
// $a0 is both input and output.
-.macro ONE_ARG_SAVE_EVERYTHING_DOWNCALL name, entrypoint
+.macro ONE_ARG_SAVE_EVERYTHING_DOWNCALL name, entrypoint, runtime_method_offset = RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET
.extern \entrypoint
ENTRY_NO_GP \name
- SETUP_SAVE_EVERYTHING_FRAME # Save everything in case of GC.
+ SETUP_SAVE_EVERYTHING_FRAME \runtime_method_offset # Save everything in case of GC.
dla $t9, \entrypoint
jalr $t9 # (uint32_t index, Thread*)
move $a1, rSELF # Pass Thread::Current (in delay slot).
@@ -1941,6 +1941,10 @@
END \name
.endm
+.macro ONE_ARG_SAVE_EVERYTHING_DOWNCALL_FOR_CLINIT name, entrypoint
+ ONE_ARG_SAVE_EVERYTHING_DOWNCALL \name, \entrypoint, RUNTIME_SAVE_EVERYTHING_FOR_CLINIT_METHOD_OFFSET
+.endm
+
/*
* Entry from managed code to resolve a string, this stub will allocate a String and deliver an
* exception on error. On success the String is returned. A0 holds the string index. The fast
@@ -1953,12 +1957,12 @@
* initializer and deliver the exception on error. On success the static storage base is
* returned.
*/
-ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode
+ONE_ARG_SAVE_EVERYTHING_DOWNCALL_FOR_CLINIT art_quick_initialize_static_storage, artInitializeStaticStorageFromCode
/*
* Entry from managed code when dex cache misses for a type_idx.
*/
-ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode
+ONE_ARG_SAVE_EVERYTHING_DOWNCALL_FOR_CLINIT art_quick_initialize_type, artInitializeTypeFromCode
/*
* Entry from managed code when type_idx needs to be checked for access and dex cache may also
@@ -1977,7 +1981,8 @@
jalr $zero, $ra
nop
1:
- SETUP_SAVE_EVERYTHING_FRAME # save everything for stack crawl
+ SETUP_SAVE_EVERYTHING_FRAME RUNTIME_SAVE_EVERYTHING_FOR_SUSPEND_CHECK_METHOD_OFFSET
+ # save everything for stack crawl
jal artTestSuspendFromCode # (Thread*)
move $a0, rSELF
RESTORE_SAVE_EVERYTHING_FRAME