Jit: Start the Jit when framework signals on first screen draw
Cleanup of delayed start - introduce dvmRelativeCondWait in Sync.c.
Additionally, support for deadman timer to start Jit when no screen draws
happen, and to start immediately when running stand-alone.
Fixed bug in assert variant of libdvm - recent MONITOR change had neglected
to add a new type of exit to the exit stats.
diff --git a/vm/Sync.c b/vm/Sync.c
index 5340d86..595f9db 100644
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -504,7 +504,7 @@
/*
* Converts the given relative waiting time into an absolute time.
*/
-void dvmAbsoluteTime(s8 msec, s4 nsec, struct timespec *ts)
+void absoluteTime(s8 msec, s4 nsec, struct timespec *ts)
{
s8 endSec;
@@ -533,6 +533,21 @@
}
}
+int dvmRelativeCondWait(pthread_cond_t* cond, pthread_mutex_t* mutex,
+ s8 msec, s4 nsec)
+{
+ int ret;
+ struct timespec ts;
+ absoluteTime(msec, nsec, &ts);
+#if defined(HAVE_TIMEDWAIT_MONOTONIC)
+ ret = pthread_cond_timedwait_monotonic(cond, mutex, &ts);
+#else
+ ret = pthread_cond_timedwait(cond, mutex, &ts);
+#endif
+ assert(ret == 0 || ret == ETIMEDOUT);
+ return ret;
+}
+
/*
* Wait on a monitor until timeout, interrupt, or notification. Used for
* Object.wait() and (somewhat indirectly) Thread.sleep() and Thread.join().
@@ -589,7 +604,7 @@
if (msec == 0 && nsec == 0) {
timed = false;
} else {
- dvmAbsoluteTime(msec, nsec, &ts);
+ absoluteTime(msec, nsec, &ts);
timed = true;
}