Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/regression/b4427606/b4427606.java
41159 views
/*1* Copyright (c) 2008, 2020, 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 442760626*27* @summary converted from VM Testbase jit/regression/b4427606.28* VM Testbase keywords: [jit, quick]29*30* @library /vmTestbase31* /test/lib32* @run main/othervm jit.regression.b4427606.b442760633*/3435package jit.regression.b4427606;3637import nsk.share.TestFailure;3839/*40* This is a reproducible case for a few bugs reported in merlin.41* mainly: 442760642*/43public class b4427606 {44private static final int NUM_ITERATIONS = 1000000;4546public static void main(String[] args) {47new b4427606().run();48}4950public void run() {51new DivByZero().start();52new NeverDivByZero().start();53}5455class DivByZero extends Thread {56public void run() {57long source = 1L;58long iter = NUM_ITERATIONS;59while (--iter > 0) {60try {61long ignore = source % zero;62throw new RuntimeException("Should Not Reach Here....");63} catch (java.lang.ArithmeticException ax) {64} catch (RuntimeException rx) {65rx.printStackTrace();66throw new TestFailure("Test failed.");67}68}69}70}7172class NeverDivByZero extends Thread {73public void run() {74long source = 1L;75long iter = NUM_ITERATIONS;76while (--iter > 0) {77try {78long ignore = source % notzero;79} catch (java.lang.ArithmeticException ax) {80ax.printStackTrace();81throw new TestFailure("Test failed.");82}83}84}85}86long zero = 0;87long notzero = 10;88}899091