Jit: Rework monitor enter/exit to simplify thread suspension

The Jit must stop all threads in order to flush the translation cache (and
other tables).  Threads which are blocked in a monitor wait cause some
headache here because they effectively hold a references to the translation
cache (though the return address on the native stack).  The new model
introduced in this CL is that for the fast path of monitor enter, control
is allowed to resume in the translation cache.  However, if we need to do a
heavyweight lock (which may cause us to block) control does not return to the
translation cache but instead bails out to the interpreter.  This allows us to
safely clear the code cache even if some threads are in THREAD_MONITOR state.
15 files changed