Path: blob/master/test/hotspot/jtreg/gc/shenandoah/compiler/TestBadRawMemoryAfterCall.java
41153 views
/*1* Copyright (c) 2021, Red Hat, Inc. 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 8258393 826337626* @summary Shenandoah: "graph should be schedulable" assert failure27* @requires vm.flavor == "server"28* @requires vm.gc.Shenandoah29*30* @run main/othervm -XX:+UseShenandoahGC -XX:-BackgroundCompilation TestBadRawMemoryAfterCall31*32*/3334public class TestBadRawMemoryAfterCall {35public static void main(String[] args) {36A a = new A();37B b = new B();38C c = new C();39for (int i = 0; i < 20_000; i++) {40test1(a);41test1(b);42test1(c);4344test2(a, i);45test2(b, i);46test2(c, i);47}48}4950private static Object test1(A a) {51if (a.getClass() == A.class) {52}5354Object o = null;55try {56a.m();57o = a.getClass();58} catch (Exception e) {5960}61return o;62}6364static int field;6566private static Object test2(A a, int i) {67if (a.getClass() == A.class) {68}6970Object o = null;71try {72a.m();73o = a.getClass();74} catch (Exception e) {75i = 42;76}77if (i == 42) {78field = 42;79}80return o;81}8283private static class A {84void m() throws Exception {85throw new Exception();86}87}88private static class B extends A {89void m() {90}91}92private static class C extends B {93void m() {94}95}96}979899