Path: blob/master/test/hotspot/jtreg/compiler/loopopts/TestDivWithTopDivisor.java
41149 views
/*1* Copyright (c) 2021, 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*22*/2324/*25* @test26* @bug 826028427* @summary Fix "assert(_base == Int) failed: Not an Int" due to a top divisor not handled correctly in no_dependent_zero_check().28* @requires vm.compiler2.enabled29* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivWithTopDivisor compiler.loopopts.TestDivWithTopDivisor30*/3132package compiler.loopopts;3334public class TestDivWithTopDivisor {35static boolean bFld;3637static int test(int d, long e, long f) {38float g = 1;39int a, b = 4, c = 4;40int iArr[] = new int[400];41init(iArr, 8);42if (bFld) {43} else if (bFld) {44if (bFld) {45if (bFld) {46for (a = 7; a > 1; --a) {47if (bFld) {48try {49c = b / a;50b = 9 / a;51} catch (ArithmeticException k) {52}53}54}55}56g = 0;57}58} else {59iArr[d] <<= b;60}61long l = f + c + checkSum(iArr);62return (int) l;63}6465public static void init(int[] a, int seed) {66for (int j = 0; j < a.length; j++) {67a[j] = (j % 2 == 0) ? seed + j : seed - j;68}69}7071public static long checkSum(int[] a) {72long sum = 0;73for (int j = 0; j < a.length; j++) {74sum += (a[j] / (j + 1) + a[j] % (j + 1));75}76return sum;77}7879public static void main(String[] s) {80for (int i = 0; i < 10; i++) {81test(3, 0, 0);82}83}84}85868788