summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2021-03-15 14:04:43 +0000
committer Vladimir Marko <vmarko@google.com> 2021-03-17 10:25:17 +0000
commit98fa40a492c85fad5f4f60d2904a1451ee35d543 (patch)
tree9a8f7bc73a8acac01953c3e83d709b3f9d55e775
parenta2e2eb187e0355314e59608dc204f68571e14069 (diff)
nterp/arm64: Clean up branch PC calculation.
Fuse two instructions into one. The new calculation is also technically more correct, even though we should never see branch offsets over 2^30 where the result would differ. Test: testrunner.py --target --64 --interpreter Bug: 112676029 Change-Id: Ib6db93ad90ee1b4bcb68839c64ded9dca101352e
-rw-r--r--runtime/interpreter/mterp/arm64ng/main.S19
1 files changed, 4 insertions, 15 deletions
diff --git a/runtime/interpreter/mterp/arm64ng/main.S b/runtime/interpreter/mterp/arm64ng/main.S
index cab9d00ab0..3ba175d73f 100644
--- a/runtime/interpreter/mterp/arm64ng/main.S
+++ b/runtime/interpreter/mterp/arm64ng/main.S
@@ -140,17 +140,6 @@
.endm
/*
- * Fetch the next instruction from an offset specified by "reg" and advance xPC.
- * xPC to point to the next instruction. "reg" must specify the distance
- * in bytes, *not* 16-bit code units, and may be a signed value.
- *
- */
-.macro FETCH_ADVANCE_INST_RB reg
- add xPC, xPC, \reg, sxtw
- ldrh wINST, [xPC]
-.endm
-
-/*
* Fetch a half-word code unit from an offset past the current PC. The
* "count" value is in 16-bit code units. Does not advance xPC.
*
@@ -304,8 +293,8 @@ END \name
// Update method counter and do a suspend check if the branch is negative.
tbnz wINST, #31, 2f
1:
- add w2, wINST, wINST // w2<- byte offset
- FETCH_ADVANCE_INST_RB w2 // update xPC, load wINST
+ add xPC, xPC, wINST, sxtw #1 // update xPC
+ FETCH wINST, 0 // load wINST
GET_INST_OPCODE ip // extract opcode from wINST
GOTO_OPCODE ip // jump to next instruction
2:
@@ -1637,8 +1626,8 @@ NterpHandleHotnessOverflow:
mov x2, xFP
bl nterp_hot_method
cbnz x0, 1f
- add w2, wINST, wINST // w2<- byte offset
- FETCH_ADVANCE_INST_RB w2 // update xPC, load wINST
+ add xPC, xPC, wINST, sxtw #1 // update xPC
+ FETCH wINST, 0 // load wINST
GET_INST_OPCODE ip // extract opcode from wINST
GOTO_OPCODE ip // jump to next instruction
1: