src/Structures.h
changeset 195 c1ba166f3fc4
parent 164 3bf7c007883d
child 234 26e3035cdffc
     1.1 --- a/src/Structures.h	Mon Sep 17 00:10:01 2012 -0700
     1.2 +++ b/src/Structures.h	Sat Nov 17 18:41:01 2012 -0800
     1.3 @@ -29,6 +29,7 @@
     1.4  class Type;
     1.5  class String;
     1.6  class FixedArray;
     1.7 +class StructType;
     1.8  
     1.9  // When describing composite structures, the GC must be able to trace interior
    1.10  // references to Objects. To make this possible, maps that describe composite
    1.11 @@ -69,8 +70,7 @@
    1.12      unsigned offset_;
    1.13  
    1.14    public:
    1.15 -    static Descriptor *New(Zone *zone, Handle<String> name, Handle<Type> type,
    1.16 -                           unsigned offset);
    1.17 +    static Descriptor *New(Zone *zone, Handle<String> name, Handle<Type> type);
    1.18  
    1.19      String *name() {
    1.20          return name_;
    1.21 @@ -79,8 +79,13 @@
    1.22          return type_;
    1.23      }
    1.24      unsigned offset() {
    1.25 +        assert(offset_ != unsigned(-1));
    1.26          return offset_;
    1.27      }
    1.28 +    void setOffset(unsigned offset) {
    1.29 +        assert(offset_ == unsigned(-1));
    1.30 +        offset_ = offset;
    1.31 +    }
    1.32  
    1.33      // Begin GC descriptor.
    1.34      static inline size_t offsetOfName() {
    1.35 @@ -101,13 +106,13 @@
    1.36  {
    1.37      unsigned structureSize_;
    1.38      unsigned traceOffsetCount_;
    1.39 -    Barriered<Type> type_;
    1.40 +    Barriered<StructType> type_;
    1.41  
    1.42      // List of descriptors which must be allocated upon initialization.
    1.43      Barriered<FixedArray> composed_;
    1.44  
    1.45    public:
    1.46 -    static StructMap *New(Zone *zone, const StructureBufferBuilder &builder, Handle<FixedArray> composed);
    1.47 +    static StructMap *New(Zone *zone, const StructureBufferBuilder &builder, Handle<StructType> type);
    1.48  
    1.49      unsigned structureSize() {
    1.50          return structureSize_;
    1.51 @@ -121,14 +126,14 @@
    1.52      size_t objSize() {
    1.53          return sizeof(StructMap) + sizeof(unsigned) * traceOffsetCount();
    1.54      }
    1.55 -    Type *type() {
    1.56 +    StructType *type() {
    1.57          return type_;
    1.58      }
    1.59      FixedArray *composed() {
    1.60          return composed_;
    1.61      }
    1.62  
    1.63 -    void setType(Type *type) {
    1.64 +    void setType(StructType *type) {
    1.65          assert(!type_);
    1.66          type_ = type;
    1.67      }