Normalise line endings.
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_;
88 ReferenceType *getReference(Handle<Type> type, bool isConst);
89 ArrayType *newArray(Handle<Type> contained, int elements);
90 ArrayType *newExternalArray(Handle<Type> contained);
91 EnumType *newEnum(Handle<String> name);
93 void accept(VirtualObjectVisitor *visitor);
96 Type *qualify(Handle<Type> type, TypeQualifiers quals);
101 // Primitive type cache.
102 Unbarriered<Type> voidType_;
103 Unbarriered<Type> stringType_;
104 Unbarriered<Type> uncheckedType_;
105 Unbarriered<Type> importableType_;
106 Unbarriered<Type> typeType_;
107 Unbarriered<Type> primitiveTypes_[PrimitiveTypes_Total];
108 Unbarriered<ReferenceType> referenceTypes_[PrimitiveTypes_Total];
110 TypeHashTable qualTable_;
115 #endif // _include_jitcraft_type_manager_h_