jitcraft/Zone.cpp
changeset 61 864e4b02a4c1
parent 60 581a9c793062
child 65 7c942b5adebc
     1.1 --- a/jitcraft/Zone.cpp	Sun Jul 08 01:54:08 2012 -0700
     1.2 +++ b/jitcraft/Zone.cpp	Sun Jul 08 11:33:12 2012 -0700
     1.3 @@ -19,6 +19,7 @@
     1.4  #include "Zone.h"
     1.5  #include "StringPool.h"
     1.6  #include "TypeManager.h"
     1.7 +#include "GlobalRoots.h"
     1.8  #include "AllocatorPolicies.h"
     1.9  
    1.10  using namespace ke;
    1.11 @@ -28,14 +29,17 @@
    1.12  Zone::Zone()
    1.13    : heap_(this),
    1.14      types_(NULL),
    1.15 +    symbols_(NULL),
    1.16 +    globalRoots_(NULL),
    1.17      lastLocalRoot_(NULL)
    1.18  {
    1.19  }
    1.20  
    1.21  Zone::~Zone()
    1.22  {
    1.23 +    delete types_;
    1.24      delete symbols_;
    1.25 -    delete types_;
    1.26 +    delete globalRoots_;
    1.27  }
    1.28  
    1.29  bool
    1.30 @@ -50,6 +54,10 @@
    1.31      if (!symbols_ || !symbols_->initialize())
    1.32          return false;
    1.33  
    1.34 +    globalRoots_ = new GlobalRoots(this);
    1.35 +    if (!globalRoots_ || !globalRoots_->initialize())
    1.36 +        return false;
    1.37 +
    1.38      maps_[MapKind_Meta] = heap_.metaMap();
    1.39      if ((maps_[MapKind_Type] = allocateMap(MapKind_Type, sizeof(Map))) == NULL)
    1.40          return false;
    1.41 @@ -103,6 +111,7 @@
    1.42          local = local->prev();
    1.43      }
    1.44  
    1.45 +    globalRoots_->accept(visitor);
    1.46      rootScopes_.accept(visitor);
    1.47  
    1.48      stack_.accept(visitor);