1.1 --- a/jitcraft/Types.cpp Sat Jun 30 19:38:53 2012 -0700
1.2 +++ b/jitcraft/Types.cpp Sat Jun 30 20:20:39 2012 -0700
1.3 @@ -21,41 +21,6 @@
1.4
1.5 using namespace jc;
1.6
1.7 -void
1.8 -Type::initPrimitive(Name *tag)
1.9 -{
1.10 - WRITE_FIELD(kind, PRIMITIVE);
1.11 - WRITE_FIELD(tag, VoidPtr(tag));
1.12 - WRITE_FIELD_OBJ_NO_BARRIER(contained, NULL);
1.13 -
1.14 - if (tag && strcmp(tag, "Float") == 0)
1.15 - WRITE_FIELD(primitive, PrimitiveType_Float);
1.16 - else
1.17 - WRITE_FIELD(primitive, PrimitiveType_Int32);
1.18 -}
1.19 -
1.20 -void
1.21 -Type::initPrimitive(PrimitiveType type)
1.22 -{
1.23 - WRITE_FIELD(kind, PRIMITIVE);
1.24 - WRITE_FIELD(tag, NULL);
1.25 - WRITE_FIELD_OBJ_NO_BARRIER(contained, NULL);
1.26 - WRITE_FIELD(primitive, type);
1.27 -}
1.28 -
1.29 -void
1.30 -Type::initInlineArray(Type *contained, int elements)
1.31 -{
1.32 - WRITE_FIELD(kind, UNSAFE_ARRAY);
1.33 - WRITE_FIELD(tag, NULL);
1.34 - WRITE_FIELD_OBJ_NO_BARRIER(contained, contained);
1.35 - WRITE_FIELD(elements, elements);
1.36 - if (contained->isPrimitive())
1.37 - WRITE_FIELD(levels, 1);
1.38 - else
1.39 - WRITE_FIELD(levels, contained->levels() + 1);
1.40 -}
1.41 -
1.42 Type *
1.43 Type::NewPrimitive(Zone *zone, Name *tag)
1.44 {
1.45 @@ -64,7 +29,14 @@
1.46 return NULL;
1.47
1.48 Type *type = Type::cast(obj);
1.49 - type->initPrimitive(tag);
1.50 + type->kind_ = PRIMITIVE;
1.51 + type->tag_ = tag;
1.52 + type->contained_ = NULL;
1.53 +
1.54 + if (tag && strcmp(tag, "Float") == 0)
1.55 + type->primitive_ = PrimitiveType_Float;
1.56 + else
1.57 + type->primitive_ = PrimitiveType_Int32;
1.58 return type;
1.59 }
1.60
1.61 @@ -76,7 +48,10 @@
1.62 return NULL;
1.63
1.64 Type *type = Type::cast(obj);
1.65 - type->initPrimitive(prim);
1.66 + type->kind_ = PRIMITIVE;
1.67 + type->tag_ = NULL;
1.68 + type->contained_ = NULL;
1.69 + type->primitive_ = prim;
1.70 return type;
1.71 }
1.72
1.73 @@ -88,6 +63,13 @@
1.74 return NULL;
1.75
1.76 Type *type = Type::cast(obj);
1.77 - type->initInlineArray(contained, elements);
1.78 + type->kind_ = UNSAFE_ARRAY;
1.79 + type->tag_ = NULL;
1.80 + type->contained_ = contained;
1.81 + type->elements_ = elements;
1.82 + if (contained->isPrimitive())
1.83 + type->levels_ = 1;
1.84 + else
1.85 + type->levels_ = contained->levels() + 1;
1.86 return type;
1.87 }