vm: print type names instead of numbers in fep

db4
Joe Groff 2011-11-06 19:56:47 -08:00
parent e4481b846b
commit f4479ee1e6
2 changed files with 40 additions and 2 deletions

View File

@ -122,8 +122,8 @@ void factor_vm::print_nested_obj(cell obj, fixnum nesting)
std::cout << " ]";
break;
default:
std::cout << "#<type " << tagged<object>(obj).type() << " @ ";
std::cout << std::hex << obj << std::dec << ">";
std::cout << "#<" << type_name(tagged<object>(obj).type()) << " ";
std::cout << (void*)obj << ">";
break;
}
}

View File

@ -56,6 +56,44 @@ static const cell data_alignment = 16;
#define TYPE_COUNT 14
static inline const char *type_name(cell type)
{
switch (type)
{
case FIXNUM_TYPE:
return "fixnum";
case F_TYPE:
return "f";
case ARRAY_TYPE:
return "array";
case FLOAT_TYPE:
return "float";
case QUOTATION_TYPE:
return "quotation";
case BIGNUM_TYPE:
return "bignum";
case ALIEN_TYPE:
return "alien";
case TUPLE_TYPE:
return "tuple";
case WRAPPER_TYPE:
return "wrapper";
case BYTE_ARRAY_TYPE:
return "byte-array";
case CALLSTACK_TYPE:
return "callstack";
case STRING_TYPE:
return "string";
case WORD_TYPE:
return "word";
case DLL_TYPE:
return "dll";
default:
assert(false);
return "";
}
}
enum code_block_type
{
code_block_unoptimized,