summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/interpreter/mterp/riscv64/invoke.S26
-rw-r--r--runtime/nterp_helpers.cc1
2 files changed, 24 insertions, 3 deletions
diff --git a/runtime/interpreter/mterp/riscv64/invoke.S b/runtime/interpreter/mterp/riscv64/invoke.S
index fd314e8ebb..2cdf7e19a8 100644
--- a/runtime/interpreter/mterp/riscv64/invoke.S
+++ b/runtime/interpreter/mterp/riscv64/invoke.S
@@ -55,7 +55,24 @@
// Note: invoke-virtual is used to invoke a normal virtual method (a method that is not private,
// static, or final, and is also not a constructor).
%def op_invoke_virtual(range=""):
- unimp
+ EXPORT_PC
+ FETCH s7, count=2 // s7 := F|E|D|C or CCCC (range)
+ FETCH_FROM_THREAD_CACHE a0, /*slow path*/2f, t0, t1
+ // a0 := method idx of resolved virtual method
+1:
+% fetch_receiver(reg="a1", vreg="s7", range=range)
+ // a1 := fp[C] (this)
+ // Note: null case handled by SEGV handler.
+ lwu t0, MIRROR_OBJECT_CLASS_OFFSET(a1)
+ // t0 := klass object (32-bit addr)
+ // Entry address = entry's byte offset in vtable + vtable's byte offset in klass object.
+ sh3add a0, a0, t0 // a0 := entry's byte offset
+ ld a0, MIRROR_CLASS_VTABLE_OFFSET_64(a0)
+ // a0 := ArtMethod*
+ tail NterpInvokeVirtual${range} // args a0, a1, s7
+2:
+% resolve_method_into_a0()
+ j 1b
// invoke-super {vC, vD, vE, vF, vG}, meth@BBBB
@@ -297,16 +314,19 @@
// These asm blocks are positioned in main.S for visibility to stack walking.
//
+
// NterpInvokeVirtual
// a0: ArtMethod*
// a1: this
+// s7: vreg ids F|E|D|C
%def nterp_invoke_virtual():
- unimp
+% nterp_invoke_direct(uniq="invoke_virtual")
// NterpInvokeSuper
// a0: ArtMethod*
// a1: this
+// s7: vreg ids F|E|D|C
%def nterp_invoke_super():
% nterp_invoke_direct(uniq="invoke_super")
@@ -965,7 +985,7 @@
beq $z0, $z1, .L${uniq}_arg_4
// A = 5
- slliw $z0, xINST, 8
+ srliw $z0, xINST, 8
andi $z0, $z0, 0xF // z0 := G
GET_VREG $z1, $z0 // z1 := xFP[G]
sw $z1, (4*4)($z3) // fp[G] := z1
diff --git a/runtime/nterp_helpers.cc b/runtime/nterp_helpers.cc
index 8cabed1c22..d35c65faa2 100644
--- a/runtime/nterp_helpers.cc
+++ b/runtime/nterp_helpers.cc
@@ -274,6 +274,7 @@ bool CanMethodUseNterp(ArtMethod* method, InstructionSet isa) {
case Instruction::CONST_WIDE_HIGH16:
case Instruction::SPUT:
case Instruction::SPUT_OBJECT:
+ case Instruction::INVOKE_VIRTUAL:
case Instruction::INVOKE_SUPER:
case Instruction::INVOKE_DIRECT:
case Instruction::INVOKE_STATIC: