diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-10-09 15:01:21 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-10-09 15:17:12 -0700 |
commit | e861ebd5d9490cc86200f3859f3d36fadad4588c (patch) | |
tree | be9ad31a9175198758491e6bcd3eef5c252c2c38 /runtime/interpreter/interpreter.cc | |
parent | d50f8c8e4456263e169c9998d3a1c3a6c5c51435 (diff) | |
download | art-e861ebd5d9490cc86200f3859f3d36fadad4588c.zip art-e861ebd5d9490cc86200f3859f3d36fadad4588c.tar.gz art-e861ebd5d9490cc86200f3859f3d36fadad4588c.tar.bz2 |
Fix interpreter bugs.
These showed up in compaction work.
Change-Id: Iac8eb0a1395c25aabba9f2e0ff6b01fc6180bdca
Diffstat (limited to 'runtime/interpreter/interpreter.cc')
-rw-r--r-- | runtime/interpreter/interpreter.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index 8aa6fa2..48c0014 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -309,6 +309,7 @@ void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method, Object* receive return; } + const char* old_cause = self->StartAssertNoThreadSuspension("EnterInterpreterFromInvoke"); MethodHelper mh(method); const DexFile::CodeItem* code_item = mh.GetCodeItem(); uint16_t num_regs; @@ -317,6 +318,7 @@ void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method, Object* receive num_regs = code_item->registers_size_; num_ins = code_item->ins_size_; } else if (method->IsAbstract()) { + self->EndAssertNoThreadSuspension(old_cause); ThrowAbstractMethodError(method); return; } else { @@ -332,6 +334,8 @@ void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method, Object* receive void* memory = alloca(ShadowFrame::ComputeSize(num_regs)); ShadowFrame* shadow_frame(ShadowFrame::Create(num_regs, last_shadow_frame, method, 0, memory)); self->PushShadowFrame(shadow_frame); + self->EndAssertNoThreadSuspension(old_cause); + size_t cur_reg = num_regs - num_ins; if (!method->IsStatic()) { CHECK(receiver != NULL); @@ -339,8 +343,7 @@ void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method, Object* receive ++cur_reg; } else if (UNLIKELY(!method->GetDeclaringClass()->IsInitializing())) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); - if (UNLIKELY(!class_linker->EnsureInitialized(method->GetDeclaringClass(), - true, true))) { + if (UNLIKELY(!class_linker->EnsureInitialized(method->GetDeclaringClass(), true, true))) { CHECK(self->IsExceptionPending()); self->PopShadowFrame(); return; @@ -421,6 +424,7 @@ extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh return; } + self->PushShadowFrame(shadow_frame); ArtMethod* method = shadow_frame->GetMethod(); // Ensure static methods are initialized. if (method->IsStatic()) { @@ -429,12 +433,12 @@ extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh if (UNLIKELY(!Runtime::Current()->GetClassLinker()->EnsureInitialized(declaringClass, true, true))) { DCHECK(Thread::Current()->IsExceptionPending()); + self->PopShadowFrame(); return; } CHECK(declaringClass->IsInitializing()); } } - self->PushShadowFrame(shadow_frame); if (LIKELY(!method->IsNative())) { result->SetJ(Execute(self, mh, code_item, *shadow_frame, JValue()).GetJ()); @@ -442,7 +446,7 @@ extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh // We don't expect to be asked to interpret native code (which is entered via a JNI compiler // generated stub) except during testing and image writing. CHECK(!Runtime::Current()->IsStarted()); - Object* receiver = method->IsStatic() ? NULL : shadow_frame->GetVRegReference(0); + Object* receiver = method->IsStatic() ? nullptr : shadow_frame->GetVRegReference(0); uint32_t* args = shadow_frame->GetVRegArgs(method->IsStatic() ? 0 : 1); UnstartedRuntimeJni(self, method, receiver, args, result); } |