2015-01-12 15:58:49 +00:00
|
|
|
/*
|
2023-04-11 05:49:54 +00:00
|
|
|
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
2015-01-12 15:58:49 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @test UnexpectedDeoptimizationTest
|
2020-04-09 05:58:42 +00:00
|
|
|
* @key stress randomness
|
2016-07-12 15:24:48 +00:00
|
|
|
* @summary stressing code cache by forcing unexpected deoptimizations
|
2016-08-19 14:06:30 +00:00
|
|
|
* @library /test/lib /
|
2016-04-09 22:03:39 +00:00
|
|
|
* @modules java.base/jdk.internal.misc
|
2015-03-26 15:36:56 +00:00
|
|
|
* java.management
|
2016-07-12 15:24:48 +00:00
|
|
|
*
|
2022-07-08 15:55:14 +00:00
|
|
|
* @build jdk.test.whitebox.WhiteBox compiler.codecache.stress.Helper compiler.codecache.stress.TestCaseImpl
|
|
|
|
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
2015-01-12 15:58:49 +00:00
|
|
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
2019-10-02 06:27:17 +00:00
|
|
|
* -XX:+WhiteBoxAPI
|
|
|
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
|
2016-07-12 15:24:48 +00:00
|
|
|
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
|
|
|
* -XX:-SegmentedCodeCache
|
|
|
|
* compiler.codecache.stress.UnexpectedDeoptimizationTest
|
2015-01-12 15:58:49 +00:00
|
|
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
2019-10-02 06:27:17 +00:00
|
|
|
* -XX:+WhiteBoxAPI
|
|
|
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
|
2016-07-12 15:24:48 +00:00
|
|
|
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
|
|
|
* -XX:+SegmentedCodeCache
|
|
|
|
* compiler.codecache.stress.UnexpectedDeoptimizationTest
|
8284161: Implementation of Virtual Threads (Preview)
Co-authored-by: Ron Pressler <rpressler@openjdk.org>
Co-authored-by: Alan Bateman <alanb@openjdk.org>
Co-authored-by: Erik Österlund <eosterlund@openjdk.org>
Co-authored-by: Andrew Haley <aph@openjdk.org>
Co-authored-by: Rickard Bäckman <rbackman@openjdk.org>
Co-authored-by: Markus Grönlund <mgronlun@openjdk.org>
Co-authored-by: Leonid Mesnik <lmesnik@openjdk.org>
Co-authored-by: Serguei Spitsyn <sspitsyn@openjdk.org>
Co-authored-by: Chris Plummer <cjplummer@openjdk.org>
Co-authored-by: Coleen Phillimore <coleenp@openjdk.org>
Co-authored-by: Robbin Ehn <rehn@openjdk.org>
Co-authored-by: Stefan Karlsson <stefank@openjdk.org>
Co-authored-by: Thomas Schatzl <tschatzl@openjdk.org>
Co-authored-by: Sergey Kuksenko <skuksenko@openjdk.org>
Reviewed-by: lancea, eosterlund, rehn, sspitsyn, stefank, tschatzl, dfuchs, lmesnik, dcubed, kevinw, amenkov, dlong, mchung, psandoz, bpb, coleenp, smarks, egahlin, mseledtsov, coffeys, darcy
2022-05-07 08:06:16 +00:00
|
|
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
|
|
|
* -XX:+WhiteBoxAPI
|
|
|
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
|
|
|
|
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
|
|
|
* -XX:-SegmentedCodeCache
|
2023-04-11 05:49:54 +00:00
|
|
|
* -DhelperVirtualThread=true
|
8284161: Implementation of Virtual Threads (Preview)
Co-authored-by: Ron Pressler <rpressler@openjdk.org>
Co-authored-by: Alan Bateman <alanb@openjdk.org>
Co-authored-by: Erik Österlund <eosterlund@openjdk.org>
Co-authored-by: Andrew Haley <aph@openjdk.org>
Co-authored-by: Rickard Bäckman <rbackman@openjdk.org>
Co-authored-by: Markus Grönlund <mgronlun@openjdk.org>
Co-authored-by: Leonid Mesnik <lmesnik@openjdk.org>
Co-authored-by: Serguei Spitsyn <sspitsyn@openjdk.org>
Co-authored-by: Chris Plummer <cjplummer@openjdk.org>
Co-authored-by: Coleen Phillimore <coleenp@openjdk.org>
Co-authored-by: Robbin Ehn <rehn@openjdk.org>
Co-authored-by: Stefan Karlsson <stefank@openjdk.org>
Co-authored-by: Thomas Schatzl <tschatzl@openjdk.org>
Co-authored-by: Sergey Kuksenko <skuksenko@openjdk.org>
Reviewed-by: lancea, eosterlund, rehn, sspitsyn, stefank, tschatzl, dfuchs, lmesnik, dcubed, kevinw, amenkov, dlong, mchung, psandoz, bpb, coleenp, smarks, egahlin, mseledtsov, coffeys, darcy
2022-05-07 08:06:16 +00:00
|
|
|
* compiler.codecache.stress.UnexpectedDeoptimizationTest
|
|
|
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
|
|
|
* -XX:+WhiteBoxAPI
|
|
|
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
|
|
|
|
* -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
|
|
|
|
* -XX:+SegmentedCodeCache
|
2023-04-11 05:49:54 +00:00
|
|
|
* -DhelperVirtualThread=true
|
8284161: Implementation of Virtual Threads (Preview)
Co-authored-by: Ron Pressler <rpressler@openjdk.org>
Co-authored-by: Alan Bateman <alanb@openjdk.org>
Co-authored-by: Erik Österlund <eosterlund@openjdk.org>
Co-authored-by: Andrew Haley <aph@openjdk.org>
Co-authored-by: Rickard Bäckman <rbackman@openjdk.org>
Co-authored-by: Markus Grönlund <mgronlun@openjdk.org>
Co-authored-by: Leonid Mesnik <lmesnik@openjdk.org>
Co-authored-by: Serguei Spitsyn <sspitsyn@openjdk.org>
Co-authored-by: Chris Plummer <cjplummer@openjdk.org>
Co-authored-by: Coleen Phillimore <coleenp@openjdk.org>
Co-authored-by: Robbin Ehn <rehn@openjdk.org>
Co-authored-by: Stefan Karlsson <stefank@openjdk.org>
Co-authored-by: Thomas Schatzl <tschatzl@openjdk.org>
Co-authored-by: Sergey Kuksenko <skuksenko@openjdk.org>
Reviewed-by: lancea, eosterlund, rehn, sspitsyn, stefank, tschatzl, dfuchs, lmesnik, dcubed, kevinw, amenkov, dlong, mchung, psandoz, bpb, coleenp, smarks, egahlin, mseledtsov, coffeys, darcy
2022-05-07 08:06:16 +00:00
|
|
|
* compiler.codecache.stress.UnexpectedDeoptimizationTest
|
2015-01-12 15:58:49 +00:00
|
|
|
*/
|
2016-07-12 15:24:48 +00:00
|
|
|
|
|
|
|
package compiler.codecache.stress;
|
|
|
|
|
2020-04-09 05:58:42 +00:00
|
|
|
import java.util.Random;
|
|
|
|
import jdk.test.lib.Utils;
|
|
|
|
|
2015-01-12 15:58:49 +00:00
|
|
|
public class UnexpectedDeoptimizationTest implements Runnable {
|
2020-04-09 05:58:42 +00:00
|
|
|
private final Random rng = Utils.getRandomInstance();
|
2015-01-12 15:58:49 +00:00
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
new CodeCacheStressRunner(new UnexpectedDeoptimizationTest()).runTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run() {
|
2020-04-09 05:58:42 +00:00
|
|
|
Helper.WHITE_BOX.deoptimizeFrames(rng.nextBoolean());
|
2020-11-10 11:25:53 +00:00
|
|
|
// Sleep a short while to allow the stacks to grow - otherwise
|
|
|
|
// we end up running almost all code in the interpreter
|
|
|
|
try {
|
|
|
|
Thread.sleep(10);
|
|
|
|
} catch (Exception e) {
|
|
|
|
}
|
|
|
|
|
2015-01-12 15:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|