Fix gcc and clang builds.
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_jitcraft_type_manager_h_
20 #define _include_jitcraft_type_manager_h_
24 #include "HashTable.h"
25 #include "AllocatorPolicies.h"
26 #include "VirtualObjectVisitor.h"
39 LookupKey(Handle<Type> type, TypeQualifiers quals)
48 typedef Type * Payload;
50 static uint32 hash(const LookupKey &key) {
51 // We'll need to rehash with moving GC.
52 return HashPointer(key.type);
55 static bool matches(const LookupKey &key, Type *type) {
56 assert(type->hasTypeQualifiers());
57 return key.type == type->unqualified() &&
58 key.quals == type->quals();
62 typedef HashTable<Policy, ZoneAllocatorPolicy> TypeHashTable;
65 TypeManager(Zone *zone);
69 Type *getPrimitive(PrimitiveType type) {
70 return primitiveTypes_[type];
79 Type *getUnchecked() {
80 return uncheckedType_;
82 Type *getImportable() {
83 return importableType_;
85 ReferenceType *getReference(Handle<Type> type, bool isConst);
86 ArrayType *newArray(Handle<Type> contained, int elements);
87 ArrayType *newExternalArray(Handle<Type> contained);
88 EnumType *newEnum(Handle<String> name);
90 void accept(VirtualObjectVisitor *visitor);
93 Type *qualify(Handle<Type> type, TypeQualifiers quals);
98 // Primitive type cache.
99 Unbarriered<Type> voidType_;
100 Unbarriered<Type> stringType_;
101 Unbarriered<Type> uncheckedType_;
102 Unbarriered<Type> importableType_;
103 Unbarriered<Type> primitiveTypes_[PrimitiveTypes_Total];
104 Unbarriered<ReferenceType> referenceTypes_[PrimitiveTypes_Total];
106 TypeHashTable qualTable_;
111 #endif // _include_jitcraft_type_manager_h_