Mercurial > hg > graal-jvmci-8
comparison test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java @ 23820:10bdaf505b64
8055844: [TESTBUG] test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java fails on Solaris Sparc due to incorrect page size being used
Summary: Use 128KB chunks for virtual memory operations
Reviewed-by: zgu, gtriantafill
author | ctornqvi |
---|---|
date | Fri, 22 Aug 2014 14:21:41 -0700 |
parents | 3670c195cb8b |
children |
comparison
equal
deleted
inserted
replaced
23819:c66164388d38 | 23820:10bdaf505b64 |
---|---|
40 | 40 |
41 public static WhiteBox wb = WhiteBox.getWhiteBox(); | 41 public static WhiteBox wb = WhiteBox.getWhiteBox(); |
42 | 42 |
43 public static void main(String args[]) throws Exception { | 43 public static void main(String args[]) throws Exception { |
44 OutputAnalyzer output; | 44 OutputAnalyzer output; |
45 long commitSize = 4 * 1024; // 4KB | 45 long commitSize = 128 * 1024; // 128KB |
46 long reserveSize = 1024 * 1024; // 1024KB | 46 long reserveSize = 4 * 1024 * 1024; // 4096KB |
47 long addr; | 47 long addr; |
48 | 48 |
49 String pid = Integer.toString(ProcessTools.getProcessId()); | 49 String pid = Integer.toString(ProcessTools.getProcessId()); |
50 ProcessBuilder pb = new ProcessBuilder(); | 50 ProcessBuilder pb = new ProcessBuilder(); |
51 | 51 |
60 addr = wb.NMTReserveMemory(reserveSize); | 60 addr = wb.NMTReserveMemory(reserveSize); |
61 pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, | 61 pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, |
62 "VM.native_memory", "detail" }); | 62 "VM.native_memory", "detail" }); |
63 | 63 |
64 output = new OutputAnalyzer(pb.start()); | 64 output = new OutputAnalyzer(pb.start()); |
65 output.shouldContain("Test (reserved=1024KB, committed=0KB)"); | 65 output.shouldContain("Test (reserved=4096KB, committed=0KB)"); |
66 if (has_nmt_detail) { | 66 if (has_nmt_detail) { |
67 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" | 67 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" |
68 + Long.toHexString(addr + reserveSize) | 68 + Long.toHexString(addr + reserveSize) |
69 + "\\] reserved 1024KB for Test"); | 69 + "\\] reserved 4096KB for Test"); |
70 } | 70 } |
71 | 71 |
72 long addrA = addr; | 72 long addrA = addr; |
73 long addrB = addr + commitSize; | 73 long addrB = addr + commitSize; |
74 long addrC = addr + (2 * commitSize); | 74 long addrC = addr + (2 * commitSize); |
81 wb.NMTCommitMemory(addrB, commitSize); | 81 wb.NMTCommitMemory(addrB, commitSize); |
82 wb.NMTCommitMemory(addrC, commitSize); | 82 wb.NMTCommitMemory(addrC, commitSize); |
83 wb.NMTCommitMemory(addrD, commitSize); | 83 wb.NMTCommitMemory(addrD, commitSize); |
84 | 84 |
85 output = new OutputAnalyzer(pb.start()); | 85 output = new OutputAnalyzer(pb.start()); |
86 output.shouldContain("Test (reserved=1024KB, committed=16KB)"); | 86 output.shouldContain("Test (reserved=4096KB, committed=512KB)"); |
87 | 87 |
88 if (has_nmt_detail) { | 88 if (has_nmt_detail) { |
89 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" | 89 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" |
90 + Long.toHexString(addr + reserveSize) | 90 + Long.toHexString(addr + reserveSize) |
91 + "\\] reserved 1024KB for Test"); | 91 + "\\] reserved 4096KB for Test"); |
92 } | 92 } |
93 // uncommit BC | 93 // uncommit BC |
94 wb.NMTUncommitMemory(addrB, commitSize); | 94 wb.NMTUncommitMemory(addrB, commitSize); |
95 wb.NMTUncommitMemory(addrC, commitSize); | 95 wb.NMTUncommitMemory(addrC, commitSize); |
96 | 96 |
97 output = new OutputAnalyzer(pb.start()); | 97 output = new OutputAnalyzer(pb.start()); |
98 output.shouldContain("Test (reserved=1024KB, committed=8KB)"); | 98 output.shouldContain("Test (reserved=4096KB, committed=256KB)"); |
99 | 99 |
100 if (has_nmt_detail) { | 100 if (has_nmt_detail) { |
101 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" | 101 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" |
102 + Long.toHexString(addr + reserveSize) | 102 + Long.toHexString(addr + reserveSize) |
103 + "\\] reserved 1024KB for Test"); | 103 + "\\] reserved 4096KB for Test"); |
104 } | 104 } |
105 | 105 |
106 // commit EF | 106 // commit EF |
107 wb.NMTCommitMemory(addrE, commitSize); | 107 wb.NMTCommitMemory(addrE, commitSize); |
108 wb.NMTCommitMemory(addrF, commitSize); | 108 wb.NMTCommitMemory(addrF, commitSize); |
109 | 109 |
110 output = new OutputAnalyzer(pb.start()); | 110 output = new OutputAnalyzer(pb.start()); |
111 output.shouldContain("Test (reserved=1024KB, committed=16KB)"); | 111 output.shouldContain("Test (reserved=4096KB, committed=512KB)"); |
112 if (has_nmt_detail) { | 112 if (has_nmt_detail) { |
113 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" | 113 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" |
114 + Long.toHexString(addr + reserveSize) | 114 + Long.toHexString(addr + reserveSize) |
115 + "\\] reserved 1024KB for Test"); | 115 + "\\] reserved 4096KB for Test"); |
116 } | 116 } |
117 | 117 |
118 // uncommit A | 118 // uncommit A |
119 wb.NMTUncommitMemory(addrA, commitSize); | 119 wb.NMTUncommitMemory(addrA, commitSize); |
120 | 120 |
121 output = new OutputAnalyzer(pb.start()); | 121 output = new OutputAnalyzer(pb.start()); |
122 output.shouldContain("Test (reserved=1024KB, committed=12KB)"); | 122 output.shouldContain("Test (reserved=4096KB, committed=384KB)"); |
123 if (has_nmt_detail) { | 123 if (has_nmt_detail) { |
124 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" | 124 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" |
125 + Long.toHexString(addr + reserveSize) | 125 + Long.toHexString(addr + reserveSize) |
126 + "\\] reserved 1024KB for Test"); | 126 + "\\] reserved 4096KB for Test"); |
127 } | 127 } |
128 | 128 |
129 // commit ABC | 129 // commit ABC |
130 wb.NMTCommitMemory(addrA, commitSize); | 130 wb.NMTCommitMemory(addrA, commitSize); |
131 wb.NMTCommitMemory(addrB, commitSize); | 131 wb.NMTCommitMemory(addrB, commitSize); |
132 wb.NMTCommitMemory(addrC, commitSize); | 132 wb.NMTCommitMemory(addrC, commitSize); |
133 | 133 |
134 output = new OutputAnalyzer(pb.start()); | 134 output = new OutputAnalyzer(pb.start()); |
135 output.shouldContain("Test (reserved=1024KB, committed=24KB)"); | 135 output.shouldContain("Test (reserved=4096KB, committed=768KB)"); |
136 if (has_nmt_detail) { | 136 if (has_nmt_detail) { |
137 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" | 137 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" |
138 + Long.toHexString(addr + reserveSize) | 138 + Long.toHexString(addr + reserveSize) |
139 + "\\] reserved 1024KB for Test"); | 139 + "\\] reserved 4096KB for Test"); |
140 } | 140 } |
141 | 141 |
142 // uncommit ABCDEF | 142 // uncommit ABCDEF |
143 wb.NMTUncommitMemory(addrA, commitSize); | 143 wb.NMTUncommitMemory(addrA, commitSize); |
144 wb.NMTUncommitMemory(addrB, commitSize); | 144 wb.NMTUncommitMemory(addrB, commitSize); |
146 wb.NMTUncommitMemory(addrD, commitSize); | 146 wb.NMTUncommitMemory(addrD, commitSize); |
147 wb.NMTUncommitMemory(addrE, commitSize); | 147 wb.NMTUncommitMemory(addrE, commitSize); |
148 wb.NMTUncommitMemory(addrF, commitSize); | 148 wb.NMTUncommitMemory(addrF, commitSize); |
149 | 149 |
150 output = new OutputAnalyzer(pb.start()); | 150 output = new OutputAnalyzer(pb.start()); |
151 output.shouldContain("Test (reserved=1024KB, committed=0KB)"); | 151 output.shouldContain("Test (reserved=4096KB, committed=0KB)"); |
152 if (has_nmt_detail) { | 152 if (has_nmt_detail) { |
153 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" | 153 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" |
154 + Long.toHexString(addr + reserveSize) | 154 + Long.toHexString(addr + reserveSize) |
155 + "\\] reserved 1024KB for Test"); | 155 + "\\] reserved 4096KB for Test"); |
156 } | 156 } |
157 | 157 |
158 // release | 158 // release |
159 wb.NMTReleaseMemory(addr, reserveSize); | 159 wb.NMTReleaseMemory(addr, reserveSize); |
160 output = new OutputAnalyzer(pb.start()); | 160 output = new OutputAnalyzer(pb.start()); |
161 output.shouldNotContain("Test (reserved="); | 161 output.shouldNotContain("Test (reserved="); |
162 output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" | 162 output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" |
163 + Long.toHexString(addr + reserveSize) + "\\] reserved 1024KB for Test"); | 163 + Long.toHexString(addr + reserveSize) + "\\] reserved 4096KB for Test"); |
164 } | 164 } |
165 } | 165 } |