diff options
| author | 2014-07-16 12:06:35 -0700 | |
|---|---|---|
| committer | 2014-07-16 12:06:35 -0700 | |
| commit | e5877a12c30afe10a5c6a1afaff7a47ef44a2a5f (patch) | |
| tree | 161535abb39394fc3b1d96d31625ba7eb61c8497 /runtime/entrypoints/entrypoint_utils.cc | |
| parent | aab012d6196bd29b3167963ec8acb0b9780672b2 (diff) | |
Fix x86 build.
Also fix attributes/annotalysis on entrypoint_utils functions now we have
clang that is smarter wrt warnings than GCC.
Change-Id: I69257b4ad9a27d07acbc973d21a1cfa4260a8ed6
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils.cc')
| -rw-r--r-- | runtime/entrypoints/entrypoint_utils.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc index d063dfb425..0fa0e410bf 100644 --- a/runtime/entrypoints/entrypoint_utils.cc +++ b/runtime/entrypoints/entrypoint_utils.cc @@ -20,6 +20,7 @@ #include "class_linker-inl.h" #include "dex_file-inl.h" #include "gc/accounting/card_table-inl.h" +#include "method_helper-inl.h" #include "mirror/art_field-inl.h" #include "mirror/art_method-inl.h" #include "mirror/class-inl.h" @@ -138,6 +139,25 @@ void ThrowStackOverflowError(Thread* self) { self->ResetDefaultStackEnd(!explicit_overflow_check); // Return to default stack size. } +void CheckReferenceResult(mirror::Object* o, Thread* self) { + if (o == NULL) { + return; + } + mirror::ArtMethod* m = self->GetCurrentMethod(NULL); + if (o == kInvalidIndirectRefObject) { + JniAbortF(NULL, "invalid reference returned from %s", PrettyMethod(m).c_str()); + } + // Make sure that the result is an instance of the type this method was expected to return. + StackHandleScope<1> hs(self); + Handle<mirror::ArtMethod> h_m(hs.NewHandle(m)); + mirror::Class* return_type = MethodHelper(h_m).GetReturnType(); + + if (!o->InstanceOf(return_type)) { + JniAbortF(NULL, "attempt to return an instance of %s from %s", PrettyTypeOf(o).c_str(), + PrettyMethod(h_m.Get()).c_str()); + } +} + JValue InvokeProxyInvocationHandler(ScopedObjectAccessAlreadyRunnable& soa, const char* shorty, jobject rcvr_jobj, jobject interface_method_jobj, std::vector<jvalue>& args) { |