8293691: converting a defined BasicType value to a string should not crash the VM
Reviewed-by: shade, coleenp, dlong
This commit is contained in:
parent
ccc1d31696
commit
f2a32d996a
@ -236,6 +236,17 @@ const char* type2name_tab[T_CONFLICT+1] = {
|
||||
"*narrowklass*",
|
||||
"*conflict*"
|
||||
};
|
||||
const char* type2name(BasicType t) {
|
||||
if (t < ARRAY_SIZE(type2name_tab)) {
|
||||
return type2name_tab[t];
|
||||
} else if (t == T_ILLEGAL) {
|
||||
return "*illegal*";
|
||||
} else {
|
||||
fatal("invalid type %d", t);
|
||||
return "invalid type";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BasicType name2type(const char* name) {
|
||||
|
@ -786,10 +786,7 @@ extern int type2size[T_CONFLICT+1]; // Map BasicType to result stack ele
|
||||
extern const char* type2name_tab[T_CONFLICT+1]; // Map a BasicType to a char*
|
||||
extern BasicType name2type(const char* name);
|
||||
|
||||
inline const char* type2name(BasicType t) {
|
||||
assert((uint)t < T_CONFLICT + 1, "invalid type");
|
||||
return type2name_tab[t];
|
||||
}
|
||||
const char* type2name(BasicType t);
|
||||
|
||||
inline jlong max_signed_integer(BasicType bt) {
|
||||
if (bt == T_INT) {
|
||||
|
Loading…
Reference in New Issue
Block a user