diff options
author | Ian Rogers <irogers@google.com> | 2014-03-08 15:21:04 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-03-09 02:17:46 +0000 |
commit | e0dcd46314d07eeb332edea292f5110178e4e3d2 (patch) | |
tree | d1060bc54e1ad26bad69a6e06662e643e75ce484 /runtime/entrypoints | |
parent | 80a250f8862096b72e7357c12b40dc9d5310a475 (diff) | |
download | art-e0dcd46314d07eeb332edea292f5110178e4e3d2.zip art-e0dcd46314d07eeb332edea292f5110178e4e3d2.tar.gz art-e0dcd46314d07eeb332edea292f5110178e4e3d2.tar.bz2 |
JNI down call fixes.
Ensure SIRT isn't accessed via quick callee save frame.
Some tidying of code.
Change-Id: I8fec3e89aa6d2e86789c60a07550db2e92478ca7
Diffstat (limited to 'runtime/entrypoints')
-rw-r--r-- | runtime/entrypoints/quick/quick_trampoline_entrypoints.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index 1bbaa6a..2a77fb8 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -1363,7 +1363,7 @@ class BuildGenericJniFrameVisitor FINAL : public QuickArgumentVisitor { sirt_number_of_references_++; } sirt_->SetNumberOfReferences(sirt_expected_refs_); - + DCHECK_NE(sirt_expected_refs_, 0U); // Install Sirt. self->PushSirt(sirt_); } @@ -1453,6 +1453,8 @@ extern "C" ssize_t artQuickGenericJniTrampoline(Thread* self, mirror::ArtMethod* // fix up managed-stack things in Thread self->SetTopOfStack(sp, 0); + self->VerifyStack(); + // start JNI, save the cookie uint32_t cookie; if (called->IsSynchronized()) { @@ -1465,7 +1467,7 @@ extern "C" ssize_t artQuickGenericJniTrampoline(Thread* self, mirror::ArtMethod* } else { cookie = JniMethodStart(self); } - *(sp32-1) = cookie; + *(sp32 - 1) = cookie; // retrieve native code const void* nativeCode = called->GetNativeMethod(); @@ -1479,7 +1481,7 @@ extern "C" ssize_t artQuickGenericJniTrampoline(Thread* self, mirror::ArtMethod* *code_pointer = reinterpret_cast<uintptr_t>(nativeCode); // 5K reserved, window_size used. - return 5*1024 - window_size; + return (5 * KB) - window_size; } /* @@ -1491,7 +1493,7 @@ extern "C" uint64_t artQuickGenericJniEndTrampoline(Thread* self, mirror::ArtMet SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { uint32_t* sp32 = reinterpret_cast<uint32_t*>(sp); mirror::ArtMethod* called = *sp; - uint32_t cookie = *(sp32-1); + uint32_t cookie = *(sp32 - 1); MethodHelper mh(called); char return_shorty_char = mh.GetShorty()[0]; @@ -1502,7 +1504,7 @@ extern "C" uint64_t artQuickGenericJniEndTrampoline(Thread* self, mirror::ArtMet ComputeGenericJniFrameSize fsc; fsc.ComputeSirtOffset(); uint32_t offset = fsc.GetFirstSirtEntryOffset(); - jobject tmp = reinterpret_cast<jobject>(reinterpret_cast<uint8_t*>(sp)-offset); + jobject tmp = reinterpret_cast<jobject>(reinterpret_cast<uint8_t*>(sp) - offset); return reinterpret_cast<uint64_t>(JniMethodEndWithReferenceSynchronized(result.l, cookie, tmp, self)); @@ -1514,7 +1516,7 @@ extern "C" uint64_t artQuickGenericJniEndTrampoline(Thread* self, mirror::ArtMet ComputeGenericJniFrameSize fsc; fsc.ComputeSirtOffset(); uint32_t offset = fsc.GetFirstSirtEntryOffset(); - jobject tmp = reinterpret_cast<jobject>(reinterpret_cast<uint8_t*>(sp)-offset); + jobject tmp = reinterpret_cast<jobject>(reinterpret_cast<uint8_t*>(sp) - offset); JniMethodEndSynchronized(cookie, tmp, self); } else { |