safepoint:
JIT编码时,会在代码中所有方法的返回之前,以及所有非counted loop的循环(无界循环)回跳之前放置一个safepoint(counted loop则没有放置safepoint)。GC 等操作时,需要所有线程达到safepoint。
UseCountedLoopSafepoints:
可以避免GC发生时,线程因长时间运行counted loop,进入不到safepoint,而引起GC的STW时间过长。
UseCountedLoopSafepoints解决此bug
https://bugs.openjdk.java.net/browse/JDK-8195980
但使用UseCountedLoopSafepoints,java 1.8.131之前会有这个bug
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8161147
参考:https://www.jianshu.com/p/c79c5e02ebe6
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8161147