Path: blob/master/test/hotspot/jtreg/compiler/loopopts/LoopUnrollBadNodeBudget.java
41149 views
/*1* Copyright (c) 2019, 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 822949926* @summary Node estimate for loop unrolling is not correct/sufficient:27* assert(delta <= 2 * required) failed: Bad node estimate ...28*29* @requires !vm.graal.enabled30*31* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation32* LoopUnrollBadNodeBudget33*34*/3536public class LoopUnrollBadNodeBudget {3738int a;39long b;40int c;41int d(long e, short f, int g) {42int h, j = 2, k, l[][] = new int[a][];43for (h = 8; h < 58; ++h)44for (k = 1; 7 > k; ++k)45switch (h % 9 * 5 + 43) {46case 70:47case 65:48case 86:49case 81:50case 62:51case 69:52case 74:53g = j;54}55long m = u(l);56return (int)m;57}58void n(int p, int o) { d(b, (short)0, p); }59void r(String[] q) {60int i = 4;61n(i, c);62}63long u(int[][] a) {64long sum = 0;65return sum;66}67public static void main(String[] t) {68try {69LoopUnrollBadNodeBudget s = new LoopUnrollBadNodeBudget();70for (int i = 5000; i > 0; i--)71s.r(t);72} catch (Exception ex) {73}74}75}767778