1 /*
2 * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
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 * @test OverloadCompileQueueTest
26 * @key stress randomness
27 * @summary stressing code cache by overloading compile queues
28 * @library /test/lib /
29 * @modules java.base/jdk.internal.misc
30 * java.management
31 *
32 * @build jdk.test.whitebox.WhiteBox
33 * compiler.codecache.stress.TestCaseImpl
34 * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
35 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
36 * -XX:+WhiteBoxAPI
37 * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
38 * -XX:CompileCommand=exclude,java.lang.Thread::sleep
39 * -XX:CompileCommand=exclude,java.lang.Thread::sleepNanos
40 * -XX:CompileCommand=exclude,java.lang.Thread::beforeSleep
41 * -XX:CompileCommand=exclude,java.lang.Thread::afterSleep
42 * -XX:CompileCommand=exclude,java.lang.Math::min
43 * -XX:CompileCommand=exclude,jdk.internal.event.ThreadSleepEvent::*
44 * -XX:CompileCommand=exclude,jdk.internal.event.SleepEvent::*
45 * -XX:CompileCommand=exclude,jdk.internal.event.Event::*
46 * -XX:-SegmentedCodeCache
47 * compiler.codecache.stress.OverloadCompileQueueTest
48 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
49 * -XX:+WhiteBoxAPI
50 * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
51 * -XX:CompileCommand=exclude,java.lang.Thread::sleep
52 * -XX:CompileCommand=exclude,java.lang.Thread::sleepNanos
53 * -XX:CompileCommand=exclude,java.lang.Thread::beforeSleep
54 * -XX:CompileCommand=exclude,java.lang.Thread::afterSleep
55 * -XX:CompileCommand=exclude,java.lang.Math::min
56 * -XX:CompileCommand=exclude,jdk.internal.event.ThreadSleepEvent::*
57 * -XX:CompileCommand=exclude,jdk.internal.event.SleepEvent::*
58 * -XX:CompileCommand=exclude,jdk.internal.event.Event::*
59 * -XX:+SegmentedCodeCache
60 * compiler.codecache.stress.OverloadCompileQueueTest
61 */
62
63 package compiler.codecache.stress;
64
65 import jdk.test.lib.Platform;
66 import jdk.test.lib.Utils;
67
68 import java.lang.reflect.Method;
69 import java.util.stream.IntStream;
70 import java.util.Random;
71
72 class LockUnlockThread extends Thread {
73 private static final int MAX_SLEEP = 10000;
74 private static final int DELAY_BETWEEN_LOCKS = 100;
|
1 /*
2 * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
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 * @test OverloadCompileQueueTest
26 * @key stress randomness
27 * @summary stressing code cache by overloading compile queues
28 * @library /test/lib /
29 * @modules java.base/jdk.internal.misc
30 * java.management
31 *
32 * @build jdk.test.whitebox.WhiteBox
33 * compiler.codecache.stress.TestCaseImpl
34 * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
35 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
36 * -XX:+WhiteBoxAPI
37 * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
38 * -XX:CompileCommand=exclude,java.lang.Thread::sleep
39 * -XX:CompileCommand=exclude,java.lang.Thread::sleepNanos
40 * -XX:CompileCommand=exclude,java.lang.Thread::beforeSleep
41 * -XX:CompileCommand=exclude,java.lang.Thread::afterSleep
42 * -XX:CompileCommand=exclude,java.util.concurrent.TimeUnit::toNanos
43 * -XX:CompileCommand=exclude,java.lang.Math::min
44 * -XX:CompileCommand=exclude,jdk.internal.event.ThreadSleepEvent::*
45 * -XX:CompileCommand=exclude,jdk.internal.event.SleepEvent::*
46 * -XX:CompileCommand=exclude,jdk.internal.event.Event::*
47 * -XX:-SegmentedCodeCache
48 * compiler.codecache.stress.OverloadCompileQueueTest
49 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
50 * -XX:+WhiteBoxAPI
51 * -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
52 * -XX:CompileCommand=exclude,java.lang.Thread::sleep
53 * -XX:CompileCommand=exclude,java.lang.Thread::sleepNanos
54 * -XX:CompileCommand=exclude,java.lang.Thread::beforeSleep
55 * -XX:CompileCommand=exclude,java.lang.Thread::afterSleep
56 * -XX:CompileCommand=exclude,java.util.concurrent.TimeUnit::toNanos
57 * -XX:CompileCommand=exclude,java.lang.Math::min
58 * -XX:CompileCommand=exclude,jdk.internal.event.ThreadSleepEvent::*
59 * -XX:CompileCommand=exclude,jdk.internal.event.SleepEvent::*
60 * -XX:CompileCommand=exclude,jdk.internal.event.Event::*
61 * -XX:+SegmentedCodeCache
62 * compiler.codecache.stress.OverloadCompileQueueTest
63 */
64
65 package compiler.codecache.stress;
66
67 import jdk.test.lib.Platform;
68 import jdk.test.lib.Utils;
69
70 import java.lang.reflect.Method;
71 import java.util.stream.IntStream;
72 import java.util.Random;
73
74 class LockUnlockThread extends Thread {
75 private static final int MAX_SLEEP = 10000;
76 private static final int DELAY_BETWEEN_LOCKS = 100;
|