Path: blob/master/test/hotspot/jtreg/compiler/c2/Test6885584.java
41152 views
/*1* Copyright (c) 2009, 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 688558426* @summary A particular class structure causes large allocation spike for jit27*28* @run main/othervm -Xbatch compiler.c2.Test688558429*/3031package compiler.c2;3233public class Test6885584 {34static private int i1;35static private int i2;36static private int i3;3738static int limit = Integer.MAX_VALUE - 8;3940public static void main(String args[]) {41// Run long enough to trigger an OSR42for(int j = 200000; j != 0; j--) {43}4445// This must reference a field46i1 = i2;4748// The resource leak is roughly proportional to this initial value49for(int k = Integer.MAX_VALUE - 1; k != 0; k--) {50// Make sure the body does some work51if(i2 > i3)i1 = k;52if (k <= limit) break;53}54}5556}575859