hotspot/test/compiler/6885584/Test6885584.java
author iignatyev
Sat, 19 Jul 2014 00:34:40 +0400
changeset 25737 71793afd180f
parent 5547 f4b087cbb361
permissions -rw-r--r--
8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED: Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
/**
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    26
 * @test
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    27
 * @bug 6885584
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    28
 * @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
    29
 *
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    30
 * @run main/othervm -Xbatch Test6885584
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    31
 */
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    32
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
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    35
public class Test6885584 {
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    36
   static private int i1;
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    37
   static private int i2;
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    38
   static private int i3;
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    39
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    40
    static int limit = Integer.MAX_VALUE - 8;
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    41
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    42
   public static void main(String args[]) {
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    43
       // Run long enough to trigger an OSR
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    44
       for(int j = 200000; j != 0; j--) {
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
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    47
       // This must reference a field
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    48
       i1 = i2;
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    49
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    50
       // 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
    51
       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
    52
           // Make sure the body does some work
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    53
           if(i2 > i3)i1 = k;
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    54
           if (k <= limit) break;
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
579b7bad9983 6885584: A particular class structure causes large allocation spike for jit
never
parents:
diff changeset
    58
}