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/stack.cc | |
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/stack.cc')
-rw-r--r-- | runtime/stack.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/runtime/stack.cc b/runtime/stack.cc index a6a0b29..abaea6f 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -108,20 +108,26 @@ mirror::Object* StackVisitor::GetThisObject() const { return NULL; } else if (m->IsNative()) { if (cur_quick_frame_ != NULL) { - StackIndirectReferenceTable* sirt = - reinterpret_cast<StackIndirectReferenceTable*>( - reinterpret_cast<char*>(cur_quick_frame_) + - m->GetSirtOffsetInBytes()); - return sirt->GetReference(0); + if (m->GetEntryPointFromQuickCompiledCode() == GetQuickGenericJniTrampoline()) { + UNIMPLEMENTED(ERROR) << "Failed to determine this object of native method: " + << PrettyMethod(m); + return nullptr; + } else { + StackIndirectReferenceTable* sirt = + reinterpret_cast<StackIndirectReferenceTable*>( + reinterpret_cast<char*>(cur_quick_frame_) + + m->GetSirtOffsetInBytes()); + return sirt->GetReference(0); + } } else { return cur_shadow_frame_->GetVRegReference(0); } } else { const DexFile::CodeItem* code_item = MethodHelper(m).GetCodeItem(); if (code_item == NULL) { - UNIMPLEMENTED(ERROR) << "Failed to determine this object of abstract or proxy method" + UNIMPLEMENTED(ERROR) << "Failed to determine this object of abstract or proxy method: " << PrettyMethod(m); - return NULL; + return nullptr; } else { uint16_t reg = code_item->registers_size_ - code_item->ins_size_; return reinterpret_cast<mirror::Object*>(GetVReg(m, reg, kReferenceVReg)); |