Fixed type checking for multidimensional arrays.
1 /* vim: set ts=4 sw=4 tw=99 et:
3 * Copyright (C) 2012 David Anderson
5 * This file is part of SourcePawn.
7 * SourcePawn 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 * SourcePawn 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 * SourcePawn. If not, see http://www.gnu.org/licenses/.
19 #ifndef _include_jc_root_scopes_h_
20 #define _include_jc_root_scopes_h_
22 #include "../include/keima.h"
24 #include "VirtualObjectVisitor.h"
30 // A RootScopeManager is essentially a specialized PoolAllocator that can
31 // only allocate Object ** entries. It is used to allow huge, temporary
32 // heap data structures like ASTs to hold safe references to objects. When
33 // the data structures is no longer needed, all of the roots are removed
35 class RootScopeManager
37 static const size_t kObjectsPerBlock = 4096;
40 Object *objects[kObjectsPerBlock];
47 end(objects + kObjectsPerBlock),
55 void unwindSlow(Object **position);
61 Object **position() const {
65 void unwind(Object **position) {
66 if (position >= blocks_->cur && position <= blocks_->end) {
67 blocks_->cur = position;
73 Object **make(Object *obj) {
75 if (blocks_->cur + 1 > blocks_->end) {
79 Object **ptr = blocks_->cur;
85 Ke::HandleScope **scope() {
89 void accept(VirtualObjectVisitor *visitor);
94 Ke::HandleScope *scope_;
97 class RootScope : public Ke::HandleScope
100 // These are implemented in Zone.h.
101 inline RootScope(Zone *zone);
106 #endif // _include_jc_root_scope_h_