156 public void checkExecution(OutputAnalyzer out, RunMode runMode) throws Exception {
157 if (runMode == RunMode.PRODUCTION) {
158 int aotCacheShift = -1, currentShift = -1;
159 long aotCacheBase = -1, currentBase = -1;
160 List<String> list = out.asLines();
161 /* We tried to have CompressedOops settings as per the test requirement,
162 * but it ultimately depends on OS and is not guaranteed that we have got the desired settings.
163 * So we parse the log output from the production run to get the real settings.
164 *
165 * Parse the following Xlog:cds output to get the values of CompressedOops::base and CompressedOops::shift
166 * used during the AOTCache assembly and production run:
167 *
168 * [0.022s][info][cds] CDS archive was created with max heap size = 1024M, and the following configuration:
169 * [0.022s][info][cds] narrow_klass_base at mapping start address, narrow_klass_pointer_bits = 32, narrow_klass_shift = 0
170 * [0.022s][info][cds] narrow_oop_mode = 1, narrow_oop_base = 0x0000000000000000, narrow_oop_shift = 3
171 * [0.022s][info][cds] The current max heap size = 31744M, G1HeapRegion::GrainBytes = 16777216
172 * [0.022s][info][cds] narrow_klass_base = 0x000007fc00000000, arrow_klass_pointer_bits = 32, narrow_klass_shift = 0
173 * [0.022s][info][cds] narrow_oop_mode = 3, narrow_oop_base = 0x0000000300000000, narrow_oop_shift = 3
174 * [0.022s][info][cds] heap range = [0x0000000301000000 - 0x0000000ac1000000]
175 */
176 Pattern p = Pattern.compile("narrow_oop_base = 0x(\\d+), narrow_oop_shift = (\\d)");
177 for (int i = 0; i < list.size(); i++) {
178 String line = list.get(i);
179 if (line.indexOf("CDS archive was created with max heap size") != -1) {
180 // Parse AOT Cache CompressedOops settings
181 line = list.get(i+2);
182 Matcher m = p.matcher(line);
183 if (!m.find()) {
184 throw new RuntimeException("Pattern \"" + p + "\" not found in the output");
185 }
186 aotCacheBase = Long.valueOf(m.group(1), 16);
187 aotCacheShift = Integer.valueOf(m.group(2));
188 // Parse current CompressedOops settings
189 line = list.get(i+5);
190 m = p.matcher(line);
191 if (!m.find()) {
192 throw new RuntimeException("Pattern \"" + p + "\" not found in the output");
193 }
194 currentBase = Long.valueOf(m.group(1), 16);
195 currentShift = Integer.valueOf(m.group(2));
196 break;
197 }
198 }
199 if (aotCacheShift == -1 || currentShift == -1 || aotCacheBase == -1 || currentBase == -1) {
200 throw new RuntimeException("Failed to find CompressedOops settings");
201 }
202 if (aotCacheShift != currentShift) {
203 out.shouldContain("AOT Code Cache disabled: it was created with different CompressedOops::shift()");
204 } else if ((aotCacheBase == 0 || currentBase == 0) && (aotCacheBase != currentBase)) {
205 out.shouldContain("AOTStubCaching is disabled: incompatible CompressedOops::base()");
206 } else {
207 out.shouldMatch("Read \\d+ entries table at offset \\d+ from AOT Code Cache");
208 }
209 }
210 }
211 }
212 }
|
156 public void checkExecution(OutputAnalyzer out, RunMode runMode) throws Exception {
157 if (runMode == RunMode.PRODUCTION) {
158 int aotCacheShift = -1, currentShift = -1;
159 long aotCacheBase = -1, currentBase = -1;
160 List<String> list = out.asLines();
161 /* We tried to have CompressedOops settings as per the test requirement,
162 * but it ultimately depends on OS and is not guaranteed that we have got the desired settings.
163 * So we parse the log output from the production run to get the real settings.
164 *
165 * Parse the following Xlog:cds output to get the values of CompressedOops::base and CompressedOops::shift
166 * used during the AOTCache assembly and production run:
167 *
168 * [0.022s][info][cds] CDS archive was created with max heap size = 1024M, and the following configuration:
169 * [0.022s][info][cds] narrow_klass_base at mapping start address, narrow_klass_pointer_bits = 32, narrow_klass_shift = 0
170 * [0.022s][info][cds] narrow_oop_mode = 1, narrow_oop_base = 0x0000000000000000, narrow_oop_shift = 3
171 * [0.022s][info][cds] The current max heap size = 31744M, G1HeapRegion::GrainBytes = 16777216
172 * [0.022s][info][cds] narrow_klass_base = 0x000007fc00000000, arrow_klass_pointer_bits = 32, narrow_klass_shift = 0
173 * [0.022s][info][cds] narrow_oop_mode = 3, narrow_oop_base = 0x0000000300000000, narrow_oop_shift = 3
174 * [0.022s][info][cds] heap range = [0x0000000301000000 - 0x0000000ac1000000]
175 */
176 Pattern p = Pattern.compile("narrow_oop_base = 0x([0-9a-fA-F]+), narrow_oop_shift = (\\d)");
177 for (int i = 0; i < list.size(); i++) {
178 String line = list.get(i);
179 if (line.indexOf("CDS archive was created with max heap size") != -1) {
180 // Parse AOT Cache CompressedOops settings
181 line = list.get(i+2);
182 Matcher m = p.matcher(line);
183 if (!m.find()) {
184 throw new RuntimeException("Pattern \"" + p + "\" not found in the output. Got \"" + line + "\"");
185 }
186 aotCacheBase = Long.valueOf(m.group(1), 16);
187 aotCacheShift = Integer.valueOf(m.group(2));
188 // Parse current CompressedOops settings
189 line = list.get(i+5);
190 m = p.matcher(line);
191 if (!m.find()) {
192 throw new RuntimeException("Pattern \"" + p + "\" not found in the output. Got \"" + line + "\"");
193 }
194 currentBase = Long.valueOf(m.group(1), 16);
195 currentShift = Integer.valueOf(m.group(2));
196 break;
197 }
198 }
199 if (aotCacheShift == -1 || currentShift == -1 || aotCacheBase == -1 || currentBase == -1) {
200 throw new RuntimeException("Failed to find CompressedOops settings");
201 }
202 if (aotCacheShift != currentShift) {
203 out.shouldContain("AOT Code Cache disabled: it was created with different CompressedOops::shift()");
204 } else if ((aotCacheBase == 0 || currentBase == 0) && (aotCacheBase != currentBase)) {
205 out.shouldContain("AOTStubCaching is disabled: incompatible CompressedOops::base()");
206 } else {
207 out.shouldMatch("Read \\d+ entries table at offset \\d+ from AOT Code Cache");
208 }
209 }
210 }
211 }
212 }
|