diff options
| author | 2016-02-03 20:13:59 +0000 | |
|---|---|---|
| committer | 2016-02-03 20:13:59 +0000 | |
| commit | 071b933eb6e937ca6b9efa24e0e3a70a50eca975 (patch) | |
| tree | 276d412a8c23d8292dfa6108f639e4534a910c28 /runtime/interpreter/interpreter_common.cc | |
| parent | c5b76b9328d77b83c80afed14a5b6e7009136e15 (diff) | |
| parent | df187e4cc8b1b2dc6cb0043eb91d1dfd72cb490b (diff) | |
Merge changes from topic 'reflection_1_8'
* changes:
Revert "Revert "reflection: Add new 1.8 AnnotatedElement methods and tests""
interpreter: Fix proxy method invocation with access checks enabled.
Diffstat (limited to 'runtime/interpreter/interpreter_common.cc')
| -rw-r--r-- | runtime/interpreter/interpreter_common.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 6c9cc7017b..09d860140f 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -637,17 +637,25 @@ static inline bool DoCallCommon(ArtMethod* called_method, self, new_shadow_frame, StackedShadowFrameType::kShadowFrameUnderConstruction); self->EndAssertNoThreadSuspension(old_cause); + // ArtMethod here is needed to check type information of the call site against the callee. + // Type information is retrieved from a DexFile/DexCache for that respective declared method. + // + // As a special case for proxy methods, which are not dex-backed, + // we have to retrieve type information from the proxy's method + // interface method instead (which is dex backed since proxies are never interfaces). + ArtMethod* method = new_shadow_frame->GetMethod()->GetInterfaceMethodIfProxy(sizeof(void*)); + // We need to do runtime check on reference assignment. We need to load the shorty // to get the exact type of each reference argument. - const DexFile::TypeList* params = new_shadow_frame->GetMethod()->GetParameterTypeList(); + const DexFile::TypeList* params = method->GetParameterTypeList(); uint32_t shorty_len = 0; - const char* shorty = new_shadow_frame->GetMethod()->GetShorty(&shorty_len); + const char* shorty = method->GetShorty(&shorty_len); // Handle receiver apart since it's not part of the shorty. size_t dest_reg = first_dest_reg; size_t arg_offset = 0; - if (!new_shadow_frame->GetMethod()->IsStatic()) { + if (!method->IsStatic()) { size_t receiver_reg = is_range ? vregC : arg[0]; new_shadow_frame->SetVRegReference(dest_reg, shadow_frame.GetVRegReference(receiver_reg)); ++dest_reg; @@ -667,7 +675,7 @@ static inline bool DoCallCommon(ArtMethod* called_method, if (do_assignability_check && o != nullptr) { size_t pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize(); Class* arg_type = - new_shadow_frame->GetMethod()->GetClassFromTypeIndex( + method->GetClassFromTypeIndex( params->GetTypeItem(shorty_pos).type_idx_, true /* resolve */, pointer_size); if (arg_type == nullptr) { CHECK(self->IsExceptionPending()); |