Remove "sister" code from mterp.
The feature is barely used. Rename the snippets to "helper",
and place them in the final assembly explicitly.
Test: test-art-host-gtest
Change-Id: I5ed735f254f00338a5be54b76887bac5d6fd8512
diff --git a/runtime/interpreter/mterp/arm/floating_point.S b/runtime/interpreter/mterp/arm/floating_point.S
index 583010a..9f72464 100644
--- a/runtime/interpreter/mterp/arm/floating_point.S
+++ b/runtime/interpreter/mterp/arm/floating_point.S
@@ -327,7 +327,7 @@
%def op_double_to_long():
% unopWide(instr="bl d2l_doconv")
-%def op_double_to_long_sister_code():
+%def op_double_to_long_helper_code():
/*
* Convert the double in r0/r1 to a long in r0/r1.
*
@@ -368,7 +368,7 @@
%def op_float_to_long():
% unopWider(instr="bl f2l_doconv")
-%def op_float_to_long_sister_code():
+%def op_float_to_long_helper_code():
/*
* Convert the float in r0 to a long in r0/r1.
*
diff --git a/runtime/interpreter/mterp/arm/main.S b/runtime/interpreter/mterp/arm/main.S
index 73d45c0..dbccb46 100644
--- a/runtime/interpreter/mterp/arm/main.S
+++ b/runtime/interpreter/mterp/arm/main.S
@@ -410,6 +410,10 @@
b MterpFallback
+%def helpers():
+% op_float_to_long_helper_code()
+% op_double_to_long_helper_code()
+
%def footer():
/*
* ===========================================================================
@@ -723,13 +727,6 @@
.global artMterpAsmAltInstructionEnd
artMterpAsmAltInstructionEnd:
-%def instruction_end_sister():
-
- .type artMterpAsmSisterEnd, #object
- .hidden artMterpAsmSisterEnd
- .global artMterpAsmSisterEnd
-artMterpAsmSisterEnd:
-
%def instruction_start():
.type artMterpAsmInstructionStart, #object
@@ -745,12 +742,3 @@
.global artMterpAsmAltInstructionStart
artMterpAsmAltInstructionStart = .L_ALT_op_nop
.text
-
-%def instruction_start_sister():
-
- .type artMterpAsmSisterStart, #object
- .hidden artMterpAsmSisterStart
- .global artMterpAsmSisterStart
- .text
- .balign 4
-artMterpAsmSisterStart:
diff --git a/runtime/interpreter/mterp/arm64/main.S b/runtime/interpreter/mterp/arm64/main.S
index 37ed83d..963e724 100644
--- a/runtime/interpreter/mterp/arm64/main.S
+++ b/runtime/interpreter/mterp/arm64/main.S
@@ -435,7 +435,7 @@
mov x2, xPC
b MterpCheckBefore // (self, shadow_frame, dex_pc_ptr) Note: tail call.
-%def close_cfi():
+%def footer():
// Close out the cfi info. We're treating mterp as a single function.
END ExecuteMterpImpl
@@ -446,7 +446,7 @@
b MterpFallback
-%def footer():
+%def helpers():
/*
* ===========================================================================
* Common subroutines and data
@@ -766,13 +766,6 @@
.global artMterpAsmAltInstructionEnd
artMterpAsmAltInstructionEnd:
-%def instruction_end_sister():
-
- .type artMterpAsmSisterEnd, #object
- .hidden artMterpAsmSisterEnd
- .global artMterpAsmSisterEnd
-artMterpAsmSisterEnd:
-
%def instruction_start():
.type artMterpAsmInstructionStart, #object
@@ -788,12 +781,3 @@
.global artMterpAsmAltInstructionStart
artMterpAsmAltInstructionStart = .L_ALT_op_nop
.text
-
-%def instruction_start_sister():
-
- .type artMterpAsmSisterStart, #object
- .hidden artMterpAsmSisterStart
- .global artMterpAsmSisterStart
- .text
- .balign 4
-artMterpAsmSisterStart:
diff --git a/runtime/interpreter/mterp/common/gen_setup.py b/runtime/interpreter/mterp/common/gen_setup.py
index b2e62f6..48417e8 100644
--- a/runtime/interpreter/mterp/common/gen_setup.py
+++ b/runtime/interpreter/mterp/common/gen_setup.py
@@ -58,24 +58,14 @@
balign()
instruction_end()
- instruction_start_sister()
- write_sister()
- instruction_end_sister()
-
- # We need to footer sooner so that branch instruction can reach it.
- # TODO: Clean up.
- if arch == "arm64":
- footer()
+ helpers()
instruction_start_alt()
opcodes(is_alt = True)
balign()
instruction_end_alt()
- if arch == "arm64":
- close_cfi()
- else:
- footer()
+ footer()
out.seek(0)
# Squash consequtive empty lines.
diff --git a/runtime/interpreter/mterp/gen_mterp.py b/runtime/interpreter/mterp/gen_mterp.py
index cf69bce..98a98fc 100755
--- a/runtime/interpreter/mterp/gen_mterp.py
+++ b/runtime/interpreter/mterp/gen_mterp.py
@@ -85,29 +85,6 @@
script.write("\n")
f.close()
- # TODO: Remove the concept of sister snippets. It is barely used.
- script.write("def write_sister():\n")
- if arch == "arm":
- script.write(" op_float_to_long_sister_code()\n")
- script.write(" op_double_to_long_sister_code()\n")
- if arch == "mips":
- script.write(" global opnum, opcode\n")
- names = [
- "op_float_to_long",
- "op_double_to_long",
- "op_mul_long",
- "op_shl_long",
- "op_shr_long",
- "op_ushr_long",
- "op_shl_long_2addr",
- "op_shr_long_2addr",
- "op_ushr_long_2addr"
- ]
- for name in names:
- script.write(' opcode = "' + name + '"\n')
- script.write(" " + name + "_sister_code()\n")
- script.write(" pass\n")
-
script.write('generate()\n')
script.seek(0)
return script.read()
diff --git a/runtime/interpreter/mterp/mips/arithmetic.S b/runtime/interpreter/mterp/mips/arithmetic.S
index 0743bde..9ae10f2 100644
--- a/runtime/interpreter/mterp/mips/arithmetic.S
+++ b/runtime/interpreter/mterp/mips/arithmetic.S
@@ -441,9 +441,9 @@
GET_OPA(a0) # a0 <- AA
FETCH_ADVANCE_INST(2) # advance rPC, load rINST
b .L${opcode}_finish
-%def op_mul_long_sister_code():
+%def op_mul_long_helper_code():
-.L${opcode}_finish:
+.Lop_mul_long_finish:
GET_INST_OPCODE(t0) # extract opcode from rINST
SET_VREG64_GOTO(v0, v1, a0, t0) # vAA/vAA+1 <- v0(low)/v1(high)
@@ -586,9 +586,9 @@
sll v1, a1, a2 # rhi<- ahi << (shift&31)
or v1, a0 # rhi<- rhi | alo
SET_VREG64_GOTO(v0, v1, t2, t0) # vAA/vAA+1 <- v0/v1
-%def op_shl_long_sister_code():
+%def op_shl_long_helper_code():
-.L${opcode}_finish:
+.Lop_shl_long_finish:
SET_VREG64_GOTO(zero, v0, t2, t0) # vAA/vAA+1 <- rlo/rhi
%def op_shl_long_2addr():
@@ -615,9 +615,9 @@
sll v1, a1, a2 # rhi<- ahi << (shift&31)
or v1, a0 # rhi<- rhi | alo
SET_VREG64_GOTO(v0, v1, rOBJ, t0) # vA/vA+1 <- v0/v1
-%def op_shl_long_2addr_sister_code():
+%def op_shl_long_2addr_helper_code():
-.L${opcode}_finish:
+.Lop_shl_long_2addr_finish:
SET_VREG64_GOTO(zero, v0, rOBJ, t0) # vA/vA+1 <- rlo/rhi
%def op_shr_int():
@@ -656,9 +656,9 @@
sll a1, a0 # ahi<- ahi << (32-(shift&31))
or v0, a1 # rlo<- rlo | ahi
SET_VREG64_GOTO(v0, v1, t3, t0) # vAA/VAA+1 <- v0/v1
-%def op_shr_long_sister_code():
+%def op_shr_long_helper_code():
-.L${opcode}_finish:
+.Lop_shr_long_finish:
sra a3, a1, 31 # a3<- sign(ah)
SET_VREG64_GOTO(v1, a3, t3, t0) # vAA/VAA+1 <- rlo/rhi
@@ -685,9 +685,9 @@
sll a1, a0 # ahi<- ahi << (32-(shift&31))
or v0, a1 # rlo<- rlo | ahi
SET_VREG64_GOTO(v0, v1, t2, t0) # vA/vA+1 <- v0/v1
-%def op_shr_long_2addr_sister_code():
+%def op_shr_long_2addr_helper_code():
-.L${opcode}_finish:
+.Lop_shr_long_2addr_finish:
sra a3, a1, 31 # a3<- sign(ah)
SET_VREG64_GOTO(v1, a3, t2, t0) # vA/vA+1 <- rlo/rhi
@@ -750,9 +750,9 @@
sll a1, a0 # ahi<- ahi << (32-(shift&31))
or v0, a1 # rlo<- rlo | ahi
SET_VREG64_GOTO(v0, v1, rOBJ, t0) # vAA/vAA+1 <- v0/v1
-%def op_ushr_long_sister_code():
+%def op_ushr_long_helper_code():
-.L${opcode}_finish:
+.Lop_ushr_long_finish:
SET_VREG64_GOTO(v1, zero, rOBJ, t0) # vAA/vAA+1 <- rlo/rhi
%def op_ushr_long_2addr():
@@ -779,9 +779,9 @@
sll a1, a0 # ahi<- ahi << (32-(shift&31))
or v0, a1 # rlo<- rlo | ahi
SET_VREG64_GOTO(v0, v1, t3, t0) # vA/vA+1 <- v0/v1
-%def op_ushr_long_2addr_sister_code():
+%def op_ushr_long_2addr_helper_code():
-.L${opcode}_finish:
+.Lop_ushr_long_2addr_finish:
SET_VREG64_GOTO(v1, zero, t3, t0) # vA/vA+1 <- rlo/rhi
%def op_xor_int():
diff --git a/runtime/interpreter/mterp/mips/floating_point.S b/runtime/interpreter/mterp/mips/floating_point.S
index 6f0dda3..20df51e 100644
--- a/runtime/interpreter/mterp/mips/floating_point.S
+++ b/runtime/interpreter/mterp/mips/floating_point.S
@@ -332,12 +332,12 @@
GET_INST_OPCODE(t1) # extract opcode from rINST
b .L${opcode}_set_vreg
#endif
-%def op_double_to_long_sister_code():
+%def op_double_to_long_helper_code():
#ifndef MIPS32REVGE6
-.L${opcode}_get_opcode:
+.Lop_double_to_long_get_opcode:
GET_INST_OPCODE(t1) # extract opcode from rINST
-.L${opcode}_set_vreg:
+.Lop_double_to_long_set_vreg:
SET_VREG64_GOTO(rRESULT0, rRESULT1, rOBJ, t1) # vA/vA+1 <- v0/v1
#endif
@@ -416,12 +416,12 @@
GET_INST_OPCODE(t1) # extract opcode from rINST
b .L${opcode}_set_vreg
#endif
-%def op_float_to_long_sister_code():
+%def op_float_to_long_helper_code():
#ifndef MIPS32REVGE6
-.L${opcode}_get_opcode:
+.Lop_float_to_long_get_opcode:
GET_INST_OPCODE(t1) # extract opcode from rINST
-.L${opcode}_set_vreg:
+.Lop_float_to_long_set_vreg:
SET_VREG64_GOTO(rRESULT0, rRESULT1, rOBJ, t1) # vA/vA+1 <- v0/v1
#endif
diff --git a/runtime/interpreter/mterp/mips/main.S b/runtime/interpreter/mterp/mips/main.S
index 6e91af8..02c59b1 100644
--- a/runtime/interpreter/mterp/mips/main.S
+++ b/runtime/interpreter/mterp/mips/main.S
@@ -822,6 +822,17 @@
/* Transfer stub to alternate interpreter */
b MterpFallback
+%def helpers():
+% op_float_to_long_helper_code()
+% op_double_to_long_helper_code()
+% op_mul_long_helper_code()
+% op_shl_long_helper_code()
+% op_shr_long_helper_code()
+% op_ushr_long_helper_code()
+% op_shl_long_2addr_helper_code()
+% op_shr_long_2addr_helper_code()
+% op_ushr_long_2addr_helper_code()
+
%def footer():
/*
* ===========================================================================
@@ -1122,11 +1133,6 @@
.global artMterpAsmAltInstructionEnd
artMterpAsmAltInstructionEnd:
-%def instruction_end_sister():
-
- .global artMterpAsmSisterEnd
-artMterpAsmSisterEnd:
-
%def instruction_start():
.global artMterpAsmInstructionStart
@@ -1139,9 +1145,3 @@
artMterpAsmAltInstructionStart = .L_ALT_op_nop
.text
-%def instruction_start_sister():
-
- .global artMterpAsmSisterStart
- .text
- .balign 4
-artMterpAsmSisterStart:
diff --git a/runtime/interpreter/mterp/mips64/main.S b/runtime/interpreter/mterp/mips64/main.S
index c2c305a..517bddf 100644
--- a/runtime/interpreter/mterp/mips64/main.S
+++ b/runtime/interpreter/mterp/mips64/main.S
@@ -444,6 +444,9 @@
/* Transfer stub to alternate interpreter */
b MterpFallback
+%def helpers():
+% pass
+
%def footer():
/*
* We've detected a condition that will result in an exception, but the exception
@@ -618,7 +621,7 @@
EXPORT_PC
jal MterpMaybeDoOnStackReplacement # (self, shadow_frame, offset)
bnezc v0, MterpOnStackReplacement
- FETCH_ADVANCE_INST 2
+ FETCH_ADVANCE_INST 2
GET_INST_OPCODE v0 # extract opcode from rINST
GOTO_OPCODE v0 # jump to next instruction
@@ -732,11 +735,6 @@
.global artMterpAsmAltInstructionEnd
artMterpAsmAltInstructionEnd:
-%def instruction_end_sister():
-
- .global artMterpAsmSisterEnd
-artMterpAsmSisterEnd:
-
%def instruction_start():
.global artMterpAsmInstructionStart
@@ -748,10 +746,3 @@
.global artMterpAsmAltInstructionStart
artMterpAsmAltInstructionStart = .L_ALT_op_nop
.text
-
-%def instruction_start_sister():
-
- .global artMterpAsmSisterStart
- .text
- .balign 4
-artMterpAsmSisterStart:
diff --git a/runtime/interpreter/mterp/out/mterp_arm.S b/runtime/interpreter/mterp/out/mterp_arm.S
index b059564..6e2b1ac 100644
--- a/runtime/interpreter/mterp/out/mterp_arm.S
+++ b/runtime/interpreter/mterp/out/mterp_arm.S
@@ -6701,12 +6701,6 @@
.global artMterpAsmInstructionEnd
artMterpAsmInstructionEnd:
- .type artMterpAsmSisterStart, #object
- .hidden artMterpAsmSisterStart
- .global artMterpAsmSisterStart
- .text
- .balign 4
-artMterpAsmSisterStart:
/*
* Convert the float in r0 to a long in r0/r1.
*
@@ -6767,17 +6761,11 @@
mov r1, #0
bx lr @ return 0 for NaN
- .type artMterpAsmSisterEnd, #object
- .hidden artMterpAsmSisterEnd
- .global artMterpAsmSisterEnd
-artMterpAsmSisterEnd:
-
.type artMterpAsmAltInstructionStart, #object
.hidden artMterpAsmAltInstructionStart
.global artMterpAsmAltInstructionStart
artMterpAsmAltInstructionStart = .L_ALT_op_nop
.text
-
/* ------------------------------ */
.balign 128
.L_ALT_op_nop: /* 0x00 */
diff --git a/runtime/interpreter/mterp/out/mterp_arm64.S b/runtime/interpreter/mterp/out/mterp_arm64.S
index d65019d..24a2252 100644
--- a/runtime/interpreter/mterp/out/mterp_arm64.S
+++ b/runtime/interpreter/mterp/out/mterp_arm64.S
@@ -6226,18 +6226,6 @@
.global artMterpAsmInstructionEnd
artMterpAsmInstructionEnd:
- .type artMterpAsmSisterStart, #object
- .hidden artMterpAsmSisterStart
- .global artMterpAsmSisterStart
- .text
- .balign 4
-artMterpAsmSisterStart:
-
- .type artMterpAsmSisterEnd, #object
- .hidden artMterpAsmSisterEnd
- .global artMterpAsmSisterEnd
-artMterpAsmSisterEnd:
-
/*
* ===========================================================================
* Common subroutines and data
@@ -6547,7 +6535,6 @@
.global artMterpAsmAltInstructionStart
artMterpAsmAltInstructionStart = .L_ALT_op_nop
.text
-
/* ------------------------------ */
.balign 128
.L_ALT_op_nop: /* 0x00 */
diff --git a/runtime/interpreter/mterp/out/mterp_mips.S b/runtime/interpreter/mterp/out/mterp_mips.S
index 91d4ca1..ff2605d 100644
--- a/runtime/interpreter/mterp/out/mterp_mips.S
+++ b/runtime/interpreter/mterp/out/mterp_mips.S
@@ -6708,11 +6708,6 @@
.global artMterpAsmInstructionEnd
artMterpAsmInstructionEnd:
- .global artMterpAsmSisterStart
- .text
- .balign 4
-artMterpAsmSisterStart:
-
#ifndef MIPS32REVGE6
.Lop_float_to_long_get_opcode:
GET_INST_OPCODE(t1) # extract opcode from rINST
@@ -6751,9 +6746,6 @@
.Lop_ushr_long_2addr_finish:
SET_VREG64_GOTO(v1, zero, t3, t0) # vA/vA+1 <- rlo/rhi
- .global artMterpAsmSisterEnd
-artMterpAsmSisterEnd:
-
.global artMterpAsmAltInstructionStart
artMterpAsmAltInstructionStart = .L_ALT_op_nop
.text
diff --git a/runtime/interpreter/mterp/out/mterp_mips64.S b/runtime/interpreter/mterp/out/mterp_mips64.S
index 86b16a1..fa07442 100644
--- a/runtime/interpreter/mterp/out/mterp_mips64.S
+++ b/runtime/interpreter/mterp/out/mterp_mips64.S
@@ -6068,18 +6068,9 @@
.global artMterpAsmInstructionEnd
artMterpAsmInstructionEnd:
- .global artMterpAsmSisterStart
- .text
- .balign 4
-artMterpAsmSisterStart:
-
- .global artMterpAsmSisterEnd
-artMterpAsmSisterEnd:
-
.global artMterpAsmAltInstructionStart
artMterpAsmAltInstructionStart = .L_ALT_op_nop
.text
-
/* ------------------------------ */
.balign 128
.L_ALT_op_nop: /* 0x00 */
diff --git a/runtime/interpreter/mterp/out/mterp_x86.S b/runtime/interpreter/mterp/out/mterp_x86.S
index fb182fd..e2793ba 100644
--- a/runtime/interpreter/mterp/out/mterp_x86.S
+++ b/runtime/interpreter/mterp/out/mterp_x86.S
@@ -5660,18 +5660,6 @@
.global SYMBOL(artMterpAsmInstructionEnd)
SYMBOL(artMterpAsmInstructionEnd):
- OBJECT_TYPE(artMterpAsmSisterStart)
- ASM_HIDDEN SYMBOL(artMterpAsmSisterStart)
- .global SYMBOL(artMterpAsmSisterStart)
- .text
- .balign 4
-SYMBOL(artMterpAsmSisterStart):
-
- OBJECT_TYPE(artMterpAsmSisterEnd)
- ASM_HIDDEN SYMBOL(artMterpAsmSisterEnd)
- .global SYMBOL(artMterpAsmSisterEnd)
-SYMBOL(artMterpAsmSisterEnd):
-
OBJECT_TYPE(artMterpAsmAltInstructionStart)
ASM_HIDDEN SYMBOL(artMterpAsmAltInstructionStart)
.global SYMBOL(artMterpAsmAltInstructionStart)
diff --git a/runtime/interpreter/mterp/out/mterp_x86_64.S b/runtime/interpreter/mterp/out/mterp_x86_64.S
index abb8986..96f5204 100644
--- a/runtime/interpreter/mterp/out/mterp_x86_64.S
+++ b/runtime/interpreter/mterp/out/mterp_x86_64.S
@@ -5352,24 +5352,11 @@
.global SYMBOL(artMterpAsmInstructionEnd)
SYMBOL(artMterpAsmInstructionEnd):
- OBJECT_TYPE(artMterpAsmSisterStart)
- ASM_HIDDEN SYMBOL(artMterpAsmSisterStart)
- .global SYMBOL(artMterpAsmSisterStart)
- .text
- .balign 4
-SYMBOL(artMterpAsmSisterStart):
-
- OBJECT_TYPE(artMterpAsmSisterEnd)
- ASM_HIDDEN SYMBOL(artMterpAsmSisterEnd)
- .global SYMBOL(artMterpAsmSisterEnd)
-SYMBOL(artMterpAsmSisterEnd):
-
OBJECT_TYPE(artMterpAsmAltInstructionStart)
ASM_HIDDEN SYMBOL(artMterpAsmAltInstructionStart)
.global SYMBOL(artMterpAsmAltInstructionStart)
.text
SYMBOL(artMterpAsmAltInstructionStart) = .L_ALT_op_nop
-
/* ------------------------------ */
.balign 128
.L_ALT_op_nop: /* 0x00 */
diff --git a/runtime/interpreter/mterp/x86/main.S b/runtime/interpreter/mterp/x86/main.S
index 2dec6b4..ac0bb20 100644
--- a/runtime/interpreter/mterp/x86/main.S
+++ b/runtime/interpreter/mterp/x86/main.S
@@ -427,6 +427,9 @@
jmp MterpFallback
+%def helpers():
+% pass
+
%def footer():
/*
* ===========================================================================
@@ -768,13 +771,6 @@
.global SYMBOL(artMterpAsmAltInstructionEnd)
SYMBOL(artMterpAsmAltInstructionEnd):
-%def instruction_end_sister():
-
- OBJECT_TYPE(artMterpAsmSisterEnd)
- ASM_HIDDEN SYMBOL(artMterpAsmSisterEnd)
- .global SYMBOL(artMterpAsmSisterEnd)
-SYMBOL(artMterpAsmSisterEnd):
-
%def instruction_start():
OBJECT_TYPE(artMterpAsmInstructionStart)
@@ -791,11 +787,3 @@
.text
SYMBOL(artMterpAsmAltInstructionStart) = .L_ALT_op_nop
-%def instruction_start_sister():
-
- OBJECT_TYPE(artMterpAsmSisterStart)
- ASM_HIDDEN SYMBOL(artMterpAsmSisterStart)
- .global SYMBOL(artMterpAsmSisterStart)
- .text
- .balign 4
-SYMBOL(artMterpAsmSisterStart):
diff --git a/runtime/interpreter/mterp/x86_64/main.S b/runtime/interpreter/mterp/x86_64/main.S
index aa47c6d..83dc27f 100644
--- a/runtime/interpreter/mterp/x86_64/main.S
+++ b/runtime/interpreter/mterp/x86_64/main.S
@@ -407,6 +407,9 @@
jmp MterpFallback
+%def helpers():
+% pass
+
%def footer():
/*
* ===========================================================================
@@ -720,13 +723,6 @@
.global SYMBOL(artMterpAsmAltInstructionEnd)
SYMBOL(artMterpAsmAltInstructionEnd):
-%def instruction_end_sister():
-
- OBJECT_TYPE(artMterpAsmSisterEnd)
- ASM_HIDDEN SYMBOL(artMterpAsmSisterEnd)
- .global SYMBOL(artMterpAsmSisterEnd)
-SYMBOL(artMterpAsmSisterEnd):
-
%def instruction_start():
OBJECT_TYPE(artMterpAsmInstructionStart)
@@ -742,12 +738,3 @@
.global SYMBOL(artMterpAsmAltInstructionStart)
.text
SYMBOL(artMterpAsmAltInstructionStart) = .L_ALT_op_nop
-
-%def instruction_start_sister():
-
- OBJECT_TYPE(artMterpAsmSisterStart)
- ASM_HIDDEN SYMBOL(artMterpAsmSisterStart)
- .global SYMBOL(artMterpAsmSisterStart)
- .text
- .balign 4
-SYMBOL(artMterpAsmSisterStart):