Compacting collector.

The compacting collector is currently similar to semispace. It works by
copying objects back and forth between two bump pointer spaces. There
are types of objects which are "non-movable" due to current runtime
limitations. These are Classes, Methods, and Fields.

Bump pointer spaces are a new type of continuous alloc space which have
no lock in the allocation code path. When you allocate from these it uses
atomic operations to increase an index. Traversing the objects in the bump
pointer space relies on Object::SizeOf matching the allocated size exactly.

Runtime changes:
JNI::GetArrayElements returns copies objects if you attempt to get the
backing data of a movable array. For GetArrayElementsCritical, we return
direct backing storage for any types of arrays, but temporarily disable
the GC until the critical region is completed.

Added a new runtime call called VisitObjects, this is used in place of
the old pattern which was flushing the allocation stack and walking
the bitmaps.

Changed image writer to be compaction safe and use object monitor word
for forwarding addresses.

Added a bunch of added SIRTs to ClassLinker, MethodLinker, etc..

TODO: Enable switching allocators, compacting on background, etc..

Bug: 8981901

Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index ff1ed2a..dd3f11c 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -74,6 +74,15 @@
   return Locks::thread_list_lock_->GetExclusiveOwnerTid();
 }
 
+void ThreadList::DumpNativeStacks(std::ostream& os) {
+  MutexLock mu(Thread::Current(), *Locks::thread_list_lock_);
+  for (const auto& thread : list_) {
+    os << "DUMPING THREAD " << thread->tid_ << "\n";
+    DumpNativeStack(os, thread->tid_, "\t", true);
+    os << "\n";
+  }
+}
+
 void ThreadList::DumpForSigQuit(std::ostream& os) {
   {
     MutexLock mu(Thread::Current(), *Locks::thread_list_lock_);
@@ -413,7 +422,7 @@
           return thread;
         }
         if (total_delay_us >= kTimeoutUs) {
-          ThreadSuspendByPeerWarning(self, ERROR, "Thread suspension timed out", peer);
+          ThreadSuspendByPeerWarning(self, FATAL, "Thread suspension timed out", peer);
           if (did_suspend_request) {
             thread->ModifySuspendCount(soa.Self(), -1, debug_suspension);
           }
@@ -477,7 +486,7 @@
           return thread;
         }
         if (total_delay_us >= kTimeoutUs) {
-          ThreadSuspendByThreadIdWarning(ERROR, "Thread suspension timed out", thread_id);
+          ThreadSuspendByThreadIdWarning(WARNING, "Thread suspension timed out", thread_id);
           if (did_suspend_request) {
             thread->ModifySuspendCount(soa.Self(), -1, debug_suspension);
           }
@@ -626,7 +635,7 @@
     {
       // No more threads can be born after we start to shutdown.
       MutexLock mu(self, *Locks::runtime_shutdown_lock_);
-      CHECK(Runtime::Current()->IsShuttingDown());
+      CHECK(Runtime::Current()->IsShuttingDownLocked());
       CHECK_EQ(Runtime::Current()->NumberOfThreadsBeingBorn(), 0U);
     }
     all_threads_are_daemons = true;