Remove calls to ZONE().
2 * Copyright (C) 2012 David Anderson
4 * This file is part of JITCraft.
6 * JITCraft is free software: you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option)
11 * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * JITCraft. If not, see http://www.gnu.org/licenses/.
18 #ifndef _include_jitcraft_fixedarray_h_
19 #define _include_jitcraft_fixedarray_h_
25 // A fixed-length array that contains Object * slots.
26 class FixedArray : public Object
32 return reinterpret_cast<Object **>(this + 1);
36 static FixedArray *New(Zone *zone, unsigned length, Heap::Tenure tenure);
41 Object *at(size_t i) {
45 void set(Zone *zone, size_t i, Object *obj) {
47 write(zone, &vec()[i], obj);
50 static size_t SizeFor(unsigned length) {
51 return sizeof(FixedArray) + sizeof(Object *) * length;
54 static inline FixedArray *cast(Object *obj) {
55 assert(obj->is(MapKind_FixedArray));
56 return reinterpret_cast<FixedArray *>(obj);
60 // A fixed-length array containing raw bytes.
61 class ByteArray : public Object
67 return reinterpret_cast<Object **>(this + 1);
71 static ByteArray *New(Zone *zone, unsigned length, Heap::Tenure tenure = Heap::Tenure_Default);
77 return reinterpret_cast<uint8 *>(this + 1);
80 static size_t SizeFor(unsigned length) {
81 return sizeof(FixedArray) + sizeof(uint8) * length;
84 static inline ByteArray *cast(Object *obj) {
85 assert(obj->is(MapKind_ByteArray));
86 return reinterpret_cast<ByteArray *>(obj);
92 #endif // _include_jitcraft_fixedarray_h_