9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 /** 26 * @test 27 * @bug 6869327 28 * @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop 29 * @library /testlibrary 30 * @modules java.base/jdk.internal.misc 31 * @ignore 8146096 32 * @run driver compiler.loopopts.UseCountedLoopSafepoints 33 */ 34 35 package compiler.loopopts; 36 37 import jdk.test.lib.OutputAnalyzer; 38 import jdk.test.lib.ProcessTools; 39 40 import java.util.concurrent.atomic.AtomicLong; 41 42 public class UseCountedLoopSafepoints { 43 private static final AtomicLong _num = new AtomicLong(0); 44 45 // Uses the fact that an EnableBiasedLocking vmop will be started 46 // after 500ms, while we are still in the loop. If there is a 47 // safepoint in the counted loop, then we will reach safepoint 48 // very quickly. Otherwise SafepointTimeout will be hit. 49 public static void main (String args[]) throws Exception { 50 if (args.length == 1) { 51 final int loops = Integer.parseInt(args[0]); 52 for (int i = 0; i < loops; i++) { 53 _num.addAndGet(1); 54 } 55 } else { 56 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( 57 "-XX:+IgnoreUnrecognizedVMOptions", 58 "-XX:-TieredCompilation", | 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 /** 26 * @test 27 * @bug 6869327 28 * @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop 29 * @library /test/lib 30 * @modules java.base/jdk.internal.misc 31 * @ignore 8146096 32 * @run driver compiler.loopopts.UseCountedLoopSafepoints 33 */ 34 35 package compiler.loopopts; 36 37 import jdk.test.lib.process.OutputAnalyzer; 38 import jdk.test.lib.process.ProcessTools; 39 40 import java.util.concurrent.atomic.AtomicLong; 41 42 public class UseCountedLoopSafepoints { 43 private static final AtomicLong _num = new AtomicLong(0); 44 45 // Uses the fact that an EnableBiasedLocking vmop will be started 46 // after 500ms, while we are still in the loop. If there is a 47 // safepoint in the counted loop, then we will reach safepoint 48 // very quickly. Otherwise SafepointTimeout will be hit. 49 public static void main (String args[]) throws Exception { 50 if (args.length == 1) { 51 final int loops = Integer.parseInt(args[0]); 52 for (int i = 0; i < loops; i++) { 53 _num.addAndGet(1); 54 } 55 } else { 56 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( 57 "-XX:+IgnoreUnrecognizedVMOptions", 58 "-XX:-TieredCompilation", |