< prev index next >

src/hotspot/share/utilities/globalDefinitions.cpp

Print this page

        

@@ -23,10 +23,11 @@
  */
 
 #include "precompiled.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/os.hpp"
+#include "runtime/signature.hpp"
 #include "utilities/globalDefinitions.hpp"
 
 // Basic error support
 
 // Info for oops within a java object.  Defaults are zero so

@@ -49,10 +50,24 @@
 // Oop encoding heap max
 uint64_t OopEncodingHeapMax = 0;
 
 // Something to help porters sleep at night
 
+#ifdef ASSERT
+BasicType char2type(int ch) {
+  switch (ch) {
+#define EACH_SIG(ch, bt, ignore) \
+    case ch: return bt;
+    SIGNATURE_TYPES_DO(EACH_SIG, ignore)
+#undef EACH_SIG
+  }
+  return T_ILLEGAL;
+}
+
+extern bool signature_constants_sane();
+#endif //ASSERT
+
 void basic_types_init() {
 #ifdef ASSERT
 #ifdef _LP64
   assert(min_intx ==  (intx)CONST64(0x8000000000000000), "correct constant");
   assert(max_intx ==  CONST64(0x7FFFFFFFFFFFFFFF), "correct constant");

@@ -82,14 +97,17 @@
   assert( 2 == sizeof( u2),        "wrong size for basic type");
   assert( 4 == sizeof( u4),        "wrong size for basic type");
   assert(wordSize == BytesPerWord, "should be the same since they're used interchangeably");
   assert(wordSize == HeapWordSize, "should be the same since they're also used interchangeably");
 
+  assert(signature_constants_sane(), "");
+
   int num_type_chars = 0;
   for (int i = 0; i < 99; i++) {
     if (type2char((BasicType)i) != 0) {
       assert(char2type(type2char((BasicType)i)) == i, "proper inverses");
+      assert(Signature::basic_type(type2char((BasicType)i)) == i, "proper inverses");
       num_type_chars++;
     }
   }
   assert(num_type_chars == 11, "must have tested the right number of mappings");
   assert(char2type(0) == T_ILLEGAL, "correct illegality");
< prev index next >