Removed HeapChunk::cursor_, converted LifoSpace to HeapChunk.
1 /* vim: set ts=4 sw=4 tw=99 et:
3 * Copyright (C) 2012 David Anderson
5 * This file is part of JITCraft.
7 * JITCraft is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 3 of the License, or (at your option)
12 * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with
17 * JITCraft. If not, see http://www.gnu.org/licenses/.
20 #include "TypeManager.h"
24 Zone jc::SingleThreadedZone;
36 if (!stack_.initialize())
38 if (!heap_.initialize())
41 maps_[MapKind_Meta] = heap_.metaMap();
42 if ((maps_[MapKind_Type] = allocateMap(MapKind_Type, sizeof(Map))) == NULL)
44 if ((maps_[MapKind_FixedArray] = allocateMap(MapKind_FixedArray, sizeof(Map))) == NULL)
46 if ((maps_[MapKind_ByteArray] = allocateMap(MapKind_ByteArray, sizeof(Map))) == NULL)
48 if ((maps_[MapKind_Code] = allocateMap(MapKind_Code, sizeof(Map))) == NULL)
50 if ((maps_[MapKind_Reference] = allocateMap(MapKind_Reference, sizeof(Map))) == NULL)
52 if ((maps_[MapKind_MetaArray] = allocateMap(MapKind_MetaArray, sizeof(Map))) == NULL)
54 if ((maps_[MapKind_Module] = allocateMap(MapKind_Module, sizeof(Map))) == NULL)
56 if ((maps_[MapKind_Function] = allocateMap(MapKind_Function, sizeof(Map))) == NULL)
59 types_ = new TypeManager(this);
60 if (!types_ || !types_->initialize())
67 Zone::allocateMap(MapKind kind, size_t bytes, MapKind parent)
69 assert(maps_[parent]);
70 Map *map = heap_.allocateMap(kind, bytes);
73 map->init(maps_[parent]);
78 Zone::accept(VirtualObjectVisitor *visitor)
80 for (unsigned i = 0; i < MapKinds_Total; i++)
81 visitor->visit(maps_[i].address());
82 types()->accept(visitor);
84 Local<Object> *local = lastLocalRoot_;
86 visitor->visit(local->address());
87 local = local->prev();
90 rootScopes_.accept(visitor);
92 stack_.accept(visitor);