Callers of SuspendAll should be in the kRunnable state
Change-Id: I37996164a5fd56251134683f717e6e00541cab22
diff --git a/src/runtime.cc b/src/runtime.cc
index 7595ed8..8672d29 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -393,6 +393,9 @@
CHECK(host_prefix_.empty()) << host_prefix_;
+ // Restore main thread state to kNative as expected by native code
+ Thread::Current()->SetState(Thread::kNative);
+
InitNativeMethods();
Thread::FinishStartup();
@@ -511,6 +514,9 @@
// without creating objects.
Thread::Attach(this, "main", false);
+ // Set us to runnable so tools using a runtime can allocate and GC by default
+ Thread::Current()->SetState(Thread::kRunnable);
+
CHECK_GE(Heap::GetSpaces().size(), 1U);
class_linker_ = ((Heap::GetSpaces()[0]->IsImageSpace())
? ClassLinker::Create(intern_table_)