< prev index next >

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

Print this page

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

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