Eliminate more unused variables and compiler warnings.

This change also introduces wrappers for condition variable operations
similar to what we have already for mutex operations.

Almost all the remaining warnings are now in the compiler or non-debug
uses of the CHECK_JIT macro.

Change-Id: I9f492f1582a06065e3a52287c7834adddfbefff9
diff --git a/vm/Sync.c b/vm/Sync.c
index 90df500..8f906ac 100644
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -470,6 +470,7 @@
  *
  * Returns "true" on success.
  */
+#ifdef WITH_COPYING_GC
 static bool tryLockMonitor(Thread* self, Monitor* mon)
 {
     if (mon->owner == self) {
@@ -485,7 +486,7 @@
         }
     }
 }
-
+#endif
 
 /*
  * Unlock a monitor.
@@ -524,6 +525,7 @@
  * Checks the wait set for circular structure.  Returns 0 if the list
  * is not circular.  Otherwise, returns 1.  Used only by asserts.
  */
+#ifndef NDEBUG
 static int waitSetCheck(Monitor *mon)
 {
     Thread *fast, *slow;
@@ -541,6 +543,7 @@
         slow = slow->waitNext;
     }
 }
+#endif
 
 /*
  * Links a thread into a monitor's wait set.  The monitor lock must be