private static void removeLoopSafepoint(StructuredGraph graph){
  LoopBeginNode loopBegin=findFirstLoop(graph);
  loopBegin.disableSafepoint();
}

private static void removeLoopSafepoint ( StructuredGraph graph ) { LoopBeginNode loopBegin = findFirstLoop ( graph ) ; loopBegin . disableSafepoint ( ) ; }
remove the safepoint from the first loop in the test method , so only the safepoints on monitorenter and monitorexit remain in the loop . that way , we can make sure it deopts inside the monitorenter by invalidating the code while holding the lock .
