Merge "Revert "Add hand written assembly for mterp field reads.""
diff --git a/runtime/interpreter/mterp/arm/main.S b/runtime/interpreter/mterp/arm/main.S
index 4da67b2..4951220 100644
--- a/runtime/interpreter/mterp/arm/main.S
+++ b/runtime/interpreter/mterp/arm/main.S
@@ -259,14 +259,6 @@
mov \reg, #0
str \reg, [rREFS, \vreg, lsl #2]
.endm
-.macro SET_VREG_WIDE regLo, regHi, vreg
- add ip, rFP, \vreg, lsl #2
- strd \regLo, \regHi, [ip]
- mov \regLo, #0
- mov \regHi, #0
- add ip, rREFS, \vreg, lsl #2
- strd \regLo, \regHi, [ip]
-.endm
.macro SET_VREG_OBJECT reg, vreg, tmpreg
str \reg, [rFP, \vreg, lsl #2]
str \reg, [rREFS, \vreg, lsl #2]
diff --git a/runtime/interpreter/mterp/arm/object.S b/runtime/interpreter/mterp/arm/object.S
index ccdc8f5..af1ece2 100644
--- a/runtime/interpreter/mterp/arm/object.S
+++ b/runtime/interpreter/mterp/arm/object.S
@@ -34,65 +34,29 @@
GET_INST_OPCODE ip @ extract opcode from rINST
GOTO_OPCODE ip @ jump to next instruction
-%def op_iget(is_object=False, is_wide=False, load="ldr", helper="MterpIGetU32"):
- @ Fast-path which gets the field offset from thread-local cache.
- add r0, rSELF, #THREAD_INTERPRETER_CACHE_OFFSET @ cache address
- ubfx r1, rPC, #2, #THREAD_INTERPRETER_CACHE_SIZE_LOG2 @ entry index
- add r0, r0, r1, lsl #3 @ entry address within the cache
- ldrd r0, r1, [r0] @ entry key (pc) and value (offset)
- mov r2, rINST, lsr #12 @ B
- GET_VREG r2, r2 @ object we're operating on
- cmp r0, rPC
- bne .L_${opcode}_slow_path @ cache miss
- cmp r2, #0
- beq common_errNullObject @ null object
-% if is_wide:
- ldrd r0, r1, [r2, r1] @ r0,r1 <- obj.field
-% else:
- ${load} r0, [r2, r1] @ r0 <- obj.field
-% #endif
-% if is_object:
- ldr ip, [rSELF, #THREAD_IS_GC_MARKING_OFFSET]
- cmp ip, #0
- beq .L_${opcode}_gc_not_marking @ GC is not active
- // TODO: This is UNLIKELY. Move this block at the end.
- bl artReadBarrierMark @ r0 <- artReadBarrierMark(r0)
-.L_${opcode}_gc_not_marking:
-% #endif
- ubfx r2, rINST, #8, #4 @ A
- FETCH_ADVANCE_INST 2 @ advance rPC, load rINST
-% if is_object:
- SET_VREG_OBJECT r0, r2 @ fp[A]<- r0
-% elif is_wide:
- SET_VREG_WIDE r0, r1, r2 @ fp[A]<- r0, r1
-% else:
- SET_VREG r0, r2 @ fp[A]<- r0
-% #endif
- GET_INST_OPCODE ip @ extract opcode from rINST
- GOTO_OPCODE ip @ jump to next instruction
-.L_${opcode}_slow_path:
+%def op_iget(is_object="0", helper="MterpIGetU32"):
% field(helper=helper)
%def op_iget_boolean():
-% op_iget(load="ldrb", helper="MterpIGetU8")
+% op_iget(helper="MterpIGetU8")
%def op_iget_boolean_quick():
% op_iget_quick(load="ldrb")
%def op_iget_byte():
-% op_iget(load="ldrsb", helper="MterpIGetI8")
+% op_iget(helper="MterpIGetI8")
%def op_iget_byte_quick():
% op_iget_quick(load="ldrsb")
%def op_iget_char():
-% op_iget(load="ldrh", helper="MterpIGetU16")
+% op_iget(helper="MterpIGetU16")
%def op_iget_char_quick():
% op_iget_quick(load="ldrh")
%def op_iget_object():
-% op_iget(is_object=True, helper="MterpIGetObj")
+% op_iget(is_object="1", helper="MterpIGetObj")
%def op_iget_object_quick():
/* For: iget-object-quick */
@@ -128,13 +92,13 @@
GOTO_OPCODE ip @ jump to next instruction
%def op_iget_short():
-% op_iget(load="ldrsh", helper="MterpIGetI16")
+% op_iget(helper="MterpIGetI16")
%def op_iget_short_quick():
% op_iget_quick(load="ldrsh")
%def op_iget_wide():
-% op_iget(is_wide=True, helper="MterpIGetU64")
+% op_iget(helper="MterpIGetU64")
%def op_iget_wide_quick():
/* iget-wide-quick vA, vB, offset@CCCC */
@@ -177,7 +141,7 @@
GET_INST_OPCODE ip @ extract opcode from rINST
GOTO_OPCODE ip @ jump to next instruction
-%def op_iput(helper="MterpIPutU32"):
+%def op_iput(is_object="0", helper="MterpIPutU32"):
% field(helper=helper)
%def op_iput_boolean():
@@ -199,7 +163,7 @@
% op_iput_quick(store="strh")
%def op_iput_object():
-% op_iput(helper="MterpIPutObj")
+% op_iput(is_object="1", helper="MterpIPutObj")
%def op_iput_object_quick():
EXPORT_PC
@@ -268,7 +232,7 @@
GET_INST_OPCODE ip @ extract opcode from rINST
GOTO_OPCODE ip @ jump to next instruction
-%def op_sget(helper="MterpSGetU32"):
+%def op_sget(is_object="0", helper="MterpSGetU32"):
% field(helper=helper)
%def op_sget_boolean():
@@ -281,7 +245,7 @@
% op_sget(helper="MterpSGetU16")
%def op_sget_object():
-% op_sget(helper="MterpSGetObj")
+% op_sget(is_object="1", helper="MterpSGetObj")
%def op_sget_short():
% op_sget(helper="MterpSGetI16")
@@ -289,7 +253,7 @@
%def op_sget_wide():
% op_sget(helper="MterpSGetU64")
-%def op_sput(helper="MterpSPutU32"):
+%def op_sput(is_object="0", helper="MterpSPutU32"):
% field(helper=helper)
%def op_sput_boolean():
@@ -302,7 +266,7 @@
% op_sput(helper="MterpSPutU16")
%def op_sput_object():
-% op_sput(helper="MterpSPutObj")
+% op_sput(is_object="1", helper="MterpSPutObj")
%def op_sput_short():
% op_sput(helper="MterpSPutI16")
diff --git a/runtime/interpreter/mterp/arm64/object.S b/runtime/interpreter/mterp/arm64/object.S
index afba895..388aba5 100644
--- a/runtime/interpreter/mterp/arm64/object.S
+++ b/runtime/interpreter/mterp/arm64/object.S
@@ -32,66 +32,29 @@
GET_INST_OPCODE ip // extract opcode from rINST
GOTO_OPCODE ip // jump to next instruction
-%def op_iget(is_object=False, is_wide=False, load="ldr", helper="MterpIGetU32"):
- // Fast-path which gets the field offset from thread-local cache.
- add x0, xSELF, #THREAD_INTERPRETER_CACHE_OFFSET // cache address
- ubfx x1, xPC, #2, #THREAD_INTERPRETER_CACHE_SIZE_LOG2 // entry index
- add x0, x0, x1, lsl #4 // entry address within the cache
- ldp x0, x1, [x0] // entry key (pc) and value (offset)
- lsr w2, wINST, #12 // B
- GET_VREG w2, w2 // object we're operating on
- cmp x0, xPC
- b.ne .L_${opcode}_slow_path // cache miss
- cbz w2, common_errNullObject // null object
-% if is_wide:
- ldr x0, [x2, x1] // x0<- obj.field
-% else:
- ${load} w0, [x2, x1] // w0<- obj.field
-% #endif
-% if is_object:
- ldr w1, [xSELF, #THREAD_IS_GC_MARKING_OFFSET]
- cbnz w1, .L_${opcode}_mark // GC is active.
-.L_${opcode}_marked:
-% #endif
- ubfx w2, wINST, #8, #4 // w2<- A
- FETCH_ADVANCE_INST 2 // advance rPC, load rINST
-% if is_object:
- SET_VREG_OBJECT w0, w2 // fp[A]<- w0
-% elif is_wide:
- SET_VREG_WIDE x0, w2 // fp[A]<- x0
-% else:
- SET_VREG w0, w2 // fp[A]<- w0
-% #endif
- GET_INST_OPCODE ip // extract opcode from rINST
- GOTO_OPCODE ip // jump to next instruction
-% if is_object:
-.L_${opcode}_mark:
- bl artReadBarrierMark // x0 <- artReadBarrierMark(x0)
- b .L_${opcode}_marked
-% #endif
-.L_${opcode}_slow_path:
+%def op_iget(is_object="0", helper="MterpIGetU32"):
% field(helper=helper)
%def op_iget_boolean():
-% op_iget(load="ldrb", helper="MterpIGetU8")
+% op_iget(helper="MterpIGetU8")
%def op_iget_boolean_quick():
% op_iget_quick(load="ldrb")
%def op_iget_byte():
-% op_iget(load="ldrsb", helper="MterpIGetI8")
+% op_iget(helper="MterpIGetI8")
%def op_iget_byte_quick():
% op_iget_quick(load="ldrsb")
%def op_iget_char():
-% op_iget(load="ldrh", helper="MterpIGetU16")
+% op_iget(helper="MterpIGetU16")
%def op_iget_char_quick():
% op_iget_quick(load="ldrh")
%def op_iget_object():
-% op_iget(is_object=True, helper="MterpIGetObj")
+% op_iget(is_object="1", helper="MterpIGetObj")
%def op_iget_object_quick():
/* For: iget-object-quick */
@@ -126,13 +89,13 @@
GOTO_OPCODE ip // jump to next instruction
%def op_iget_short():
-% op_iget(load="ldrsh", helper="MterpIGetI16")
+% op_iget(helper="MterpIGetI16")
%def op_iget_short_quick():
% op_iget_quick(load="ldrsh")
%def op_iget_wide():
-% op_iget(is_wide=True, helper="MterpIGetU64")
+% op_iget(helper="MterpIGetU64")
%def op_iget_wide_quick():
/* iget-wide-quick vA, vB, offset//CCCC */
@@ -171,7 +134,7 @@
GET_INST_OPCODE ip // extract opcode from rINST
GOTO_OPCODE ip // jump to next instruction
-%def op_iput(helper="MterpIPutU32"):
+%def op_iput(is_object="0", helper="MterpIPutU32"):
% field(helper=helper)
%def op_iput_boolean():
@@ -193,7 +156,7 @@
% op_iput_quick(store="strh")
%def op_iput_object():
-% op_iput(helper="MterpIPutObj")
+% op_iput(is_object="1", helper="MterpIPutObj")
%def op_iput_object_quick():
EXPORT_PC
@@ -257,7 +220,7 @@
GET_INST_OPCODE ip // extract opcode from rINST
GOTO_OPCODE ip // jump to next instruction
-%def op_sget(helper="MterpSGetU32"):
+%def op_sget(is_object="0", helper="MterpSGetU32"):
% field(helper=helper)
%def op_sget_boolean():
@@ -270,7 +233,7 @@
% op_sget(helper="MterpSGetU16")
%def op_sget_object():
-% op_sget(helper="MterpSGetObj")
+% op_sget(is_object="1", helper="MterpSGetObj")
%def op_sget_short():
% op_sget(helper="MterpSGetI16")
@@ -278,7 +241,7 @@
%def op_sget_wide():
% op_sget(helper="MterpSGetU64")
-%def op_sput(helper="MterpSPutU32"):
+%def op_sput(is_object="0", helper="MterpSPutU32"):
% field(helper=helper)
%def op_sput_boolean():
@@ -291,7 +254,7 @@
% op_sput(helper="MterpSPutU16")
%def op_sput_object():
-% op_sput(helper="MterpSPutObj")
+% op_sput(is_object="1", helper="MterpSPutObj")
%def op_sput_short():
% op_sput(helper="MterpSPutI16")