Fix portable + mips build.

Change-Id: Ia200e582b04c84973281e12331777351feb8a401
diff --git a/compiler/elf_writer_mclinker.cc b/compiler/elf_writer_mclinker.cc
index 8e19ef6..f3fef23 100644
--- a/compiler/elf_writer_mclinker.cc
+++ b/compiler/elf_writer_mclinker.cc
@@ -358,10 +358,11 @@
     mirror::ArtMethod* method = NULL;
     if (compiler_driver_->IsImage()) {
       ClassLinker* linker = Runtime::Current()->GetClassLinker();
-      mirror::DexCache* dex_cache = linker->FindDexCache(dex_file);
       // Unchecked as we hold mutator_lock_ on entry.
       ScopedObjectAccessUnchecked soa(Thread::Current());
-      method = linker->ResolveMethod(dex_file, method_idx, dex_cache, NULL, NULL, invoke_type);
+      SirtRef<mirror::DexCache> dex_cache(soa.Self(), linker->FindDexCache(dex_file));
+      SirtRef<mirror::ClassLoader> class_loader(soa.Self(), nullptr);
+      method = linker->ResolveMethod(dex_file, method_idx, dex_cache, class_loader, NULL, invoke_type);
       CHECK(method != NULL);
     }
     const CompiledMethod* compiled_method =
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index a875017..feb8a6c 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -329,11 +329,6 @@
   // TODO: remove this.
   void WaitHoldingLocks(Thread* self) NO_THREAD_SAFETY_ANALYSIS;
 
-  // Return the number of people that are waiting on this condition.
-  int32_t GetNumWaiters() const NO_THREAD_SAFETY_ANALYSIS {
-    return num_waiters_;
-  }
-
  private:
   const char* const name_;
   // The Mutex being used by waiters. It is an error to mix condition variables between different
diff --git a/runtime/globals.h b/runtime/globals.h
index 10426b0..1a25dfa 100644
--- a/runtime/globals.h
+++ b/runtime/globals.h
@@ -73,8 +73,14 @@
 const bool kIsTargetBuild = false;
 #endif
 
+#if defined(ART_USE_PORTABLE_COMPILER)
+constexpr bool kUsePortableCompiler = true;
+#else
+constexpr bool kUsePortableCompiler = false;
+#endif
+
 // Garbage collector constants.
-static constexpr bool kMovingCollector = false;
+static constexpr bool kMovingCollector = false && !kUsePortableCompiler;
 // True if we allow moving classes.
 static constexpr bool kMovingClasses = false;
 // True if we allow moving fields.
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index 7fada9e..af93a56 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -82,6 +82,7 @@
 Monitor::Monitor(Thread* owner, mirror::Object* obj, int32_t hash_code)
     : monitor_lock_("a monitor lock", kMonitorLock),
       monitor_contenders_("monitor contenders", monitor_lock_),
+      num_waiters_(0),
       owner_(owner),
       lock_count_(0),
       obj_(obj),
@@ -225,7 +226,9 @@
       ScopedThreadStateChange tsc(self, kBlocked);  // Change to blocked and give up mutator_lock_.
       MutexLock mu2(self, monitor_lock_);  // Reacquire monitor_lock_ without mutator_lock_ for Wait.
       if (owner_ != NULL) {  // Did the owner_ give the lock up?
+        ++num_waiters_;
         monitor_contenders_.Wait(self);  // Still contended so wait.
+        --num_waiters_;
         // Woken from contention.
         if (log_contention) {
           uint64_t wait_ms = MilliTime() - wait_start_ms;
@@ -581,7 +584,7 @@
         return false;
       }
       // Can't deflate if we have anybody waiting on the CV.
-      if (monitor->monitor_contenders_.GetNumWaiters() > 0) {
+      if (monitor->num_waiters_ > 0) {
         return false;
       }
       // Deflate to a thin lock.
diff --git a/runtime/monitor.h b/runtime/monitor.h
index d7de8a5..bfd8545 100644
--- a/runtime/monitor.h
+++ b/runtime/monitor.h
@@ -174,6 +174,9 @@
   Mutex monitor_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
   ConditionVariable monitor_contenders_ GUARDED_BY(monitor_lock_);
 
+  // Number of people waiting on the condition.
+  size_t num_waiters_ GUARDED_BY(monitor_lock_);
+
   // Which thread currently owns the lock?
   Thread* volatile owner_ GUARDED_BY(monitor_lock_);