http://cr.openjdk.java.net/~dlong/8195635/webrev.5/ https://bugs.openjdk.java.net/browse/JDK-8195635
Please see the bug report for all the gory details. Here's the short version:
If we allow any safepoint to be a suspend point, we run into trouble with PopFrame and ForceEarlyReturn, which reasonably expect the top frame not to change between the suspend and when the PopFrame/ForceEarlyReturn is executed. Normally this is not an issue, but certain safepoints cause problems, when we are about to call a new Java method. In particular, if we safepoint and suspend in JavaCallWrapper, the top frame will still be the caller, but when we execute the PopFrame/ForceEarlyReturn we will be in the callee.
The solution this patch takes is to block suspend around troublesome VM code using a new "allow_suspend" thread flag. This means JavaThread::java_suspend can't just ask the VMThread to safepoint and be done. Instead it has wait and allow threads to roll forward to an allowed suspend point.
dl
