59 } 60 61 static void test(String... extra_options) throws Exception { 62 OutputAnalyzer output = CDSTestUtils.createArchive(extra_options); 63 CDSTestUtils.checkDump(output); 64 Pattern pattern = Pattern.compile("^(..) *space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)"); 65 WhiteBox wb = WhiteBox.getWhiteBox(); 66 long reserve_alignment = wb.metaspaceReserveAlignment(); 67 System.out.println("Metaspace::reserve_alignment() = " + reserve_alignment); 68 69 long last_region = -1; 70 Hashtable<String,String> checked = new Hashtable<>(); 71 for (String line : output.getStdout().split("\n")) { 72 if (line.contains(" space:") && !line.contains("st space:")) { 73 Matcher matcher = pattern.matcher(line); 74 if (matcher.find()) { 75 String name = matcher.group(1); 76 if (name.equals("s0") || name.equals("s1")) { 77 // String regions are listed at the end and they may not be fully occupied. 78 break; 79 } else { 80 System.out.println("Checking " + name + " in : " + line); 81 checked.put(name, name); 82 } 83 long used = Long.parseLong(matcher.group(2)); 84 long capacity = Long.parseLong(matcher.group(3)); 85 long address = Long.parseLong(matcher.group(4), 16); 86 long unused = capacity - used; 87 if (unused < 0) { 88 throw new RuntimeException("Unused space (" + unused + ") less than 0"); 89 } 90 if (unused > reserve_alignment) { 91 // [1] Check for unused space 92 throw new RuntimeException("Unused space (" + unused + ") must be smaller than Metaspace::reserve_alignment() (" + 93 reserve_alignment + ")"); 94 } 95 if (last_region >= 0 && address != last_region) { 96 // [2] Check for no-gap 97 throw new RuntimeException("Region 0x" + address + " should have started at 0x" + Long.toString(last_region, 16)); 98 } | 59 } 60 61 static void test(String... extra_options) throws Exception { 62 OutputAnalyzer output = CDSTestUtils.createArchive(extra_options); 63 CDSTestUtils.checkDump(output); 64 Pattern pattern = Pattern.compile("^(..) *space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)"); 65 WhiteBox wb = WhiteBox.getWhiteBox(); 66 long reserve_alignment = wb.metaspaceReserveAlignment(); 67 System.out.println("Metaspace::reserve_alignment() = " + reserve_alignment); 68 69 long last_region = -1; 70 Hashtable<String,String> checked = new Hashtable<>(); 71 for (String line : output.getStdout().split("\n")) { 72 if (line.contains(" space:") && !line.contains("st space:")) { 73 Matcher matcher = pattern.matcher(line); 74 if (matcher.find()) { 75 String name = matcher.group(1); 76 if (name.equals("s0") || name.equals("s1")) { 77 // String regions are listed at the end and they may not be fully occupied. 78 break; 79 } else if (name.equals("bm")) { 80 // Bitmap space does not have a requested address. 81 break; 82 } else { 83 System.out.println("Checking " + name + " in : " + line); 84 checked.put(name, name); 85 } 86 long used = Long.parseLong(matcher.group(2)); 87 long capacity = Long.parseLong(matcher.group(3)); 88 long address = Long.parseLong(matcher.group(4), 16); 89 long unused = capacity - used; 90 if (unused < 0) { 91 throw new RuntimeException("Unused space (" + unused + ") less than 0"); 92 } 93 if (unused > reserve_alignment) { 94 // [1] Check for unused space 95 throw new RuntimeException("Unused space (" + unused + ") must be smaller than Metaspace::reserve_alignment() (" + 96 reserve_alignment + ")"); 97 } 98 if (last_region >= 0 && address != last_region) { 99 // [2] Check for no-gap 100 throw new RuntimeException("Region 0x" + address + " should have started at 0x" + Long.toString(last_region, 16)); 101 } |