author | epavlova |
Mon, 02 Oct 2017 14:31:34 -0700 | |
changeset 47576 | 7645833d326f |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
4012
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4012
diff
changeset
|
2 |
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
4012
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
4 |
* |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
8 |
* |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
13 |
* accompanied this code). |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
14 |
* |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
18 |
* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4012
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4012
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4012
diff
changeset
|
21 |
* questions. |
4012
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
22 |
*/ |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
23 |
|
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
24 |
/** |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
25 |
* @test |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
26 |
* @bug 6885584 |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
27 |
* @summary A particular class structure causes large allocation spike for jit |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
28 |
* |
40059 | 29 |
* @run main/othervm -Xbatch compiler.c2.Test6885584 |
4012
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
30 |
*/ |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
31 |
|
40059 | 32 |
package compiler.c2; |
4012
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
33 |
|
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
34 |
public class Test6885584 { |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
35 |
static private int i1; |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
36 |
static private int i2; |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
37 |
static private int i3; |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
38 |
|
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
39 |
static int limit = Integer.MAX_VALUE - 8; |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
40 |
|
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
41 |
public static void main(String args[]) { |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
42 |
// Run long enough to trigger an OSR |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
43 |
for(int j = 200000; j != 0; j--) { |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
44 |
} |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
45 |
|
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
46 |
// This must reference a field |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
47 |
i1 = i2; |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
48 |
|
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
49 |
// The resource leak is roughly proportional to this initial value |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
50 |
for(int k = Integer.MAX_VALUE - 1; k != 0; k--) { |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
51 |
// Make sure the body does some work |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
52 |
if(i2 > i3)i1 = k; |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
53 |
if (k <= limit) break; |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
54 |
} |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
55 |
} |
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
56 |
|
579b7bad9983
6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff
changeset
|
57 |
} |