test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlG1.java
author tschatzl
Mon, 14 May 2018 11:47:03 +0200
changeset 50097 ed8a43d83fcc
parent 49632 64f9ebc85e67
child 53523 4c5184c56dc2
permissions -rw-r--r--
8201491: G1 support for java.lang.ref.Reference precleaning Summary: Implement single-threaded concurrent reference precleaning for G1. Reviewed-by: sangheki, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46384
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     1
/*
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 48791
diff changeset
     2
 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
46384
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     4
 *
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     7
 * published by the Free Software Foundation.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     8
 *
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    13
 * accompanied this code).
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    14
 *
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    18
 *
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    21
 * questions.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    22
 */
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    23
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    24
/*
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    25
 * @test TestConcurrentPhaseControlG1
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    26
 * @bug 8169517
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    27
 * @requires vm.gc.G1
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    28
 * @summary Test of WhiteBox concurrent GC phase control for G1.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    29
 * @key gc
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    30
 * @modules java.base
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    31
 * @library /test/lib /
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    32
 * @build sun.hotspot.WhiteBox
48791
6e079ff6c83c 8186635: ClassFileInstaller should be run as a driver
iignatyev
parents: 47216
diff changeset
    33
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
46384
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    34
 *    sun.hotspot.WhiteBox$WhiteBoxPermission
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    35
 * @run driver TestConcurrentPhaseControlG1
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    36
 */
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    37
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    38
import gc.concurrent_phase_control.CheckControl;
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    39
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    40
public class TestConcurrentPhaseControlG1 {
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    41
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    42
    // Pairs of phase name and regex to match log stringm for stepping through,
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    43
    private static final String[][] g1PhaseInfo = {
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    44
        // Step through the phases in order.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    45
        {"IDLE", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    46
        {"CONCURRENT_CYCLE", "Concurrent Cycle"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    47
        {"IDLE", null},  // Resume IDLE before testing subphases
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    48
        {"CLEAR_CLAIMED_MARKS", "Concurrent Clear Claimed Marks"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    49
        {"SCAN_ROOT_REGIONS", "Concurrent Scan Root Regions"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    50
        // ^F so not "From Roots", ^R so not "Restart"
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    51
        {"CONCURRENT_MARK", "Concurrent Mark [^FR]"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    52
        {"IDLE", null},  // Resume IDLE before testing subphases
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    53
        {"MARK_FROM_ROOTS", "Concurrent Mark From Roots"},
50097
ed8a43d83fcc 8201491: G1 support for java.lang.ref.Reference precleaning
tschatzl
parents: 49632
diff changeset
    54
        {"PRECLEAN", "Concurrent Preclean"},
46384
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    55
        {"BEFORE_REMARK", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    56
        {"REMARK", "Pause Remark"},
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 48791
diff changeset
    57
        {"REBUILD_REMEMBERED_SETS", "Concurrent Rebuild Remembered Sets"},
46384
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    58
        // Clear request
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    59
        {"IDLE", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    60
        {"ANY", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    61
        // Request a phase.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    62
        {"MARK_FROM_ROOTS", "Concurrent Mark From Roots"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    63
        // Request an earlier phase, to ensure loop rather than stuck at idle.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    64
        {"SCAN_ROOT_REGIONS", "Concurrent Scan Root Regions"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    65
        // Clear request, to unblock service.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    66
        {"IDLE", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    67
        {"ANY", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    68
    };
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    69
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    70
    private static final String[] g1Options =
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    71
        new String[]{"-XX:+UseG1GC",  "-Xlog:gc,gc+marking"};
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    72
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    73
    private static final String g1Name = "G1";
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    74
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    75
    public static void main(String[] args) throws Exception {
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    76
        CheckControl.check(g1Name, g1Options, g1PhaseInfo);
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    77
    }
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    78
}