The removal of vm_suspend/vm_resume in 6498391 exposed further areas where the Java suspend/resume code can be cleaned up to reduce complexity:
1. The SR_lock() is used in a number of places within the thread creation code to protect access to OSThread state. This protection is unnecessary for two reasons:
a) The OSThread instance, and the associated JavaThread instance has not been
published at the time and so can not be concurrently accessed. Further, its use
in this context is inconsistent across different platform code.
b) There is no need to protect access to the OSThread state at all because
- it is volatile and defined as a "hint"
- it is usually set with no lock held
- it is read with no lock held (target is often suspended)
By removing the use of the SR_lock() with OSThread state the SR_lock now serves solely as the lock/monitor used by the Java "external" suspend/resume mechanism, and
general protection of the _suspend_flags field. This cleanup also makes it easier to see how to remove the use of OSThread altogether - which is occurring in a seperate task
2. The "platform dependent" pd_self_suspend_thread method is no longer platform dependent (and hasn't been for some time). All platforms have a thread self-suspend by waiting on the SR_lock() monitor. This code can be moved directly into the JavaThread::java_suspend_self method, thereby simplifying the code and removing platform-specific functionality (which is a good goal)