Don't run managed code until the runtime has started.
Previously we ended up running managed code because JNI was
triggering class initializers to run. This was triggered by
both Thread::CreatePeer() and InitBoxingMethods().
When these initializers were prevented from running, other
code broke:
- Creating the peer for the main thread was relying on
ThreadGroup.<clinit> to assign the built-in thread groups.
- Creating the boxed methods caused class initialization of
the primitive wrapper classes; these need to be initialized
before Thread.<clinit> is run to avoid a crash in its own
initializer.
This change works around those breaks by splitting thread peer
creation into two parts (allocation and running <init>) and
by calling InitBoxingMethods() during runtime start.
Change-Id: I44be7170ce08451adf876ee73cba0f1f66d5a59e
6 files changed