1 /* 2 * Copyright (c) 2017, Red Hat, Inc. 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 26 * @bug 8188151 27 * @summary assert failure with 2 handlers at same bci 28 * @run main/othervm -XX:-BackgroundCompilation -XX:CompileOnly=TestC1ExceptionHandlersSameBCI::test1 -XX:CompileOnly=TestC1ExceptionHandlersSameBCI::test2 -XX:CompileCommand=dontinline,TestC1ExceptionHandlersSameBCI::not_inline1 -XX:CompileCommand=dontinline,TestC1ExceptionHandlersSameBCI::not_inline2 TestC1ExceptionHandlersSameBCI 29 * 30 */ 31 32 public class TestC1ExceptionHandlersSameBCI { 33 static class Ex1 extends Exception { 34 35 } 36 static class Ex2 extends Exception { 37 38 } 39 40 static void not_inline1() throws Ex1, Ex2 { 41 42 } 43 44 static void not_inline2(int v) { 45 46 } 47 48 static void test1() throws Ex1, Ex2 { 49 int i = 0; 50 try { 51 not_inline1(); 52 i = 1; 53 not_inline1(); 54 } catch (Ex1|Ex2 ex) { 55 not_inline2(i); 56 } 57 } 58 59 static void test2() { 60 int i = 0; 61 try { 62 test1(); 63 i = 1; 64 test1(); 65 } catch (Ex1|Ex2 ex) { 66 not_inline2(i); 67 } 68 } 69 70 static public void main(String[] args) { 71 for (int i = 0; i < 5000; i++) { 72 test2(); 73 } 74 } 75 }