diff options
Diffstat (limited to 'runtime/interpreter/interpreter_common.h')
-rw-r--r-- | runtime/interpreter/interpreter_common.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h index b42af11986..cfc90a6618 100644 --- a/runtime/interpreter/interpreter_common.h +++ b/runtime/interpreter/interpreter_common.h @@ -29,6 +29,7 @@ #include "dex_instruction.h" #include "entrypoints/entrypoint_utils.h" #include "gc/accounting/card_table-inl.h" +#include "handle_scope-inl.h" #include "nth_caller_visitor.h" #include "mirror/art_field-inl.h" #include "mirror/art_method.h" @@ -112,9 +113,10 @@ static inline bool DoInvoke(Thread* self, ShadowFrame& shadow_frame, const Instr const uint32_t method_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c(); const uint32_t vregC = (is_range) ? inst->VRegC_3rc() : inst->VRegC_35c(); Object* receiver = (type == kStatic) ? nullptr : shadow_frame.GetVRegReference(vregC); - ArtMethod* const method = FindMethodFromCode<type, do_access_check>(method_idx, receiver, - shadow_frame.GetMethod(), - self); + mirror::ArtMethod* sf_method = shadow_frame.GetMethod(); + ArtMethod* const method = FindMethodFromCode<type, do_access_check>( + method_idx, &receiver, &sf_method, self); + // The shadow frame should already be pushed, so we don't need to update it. if (UNLIKELY(method == nullptr)) { CHECK(self->IsExceptionPending()); result->SetJ(0); @@ -348,6 +350,10 @@ static SOMETIMES_INLINE_KEYWORD bool DoFieldPut(Thread* self, const ShadowFrame& case Primitive::kPrimNot: { Object* reg = shadow_frame.GetVRegReference(vregA); if (do_assignability_check && reg != nullptr) { + // FieldHelper::GetType can resolve classes, use a handle wrapper which will restore the + // object in the destructor. + StackHandleScope<1> hs(self); + HandleWrapper<mirror::Object> wrapper(hs.NewHandleWrapper(&obj)); Class* field_class = FieldHelper(f).GetType(); if (!reg->VerifierInstanceOf(field_class)) { // This should never happen. @@ -372,7 +378,8 @@ static SOMETIMES_INLINE_KEYWORD bool DoFieldPut(Thread* self, const ShadowFrame& // Handles iput-quick, iput-wide-quick and iput-object-quick instructions. // Returns true on success, otherwise throws an exception and returns false. template<Primitive::Type field_type, bool transaction_active> -static SOMETIMES_INLINE_KEYWORD bool DoIPutQuick(const ShadowFrame& shadow_frame, const Instruction* inst, uint16_t inst_data) { +static SOMETIMES_INLINE_KEYWORD bool DoIPutQuick(const ShadowFrame& shadow_frame, + const Instruction* inst, uint16_t inst_data) { Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data)); if (UNLIKELY(obj == nullptr)) { // We lost the reference to the field index so we cannot get a more |