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