< prev index next >

test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java

Print this page

 81             throw new RuntimeException("Test ERROR " + ex, ex);
 82         } finally {
 83             LingeredApp.stopApp(theApp);
 84         }
 85         System.out.println("Test PASSED");
 86     }
 87 
 88     private static void checkForTruncation(String longConstantOutput) throws Exception {
 89 
 90         // Expected values obtained from the hash_mask_in_place definition in markWord.hpp
 91 
 92         // Expected output snippet is of the form (on x64-64):
 93         // ...
 94         // longConstant VM_Version::CPU_SHA 17179869184
 95         // longConstant markWord::age_shift 3
 96         // longConstant markWord::hash_mask_in_place 549755813632
 97         // ...
 98 
 99         checkLongValue("markWord::hash_mask_in_place",
100                        longConstantOutput,
101                        Platform.is64bit() ? 549755813632L: 4294967168L);
102 
103         String arch = System.getProperty("os.arch");
104         if (arch.equals("amd64") || arch.equals("i386") || arch.equals("x86")) {
105             // Expected value obtained from the CPU_SHA definition in vm_version_x86.hpp
106             checkLongValue("VM_Version::CPU_SHA",
107                            longConstantOutput,
108                            17179869184L);
109         }
110     }
111 
112     private static void checkLongValue(String constName, String longConstantOutput,
113                                        long checkValue) throws Exception {
114 
115         String[] snippets = longConstantOutput.split(constName);
116         String[] words = snippets[1].split("\\R");
117         long readValue = Long.parseLong(words[0].trim());
118         if (readValue != checkValue) {
119             throw new Exception ("Reading " + constName + ". Expected " + checkValue +
120                                  ". Obtained " + readValue + " instead.");
121         }

 81             throw new RuntimeException("Test ERROR " + ex, ex);
 82         } finally {
 83             LingeredApp.stopApp(theApp);
 84         }
 85         System.out.println("Test PASSED");
 86     }
 87 
 88     private static void checkForTruncation(String longConstantOutput) throws Exception {
 89 
 90         // Expected values obtained from the hash_mask_in_place definition in markWord.hpp
 91 
 92         // Expected output snippet is of the form (on x64-64):
 93         // ...
 94         // longConstant VM_Version::CPU_SHA 17179869184
 95         // longConstant markWord::age_shift 3
 96         // longConstant markWord::hash_mask_in_place 549755813632
 97         // ...
 98 
 99         checkLongValue("markWord::hash_mask_in_place",
100                        longConstantOutput,
101                        4294967168L);
102 
103         String arch = System.getProperty("os.arch");
104         if (arch.equals("amd64") || arch.equals("i386") || arch.equals("x86")) {
105             // Expected value obtained from the CPU_SHA definition in vm_version_x86.hpp
106             checkLongValue("VM_Version::CPU_SHA",
107                            longConstantOutput,
108                            17179869184L);
109         }
110     }
111 
112     private static void checkLongValue(String constName, String longConstantOutput,
113                                        long checkValue) throws Exception {
114 
115         String[] snippets = longConstantOutput.split(constName);
116         String[] words = snippets[1].split("\\R");
117         long readValue = Long.parseLong(words[0].trim());
118         if (readValue != checkValue) {
119             throw new Exception ("Reading " + constName + ". Expected " + checkValue +
120                                  ". Obtained " + readValue + " instead.");
121         }
< prev index next >