Path: blob/master/test/hotspot/jtreg/compiler/loopopts/LoopRotateBadNodeBudget.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 823156526* @summary Node estimate for loop rotate is not correct/sufficient:27* assert(delta <= 2 * required) failed: Bad node estimate ...28*29* @requires vm.compiler2.enabled & !vm.graal.enabled30*31* @run main/othervm -XX:PartialPeelNewPhiDelta=5 LoopRotateBadNodeBudget32* @run main/othervm -Xbatch -XX:PartialPeelNewPhiDelta=5 LoopRotateBadNodeBudget33*34* @run main/othervm LoopRotateBadNodeBudget35* @run main/othervm -Xbatch LoopRotateBadNodeBudget36*37* NOTE: Test-case seldom manifesting the problem on fast machines.38*/3940public class LoopRotateBadNodeBudget {4142int h;43float j(int a, int b) {44double d = 0.19881;45int c, e[] = new int[9];46c = 1;47while (++c < 12)48switch ((c % 7 * 5) + 122) {49case 156:50case 46128:51case 135:52case 148:53case 127:54break;55default:56}57while ((d += 2) < 62)58;59long k = l(e);60return k;61}62long l(int[] a) {63long m = 0;64for (int i = 0; i < a.length; i++)65m = a[i];66return m;67}68void f(String[] g) {69int i = 2;70for (; i < 20000; ++i)71j(3, h);72}73public static void main(String[] o) {74try {75LoopRotateBadNodeBudget n = new LoopRotateBadNodeBudget();76n.f(o);77} catch (Exception ex) {78}79}80}818283