3 // { dg-options "-O -g" }
5 typedef unsigned uint32_t __attribute__((mode (__SI__)));
9 struct StripConst { typedef T result; };
10 class TempAllocPolicy {};
15 template <class, class, class>
16 friend class HashTable;
18 void setLive (unsigned hn) { keyHash = hn; }
20 template <class T, class HashPolicy, class>
23 typedef typename HashPolicy::KeyType Key;
24 typedef typename HashPolicy::Lookup Lookup;
25 typedef HashTableEntry <T> Entry;
30 bool empty () { return false; }
31 T front () { return T (); }
33 struct Enum : public Range
38 Enum (Map map) : Range (map.all ()), table (map.impl), removed () {}
39 void rekeyFront (Lookup l, Key)
42 table.putNewInfallible (l, t);
44 void rekeyFront (Key k)
50 unsigned sCollisionBit;
51 unsigned prepareHash (Lookup l)
53 unsigned keyHash (HashPolicy::hash (l));
54 return keyHash & sCollisionBit;
57 Entry *findFreeEntry (unsigned) { return entryp; }
58 void putNewInfallible (Lookup l, T)
60 unsigned keyHash = prepareHash (l);
61 Entry *entry = findFreeEntry (keyHash);
62 entry->setLive (keyHash);
67 struct HashMapEntry { Key key; };
68 template <class Key, class Value, class HashPolicy = DebugOnly, class AllocPolicy = TempAllocPolicy>
71 typedef HashMapEntry <Key> Entry;
72 struct MapHashPolicy : HashPolicy
76 typedef HashTable <Entry, MapHashPolicy, AllocPolicy> Impl;
78 typedef typename Impl::Range Range;
79 Range all () { return Range (); }
80 typedef typename Impl::Enum Enum;
83 struct AllocationSiteKey;
84 typedef HashMap <AllocationSiteKey, DebugOnly, AllocationSiteKey, TempAllocPolicy> AllocationSiteTable;
85 struct TypeCompartment
87 AllocationSiteTable *allocationSiteTable;
88 void sweep (FreeOp *);
90 struct JSScript { unsigned *code; };
91 bool IsScriptMarked (JSScript **);
92 struct AllocationSiteKey
97 typedef AllocationSiteKey Lookup;
98 static unsigned hash (AllocationSiteKey key) { return (long (key.script->code + key.offset)) ^ key.kind; }
101 TypeCompartment::sweep (FreeOp *)
103 for (AllocationSiteTable::Enum e (*allocationSiteTable); !e.empty ();)
105 AllocationSiteKey key = e.front ().key;
106 IsScriptMarked (&key.script);