1.1 --- a/jitcraft/Zone.h Thu Jun 28 01:38:56 2012 -0700
1.2 +++ b/jitcraft/Zone.h Fri Jun 29 19:35:17 2012 -0700
1.3 @@ -20,16 +20,27 @@
1.4
1.5 #include "PoolAllocator.h"
1.6 #include "Stack.h"
1.7 +#include "Heap.h"
1.8 +#include "Barriers.h"
1.9
1.10 namespace jc {
1.11
1.12 +class TypeManager;
1.13 +
1.14 class Zone
1.15 {
1.16 PoolAllocator pool_;
1.17 Stack stack_;
1.18 UnsafeStack unsafeStack_;
1.19 + Heap heap_;
1.20 +
1.21 + // Map cache.
1.22 + Unbarriered<Map> maps_[MapKinds_Total];
1.23 +
1.24 + TypeManager *types_;
1.25
1.26 public:
1.27 + Zone();
1.28 bool initialize();
1.29
1.30 PoolAllocator &pool() {
1.31 @@ -41,6 +52,16 @@
1.32 UnsafeStack &unsafeStack() {
1.33 return unsafeStack_;
1.34 }
1.35 + Heap &heap() {
1.36 + return heap_;
1.37 + }
1.38 + Object *allocate(MapKind kind, size_t bytes, Heap::Tenure tenure = Heap::Tenure_Default) {
1.39 + assert(maps_[kind]);
1.40 + return heap_.allocate(maps_[kind], bytes, tenure);
1.41 + }
1.42 + TypeManager *types() const {
1.43 + return types_;
1.44 + }
1.45 };
1.46
1.47 // In a multi-threaded system, this would be a TLS variable.