Add some functions and move down the Knobs for adaptive spinning in order to do more experiments on the heuristics.
TrySpin should return a boolean.
TryLock returns either -1, 0, or 1 depending on whether the CAS is attempted or another owner is found. The caller in spinning can use this value to see if a CAS fails, to stop spinning, even in the short spin.
Some benchmarks like Dacapo pmd show a 22% improvement with just a fixed spin of 2000. pmd waits on the ClassLoader lock, but briefly after the classes are loaded. Rearrange the code to make prototyping easier.
TrySpin should return a boolean.
TryLock returns either -1, 0, or 1 depending on whether the CAS is attempted or another owner is found. The caller in spinning can use this value to see if a CAS fails, to stop spinning, even in the short spin.
Some benchmarks like Dacapo pmd show a 22% improvement with just a fixed spin of 2000. pmd waits on the ClassLoader lock, but briefly after the classes are loaded. Rearrange the code to make prototyping easier.
- relates to
-
JDK-8332360 JVM hangs at exit when running on a uniprocessor
- Resolved