diff -r 75e385f68b7e -r 627b6b94e774 jitcraft/Types.cpp --- a/jitcraft/Types.cpp Sat Jun 30 19:38:53 2012 -0700 +++ b/jitcraft/Types.cpp Sat Jun 30 20:20:39 2012 -0700 @@ -21,41 +21,6 @@ using namespace jc; -void -Type::initPrimitive(Name *tag) -{ - WRITE_FIELD(kind, PRIMITIVE); - WRITE_FIELD(tag, VoidPtr(tag)); - WRITE_FIELD_OBJ_NO_BARRIER(contained, NULL); - - if (tag && strcmp(tag, "Float") == 0) - WRITE_FIELD(primitive, PrimitiveType_Float); - else - WRITE_FIELD(primitive, PrimitiveType_Int32); -} - -void -Type::initPrimitive(PrimitiveType type) -{ - WRITE_FIELD(kind, PRIMITIVE); - WRITE_FIELD(tag, NULL); - WRITE_FIELD_OBJ_NO_BARRIER(contained, NULL); - WRITE_FIELD(primitive, type); -} - -void -Type::initInlineArray(Type *contained, int elements) -{ - WRITE_FIELD(kind, UNSAFE_ARRAY); - WRITE_FIELD(tag, NULL); - WRITE_FIELD_OBJ_NO_BARRIER(contained, contained); - WRITE_FIELD(elements, elements); - if (contained->isPrimitive()) - WRITE_FIELD(levels, 1); - else - WRITE_FIELD(levels, contained->levels() + 1); -} - Type * Type::NewPrimitive(Zone *zone, Name *tag) { @@ -64,7 +29,14 @@ return NULL; Type *type = Type::cast(obj); - type->initPrimitive(tag); + type->kind_ = PRIMITIVE; + type->tag_ = tag; + type->contained_ = NULL; + + if (tag && strcmp(tag, "Float") == 0) + type->primitive_ = PrimitiveType_Float; + else + type->primitive_ = PrimitiveType_Int32; return type; } @@ -76,7 +48,10 @@ return NULL; Type *type = Type::cast(obj); - type->initPrimitive(prim); + type->kind_ = PRIMITIVE; + type->tag_ = NULL; + type->contained_ = NULL; + type->primitive_ = prim; return type; } @@ -88,6 +63,13 @@ return NULL; Type *type = Type::cast(obj); - type->initInlineArray(contained, elements); + type->kind_ = UNSAFE_ARRAY; + type->tag_ = NULL; + type->contained_ = contained; + type->elements_ = elements; + if (contained->isPrimitive()) + type->levels_ = 1; + else + type->levels_ = contained->levels() + 1; return type; }