diff options
| author | 2017-06-27 16:40:33 +0100 | |
|---|---|---|
| committer | 2017-10-09 17:56:47 +0100 | |
| commit | df2d5de869514ddc52ac0afd60d6eefb9da844b4 (patch) | |
| tree | d3c8469b274f71bfca9979db3867362239ae57cb | |
| parent | 464f8cd7385a9958c3171e2feaa93c726043bbf8 (diff) | |
Strengthen annotation-related checks in JNI code.
Instead of clearing unexpected exceptions in JNI code,
assert that they should not happen.
Test: m test-art-host
Bug: 34659969
Change-Id: I7b8d32aa17426e0f37350afec40f07dee73a4b35
| -rw-r--r-- | runtime/entrypoints/quick/quick_trampoline_entrypoints.cc | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index 813a264ed9..ea7a83c75e 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -2185,20 +2185,11 @@ extern "C" TwoWordReturn artQuickGenericJniTrampoline(Thread* self, ArtMethod** // Generic JNI trampoline at this stage; instead, method's // annotations' classes are looked up in the bootstrap class // loader's resolved types (which won't trigger an exception). + CHECK(!self->IsExceptionPending()); bool critical_native = called->IsAnnotatedWithCriticalNative(); - // ArtMethod::IsAnnotatedWithCriticalNative should not throw - // an exception; clear it if it happened anyway. - // TODO: Revisit this code path and turn this into a CHECK(!self->IsExceptionPending()). - if (self->IsExceptionPending()) { - self->ClearException(); - } + CHECK(!self->IsExceptionPending()); bool fast_native = called->IsAnnotatedWithFastNative(); - // ArtMethod::IsAnnotatedWithFastNative should not throw - // an exception; clear it if it happened anyway. - // TODO: Revisit this code path and turn this into a CHECK(!self->IsExceptionPending()). - if (self->IsExceptionPending()) { - self->ClearException(); - } + CHECK(!self->IsExceptionPending()); bool normal_native = !critical_native && !fast_native; // Restore the initial ArtMethod pointer at `*sp`. *sp = called; |