--- old/src/hotspot/share/utilities/globalDefinitions.cpp 2020-01-24 19:19:22.876521319 +0000 +++ new/src/hotspot/share/utilities/globalDefinitions.cpp 2020-01-24 19:19:22.069724350 +0000 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "runtime/globals.hpp" #include "runtime/os.hpp" +#include "runtime/signature.hpp" #include "utilities/globalDefinitions.hpp" // Basic error support @@ -51,6 +52,20 @@ // 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 @@ -84,10 +99,13 @@ 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++; } }