diff options
Diffstat (limited to 'runtime/art_method-inl.h')
-rw-r--r-- | runtime/art_method-inl.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h index d105d9e41d..c3aa5c914a 100644 --- a/runtime/art_method-inl.h +++ b/runtime/art_method-inl.h @@ -192,6 +192,7 @@ typename detail::ShortyTraits<ReturnType>::Type ArtMethod::InvokeInstance(Thread* self, ObjPtr<mirror::Object> receiver, typename detail::ShortyTraits<ArgType>::Type... args) { + DCHECK(!GetDeclaringClass()->IsInterface()); DCHECK(!IsStatic()); JValue result; constexpr auto shorty = detail::MaterializeShorty<ReturnType, ArgType...>(); @@ -200,6 +201,47 @@ ArtMethod::InvokeInstance(Thread* self, return detail::ShortyTraits<ReturnType>::Get(result); } +template <char ReturnType, char... ArgType> +typename detail::ShortyTraits<ReturnType>::Type +ArtMethod::InvokeFinal(Thread* self, + ObjPtr<mirror::Object> receiver, + typename detail::ShortyTraits<ArgType>::Type... args) { + DCHECK(!GetDeclaringClass()->IsInterface()); + DCHECK(!IsStatic()); + DCHECK(IsFinal()); + DCHECK(receiver != nullptr); + return InvokeInstance<ReturnType, ArgType...>(self, receiver, args...); +} + +template <char ReturnType, char... ArgType> +typename detail::ShortyTraits<ReturnType>::Type +ArtMethod::InvokeVirtual(Thread* self, + ObjPtr<mirror::Object> receiver, + typename detail::ShortyTraits<ArgType>::Type... args) { + DCHECK(!GetDeclaringClass()->IsInterface()); + DCHECK(!IsStatic()); + DCHECK(!IsFinal()); + DCHECK(receiver != nullptr); + ArtMethod* target_method = + receiver->GetClass()->FindVirtualMethodForVirtual(this, kRuntimePointerSize); + DCHECK(target_method != nullptr); + return target_method->InvokeInstance<ReturnType, ArgType...>(self, receiver, args...); +} + +template <char ReturnType, char... ArgType> +typename detail::ShortyTraits<ReturnType>::Type +ArtMethod::InvokeInterface(Thread* self, + ObjPtr<mirror::Object> receiver, + typename detail::ShortyTraits<ArgType>::Type... args) { + DCHECK(GetDeclaringClass()->IsInterface()); + DCHECK(!IsStatic()); + DCHECK(receiver != nullptr); + ArtMethod* target_method = + receiver->GetClass()->FindVirtualMethodForInterface(this, kRuntimePointerSize); + DCHECK(target_method != nullptr); + return target_method->InvokeInstance<ReturnType, ArgType...>(self, receiver, args...); +} + template <ReadBarrierOption kReadBarrierOption> inline ObjPtr<mirror::Class> ArtMethod::GetDeclaringClassUnchecked() { GcRootSource gc_root_source(this); |