Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java
41159 views
1
/*
2
* Copyright (c) 2017, 2021, 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
/*
26
* @test
27
*
28
* @summary converted from VM Testbase vm/compiler/CodeCacheInfo.
29
* VM Testbase readme:
30
* DESCRIPTION
31
* Test calls java -version and checks enhanced output format of the
32
* -XX:+PrintCodeCache vm option.
33
*
34
* @library /vmTestbase
35
* /test/lib
36
* @build sun.hotspot.WhiteBox
37
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
38
* @run main/othervm
39
* -Xmixed
40
* -Xbootclasspath/a:.
41
* -XX:+UnlockDiagnosticVMOptions
42
* -XX:+WhiteBoxAPI
43
* vm.compiler.CodeCacheInfo.Test
44
*/
45
46
package vm.compiler.CodeCacheInfo;
47
48
import sun.hotspot.WhiteBox;
49
import jdk.test.lib.process.OutputAnalyzer;
50
import jdk.test.lib.process.ProcessTools;
51
52
public class Test {
53
private static final String SEG_REGEXP;
54
private static final String NOSEG_REGEXP;
55
56
static {
57
String p1 = " size=\\d+Kb used=\\d+Kb max_used=\\d+Kb free=\\d+Kb\\n";
58
String p2 = " bounds \\[0x[0-9a-f]+, 0x[0-9a-f]+, 0x[0-9a-f]+\\]\\n";
59
String p3 = " total_blobs=\\d+ nmethods=\\d+ adapters=\\d+\\n";
60
String p4 = " compilation: enabled\\n";
61
62
String segPrefix = "^(CodeHeap '[^']+':" + p1 + p2 + ")+";
63
String nosegPrefix = "^CodeCache:" + p1 + p2;
64
65
SEG_REGEXP = segPrefix + p3 + p4;
66
NOSEG_REGEXP = nosegPrefix + p3 + p4;
67
}
68
69
public static void main(String[] args) throws Exception {
70
{
71
System.out.println("SegmentedCodeCache is enabled");
72
var pb = ProcessTools.createTestJvm(
73
"-XX:+SegmentedCodeCache",
74
"-XX:+PrintCodeCache",
75
"-version");
76
var output = new OutputAnalyzer(pb.start());
77
output.shouldHaveExitValue(0);
78
output.stdoutShouldMatch(SEG_REGEXP);
79
}
80
{
81
System.out.println("SegmentedCodeCache is disabled");
82
var pb = ProcessTools.createTestJvm(
83
"-XX:-SegmentedCodeCache",
84
"-XX:+PrintCodeCache",
85
"-version");
86
var output = new OutputAnalyzer(pb.start());
87
output.shouldHaveExitValue(0);
88
output.stdoutShouldMatch(NOSEG_REGEXP);
89
}
90
}
91
}
92
93