Path: blob/master/test/jdk/com/sun/jdi/DeoptimizeWalk.java
41149 views
/*1* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 452571426* @summary jtreg test PopAsynchronousTest fails in build 85 with -Xcomp27* @comment converted from test/jdk/com/sun/jdi/DeoptimizeWalk.sh28*29* @library /test/lib30* @compile -g DeoptimizeWalk.java31* @run main/othervm DeoptimizeWalk32*/3334import jdk.test.lib.process.OutputAnalyzer;35import lib.jdb.JdbCommand;36import lib.jdb.JdbTest;3738/*39* The bug (JDK-4525714) is about failing PopAsynchronousTest test.40* This is another test of the same issue. The bug occurs when trying41* to walk the stack of a deoptimized thread. We can do this42* by running in -Xcomp mode and by doing a step which causes deopt,43* and then a 'where'. This will cause not all the frames to be shown.44*/4546class DeoptimizeWalkTarg {47static public void main(String[] args) {48DeoptimizeWalkTarg mine = new DeoptimizeWalkTarg();49mine.a1(89);50}5152public void a1(int p1) {53int v1 = 89;54System.out.println("a1" + v1);55a2(89);56}5758public void a2(int pp) {59int v2 = 89;60System.out.println("a2" + v2);61a3(89);62}6364public void a3(int pp) {65int v3 = 89;66System.out.println("a3"); //@ 1 breakpoint67a4(22); // it passes if this line is commented out68System.out.println("jj");69}7071public void a4(int pp) {72int v4 = 90;73System.out.println("a4: @1 breakpoint here");74}75}767778public class DeoptimizeWalk extends JdbTest {79public static void main(String argv[]) {80new DeoptimizeWalk().run();81}8283private DeoptimizeWalk() {84super(new LaunchOptions(DEBUGGEE_CLASS)85.addDebuggeeOptions(DEBUGGEE_OPTIONS));86}8788private static final String DEBUGGEE_CLASS = DeoptimizeWalkTarg.class.getName();89private static final String[] DEBUGGEE_OPTIONS = {"-Xcomp"};9091@Override92protected void runCases() {93setBreakpointsFromTestSource("DeoptimizeWalk.java", 1);94jdb.command(JdbCommand.run());9596jdb.command(JdbCommand.where(""));97jdb.command(JdbCommand.step());98jdb.command(JdbCommand.where(""));99100jdb.contToExit(1);101102new OutputAnalyzer(getJdbOutput())103.shouldContain(DEBUGGEE_CLASS + ".main");104new OutputAnalyzer(getDebuggeeOutput())105.shouldNotContain("Internal exception:");106}107}108109110111