Require ART_USE_FUTEXES in monitor.cc

Garbage collection has long failed without ART_USE_FUTEXES,
since WakeupToRespondToEmptyCheckpoint() doesn't have a usable
implementation without it. For many months now, monitor.cc
hasn't compiled without ART_USES_FUTEXES. Any real testing is
impossible.

Just accept that we don't support it.

We might still need Mutexes to work in that case to support
some tools. Thus that support stays for now. Filed b/182277569
to investigate that further.

Bug: 182175143
Test: Build and boot AOSP.
Change-Id: I6bf4a5b01c4c679ba8b19479add7f3bf8e9f963e
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index 7d97b73..295e76c 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -43,6 +43,8 @@
 #include "verifier/method_verifier.h"
 #include "well_known_classes.h"
 
+static_assert(ART_USE_FUTEXES);
+
 namespace art {
 
 using android::base::StringPrintf;
@@ -216,7 +218,7 @@
   // than what clang thread safety analysis understands.
   // Monitor is not yet public.
   Thread* owner = owner_.load(std::memory_order_relaxed);
-  CHECK(owner == nullptr || owner == self || (ART_USE_FUTEXES && owner->IsSuspended()));
+  CHECK(owner == nullptr || owner == self || owner->IsSuspended());
   // Propagate the lock state.
   LockWord lw(GetObject()->GetLockWord(false));
   switch (lw.GetState()) {
@@ -225,11 +227,7 @@
       CHECK_EQ(owner->GetThreadId(), lw.ThinLockOwner());
       DCHECK_EQ(monitor_lock_.GetExclusiveOwnerTid(), 0) << " my tid = " << SafeGetTid(self);
       lock_count_ = lw.ThinLockCount();
-#if ART_USE_FUTEXES
       monitor_lock_.ExclusiveLockUncontendedFor(owner);
-#else
-      monitor_lock_.ExclusiveLock(owner);
-#endif
       DCHECK_EQ(monitor_lock_.GetExclusiveOwnerTid(), owner->GetTid())
           << " my tid = " << SafeGetTid(self);
       LockWord fat(this, lw.GCState());
@@ -241,13 +239,7 @@
         }
         return true;
       } else {
-#if ART_USE_FUTEXES
         monitor_lock_.ExclusiveUnlockUncontended();
-#else
-        for (uint32_t i = 0; i <= lockCount; ++i) {
-          monitor_lock_.ExclusiveUnlock(owner);
-        }
-#endif
         return false;
       }
     }
@@ -1106,10 +1098,6 @@
   constexpr size_t kExtraSpinIters = 100;
   StackHandleScope<1> hs(self);
   Handle<mirror::Object> h_obj(hs.NewHandle(obj));
-#if !ART_USE_FUTEXES
-  // In this case we cannot inflate an unowned monitor, so we sometimes defer inflation.
-  bool should_inflate = false;
-#endif
   while (true) {
     // We initially read the lockword with ordinary Java/relaxed semantics. When stronger
     // semantics are needed, we address it below. Since GetLockWord bottoms out to a relaxed load,
@@ -1120,11 +1108,6 @@
         // No ordering required for preceding lockword read, since we retest.
         LockWord thin_locked(LockWord::FromThinLockId(thread_id, 0, lock_word.GCState()));
         if (h_obj->CasLockWord(lock_word, thin_locked, CASMode::kWeak, std::memory_order_acquire)) {
-#if !ART_USE_FUTEXES
-          if (should_inflate) {
-            InflateThinLocked(self, h_obj, lock_word, 0);
-          }
-#endif
           AtraceMonitorLock(self, h_obj.Get(), /* is_wait= */ false);
           return h_obj.Get();  // Success!
         }
@@ -1178,16 +1161,9 @@
               sched_yield();
             }
           } else {
-#if ART_USE_FUTEXES
             contention_count = 0;
             // No ordering required for initial lockword read. Install rereads it anyway.
             InflateThinLocked(self, h_obj, lock_word, 0);
-#else
-            // Can't inflate from non-owning thread. Keep waiting. Bad for power, but this code
-            // isn't used on-device.
-            should_inflate = true;
-            usleep(10);
-#endif
           }
         }
         continue;  // Start from the beginning.