ART: Add currentThread cutout to Unstarted Runtime
Add currentThread() and getThreadState() cutouts to the unstarted
runtime to allow further compile-time initialization. The cutouts
are protected by call-stack checks.
Add tests.
Bug: 34956610
Test: m test-art-host-gtest-unstarted_runtime_test
Change-Id: I6335bccda8bedae90376fc7c47b303576f1ac78b
diff --git a/runtime/thread.h b/runtime/thread.h
index a46e799..dc84685 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -1173,6 +1173,12 @@
return false;
}
+ static jobject CreateCompileTimePeer(JNIEnv* env,
+ const char* name,
+ bool as_daemon,
+ jobject thread_group)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
private:
explicit Thread(bool daemon);
~Thread() REQUIRES(!Locks::mutator_lock_, !Locks::thread_suspend_count_lock_);
@@ -1188,8 +1194,12 @@
void CreatePeer(const char* name, bool as_daemon, jobject thread_group);
template<bool kTransactionActive>
- void InitPeer(ScopedObjectAccess& soa, jboolean thread_is_daemon, jobject thread_group,
- jobject thread_name, jint thread_priority)
+ static void InitPeer(ScopedObjectAccessAlreadyRunnable& soa,
+ ObjPtr<mirror::Object> peer,
+ jboolean thread_is_daemon,
+ jobject thread_group,
+ jobject thread_name,
+ jint thread_priority)
REQUIRES_SHARED(Locks::mutator_lock_);
// Avoid use, callers should use SetState. Used only by SignalCatcher::HandleSigQuit, ~Thread and