summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/verifier/method_verifier.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 934d73b4d1..2d9f986059 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -1021,9 +1021,30 @@ class MethodVerifier final : public ::art::verifier::MethodVerifier {
}
// Returns the method index of an invoke instruction.
- uint16_t GetMethodIdxOfInvoke(const Instruction* inst)
+ static uint16_t GetMethodIdxOfInvoke(const Instruction* inst)
REQUIRES_SHARED(Locks::mutator_lock_) {
- return inst->VRegB();
+ // Note: This is compiled to a single load in release mode.
+ Instruction::Code opcode = inst->Opcode();
+ if (opcode == Instruction::INVOKE_VIRTUAL ||
+ opcode == Instruction::INVOKE_SUPER ||
+ opcode == Instruction::INVOKE_DIRECT ||
+ opcode == Instruction::INVOKE_STATIC ||
+ opcode == Instruction::INVOKE_INTERFACE ||
+ opcode == Instruction::INVOKE_CUSTOM) {
+ return inst->VRegB_35c();
+ } else if (opcode == Instruction::INVOKE_VIRTUAL_RANGE ||
+ opcode == Instruction::INVOKE_SUPER_RANGE ||
+ opcode == Instruction::INVOKE_DIRECT_RANGE ||
+ opcode == Instruction::INVOKE_STATIC_RANGE ||
+ opcode == Instruction::INVOKE_INTERFACE_RANGE ||
+ opcode == Instruction::INVOKE_CUSTOM_RANGE) {
+ return inst->VRegB_3rc();
+ } else if (opcode == Instruction::INVOKE_POLYMORPHIC) {
+ return inst->VRegB_45cc();
+ } else {
+ DCHECK_EQ(opcode, Instruction::INVOKE_POLYMORPHIC_RANGE);
+ return inst->VRegB_4rcc();
+ }
}
// Returns the field index of a field access instruction.
uint16_t GetFieldIdxOfFieldAccess(const Instruction* inst, bool is_static)