1009N/A/*
1472N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1009N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1009N/A *
1009N/A * This code is free software; you can redistribute it and/or modify it
1009N/A * under the terms of the GNU General Public License version 2 only, as
1009N/A * published by the Free Software Foundation.
1009N/A *
1009N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1009N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1009N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1009N/A * version 2 for more details (a copy is included in the LICENSE file that
1009N/A * accompanied this code).
1009N/A *
1009N/A * You should have received a copy of the GNU General Public License version
1009N/A * 2 along with this work; if not, write to the Free Software Foundation,
1009N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1009N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
1009N/A *
1009N/A */
1009N/A
1009N/A/**
1009N/A * @test
1009N/A * @bug 6885584
1009N/A * @summary A particular class structure causes large allocation spike for jit
1009N/A *
1009N/A * @run main/othervm -Xbatch Test6885584
1009N/A */
1009N/A
1009N/A
1009N/A
1009N/Apublic class Test6885584 {
1009N/A static private int i1;
1009N/A static private int i2;
1009N/A static private int i3;
1009N/A
1009N/A static int limit = Integer.MAX_VALUE - 8;
1009N/A
1009N/A public static void main(String args[]) {
1009N/A // Run long enough to trigger an OSR
1009N/A for(int j = 200000; j != 0; j--) {
1009N/A }
1009N/A
1009N/A // This must reference a field
1009N/A i1 = i2;
1009N/A
1009N/A // The resource leak is roughly proportional to this initial value
1009N/A for(int k = Integer.MAX_VALUE - 1; k != 0; k--) {
1009N/A // Make sure the body does some work
1009N/A if(i2 > i3)i1 = k;
1009N/A if (k <= limit) break;
1009N/A }
1009N/A }
1009N/A
1009N/A}