test/hotspot/jtreg/gc/g1/TestParallelAlwaysPreTouch.java
author iignatyev
Thu, 08 Feb 2018 08:38:42 -0800
changeset 48883 0f1be3c7b6b2
parent 47216 71c04702a3d5
child 53523 4c5184c56dc2
permissions -rw-r--r--
8197113: combine multiple @key tags in jtreg tests Reviewed-by: hseigel, goetz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42595
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     1
/*
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     4
 *
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     8
 *
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    14
 *
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    18
 *
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    21
 * questions.
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    22
 */
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    23
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    24
/*
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    25
 * @test
48883
0f1be3c7b6b2 8197113: combine multiple @key tags in jtreg tests
iignatyev
parents: 47216
diff changeset
    26
 * @key gc regression
42595
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    27
 * @bug 8169703
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    28
 * @summary Regression test to ensure AlwaysPreTouch with multiple threads works at mutator time.
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    29
 * Allocates a few humongous objects that will be allocated by expanding the heap, causing concurrent parallel
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    30
 * pre-touch.
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    31
 * @requires vm.gc.G1
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    32
 * @run main/othervm -XX:+UseG1GC -Xms10M -Xmx100m -XX:G1HeapRegionSize=1M -XX:+AlwaysPreTouch -XX:PreTouchParallelChunkSize=512k -Xlog:gc+ergo+heap=debug,gc+heap=debug,gc=debug TestParallelAlwaysPreTouch
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    33
 */
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    34
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    35
public class TestParallelAlwaysPreTouch {
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    36
    public static void main(String[] args) throws Exception {
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    37
        final int M = 1024 * 1024; // Something guaranteed to be larger than a region to be counted as humongous.
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    38
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    39
        for (int i = 0; i < 10; i++) {
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    40
            Object[] obj = new Object[M];
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    41
            System.out.println(obj);
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    42
        }
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    43
    }
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    44
}
b1ae41a4eae9 8169703: G1 crashes with guarantee(pretouch_gang != NULL) failed: No pretouch gang specified
tschatzl
parents:
diff changeset
    45