Make sure threads allocating are in the kRunnable state
Change-Id: I55a08fcd38b3388698ef571d2d4fa9553210e197
diff --git a/src/dalvik_system_VMRuntime.cc b/src/dalvik_system_VMRuntime.cc
index 8334059..d4c1ed2 100644
--- a/src/dalvik_system_VMRuntime.cc
+++ b/src/dalvik_system_VMRuntime.cc
@@ -44,6 +44,7 @@
}
jobject VMRuntime_newNonMovableArray(JNIEnv* env, jobject, jclass javaElementClass, jint length) {
+ ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable);
#ifdef MOVING_GARBAGE_COLLECTOR
// TODO: right now, we don't have a copying collector, so there's no need
// to do anything special here, but we ought to pass the non-movability
@@ -74,6 +75,7 @@
}
jlong VMRuntime_addressOf(JNIEnv* env, jobject, jobject javaArray) {
+ ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable);
Array* array = Decode<Array*>(env, javaArray);
if (!array->IsArrayInstance()) {
Thread::Current()->ThrowNewException("Ljava/lang/IllegalArgumentException;", "not an array");