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*",
|
"*narrowklass*",
|
||||||
"*conflict*"
|
"*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) {
|
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 const char* type2name_tab[T_CONFLICT+1]; // Map a BasicType to a char*
|
||||||
extern BasicType name2type(const char* name);
|
extern BasicType name2type(const char* name);
|
||||||
|
|
||||||
inline const char* type2name(BasicType t) {
|
const char* type2name(BasicType t);
|
||||||
assert((uint)t < T_CONFLICT + 1, "invalid type");
|
|
||||||
return type2name_tab[t];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline jlong max_signed_integer(BasicType bt) {
|
inline jlong max_signed_integer(BasicType bt) {
|
||||||
if (bt == T_INT) {
|
if (bt == T_INT) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user