83 uint insert_limit() const { return _max - (_max>>2); }
84
85 void clear(); // Set all entries to NULL, keep storage.
86 // Size of hash table
87 uint size() const { return _max; }
88 // Return Node* at index in table
89 Node *at(uint table_index) {
90 assert(table_index < _max, "Must be within table");
91 return _table[table_index];
92 }
93
94 void remove_useless_nodes(VectorSet &useful); // replace with sentinel
95 void replace_with(NodeHash* nh);
96 void check_no_speculative_types(); // Check no speculative part for type nodes in table
97
98 Node *sentinel() { return _sentinel; }
99
100 #ifndef PRODUCT
101 Node *find_index(uint idx); // For debugging
102 void dump(); // For debugging, dump statistics
103 #endif
104 uint _grows; // For debugging, count of table grow()s
105 uint _look_probes; // For debugging, count of hash probes
106 uint _lookup_hits; // For debugging, count of hash_finds
107 uint _lookup_misses; // For debugging, count of hash_finds
108 uint _insert_probes; // For debugging, count of hash probes
109 uint _delete_probes; // For debugging, count of hash probes for deletes
110 uint _delete_hits; // For debugging, count of hash probes for deletes
111 uint _delete_misses; // For debugging, count of hash probes for deletes
112 uint _total_inserts; // For debugging, total inserts into hash table
113 uint _total_insert_probes; // For debugging, total probes while inserting
114 };
115
116
117 //-----------------------------------------------------------------------------
118 // Map dense integer indices to Types. Uses classic doubling-array trick.
119 // Abstractly provides an infinite array of Type*'s, initialized to NULL.
120 // Note that the constructor just zeros things, and since I use Arena
121 // allocation I do not need a destructor to reclaim storage.
122 // Despite the general name, this class is customized for use by PhaseTransform.
123 class Type_Array : public StackObj {
124 Arena *_a; // Arena to allocate in
125 uint _max;
126 const Type **_types;
127 void grow( uint i ); // Grow array node to fit
128 const Type *operator[] ( uint i ) const // Lookup, or NULL for not mapped
129 { return (i<_max) ? _types[i] : (Type*)NULL; }
130 friend class PhaseTransform;
131 public:
132 Type_Array(Arena *a) : _a(a), _max(0), _types(0) {}
133 Type_Array(Type_Array *ta) : _a(ta->_a), _max(ta->_max), _types(ta->_types) { }
|
83 uint insert_limit() const { return _max - (_max>>2); }
84
85 void clear(); // Set all entries to NULL, keep storage.
86 // Size of hash table
87 uint size() const { return _max; }
88 // Return Node* at index in table
89 Node *at(uint table_index) {
90 assert(table_index < _max, "Must be within table");
91 return _table[table_index];
92 }
93
94 void remove_useless_nodes(VectorSet &useful); // replace with sentinel
95 void replace_with(NodeHash* nh);
96 void check_no_speculative_types(); // Check no speculative part for type nodes in table
97
98 Node *sentinel() { return _sentinel; }
99
100 #ifndef PRODUCT
101 Node *find_index(uint idx); // For debugging
102 void dump(); // For debugging, dump statistics
103 uint _grows; // For debugging, count of table grow()s
104 uint _look_probes; // For debugging, count of hash probes
105 uint _lookup_hits; // For debugging, count of hash_finds
106 uint _lookup_misses; // For debugging, count of hash_finds
107 uint _insert_probes; // For debugging, count of hash probes
108 uint _delete_probes; // For debugging, count of hash probes for deletes
109 uint _delete_hits; // For debugging, count of hash probes for deletes
110 uint _delete_misses; // For debugging, count of hash probes for deletes
111 uint _total_inserts; // For debugging, total inserts into hash table
112 uint _total_insert_probes; // For debugging, total probes while inserting
113 #endif
114 };
115
116
117 //-----------------------------------------------------------------------------
118 // Map dense integer indices to Types. Uses classic doubling-array trick.
119 // Abstractly provides an infinite array of Type*'s, initialized to NULL.
120 // Note that the constructor just zeros things, and since I use Arena
121 // allocation I do not need a destructor to reclaim storage.
122 // Despite the general name, this class is customized for use by PhaseTransform.
123 class Type_Array : public StackObj {
124 Arena *_a; // Arena to allocate in
125 uint _max;
126 const Type **_types;
127 void grow( uint i ); // Grow array node to fit
128 const Type *operator[] ( uint i ) const // Lookup, or NULL for not mapped
129 { return (i<_max) ? _types[i] : (Type*)NULL; }
130 friend class PhaseTransform;
131 public:
132 Type_Array(Arena *a) : _a(a), _max(0), _types(0) {}
133 Type_Array(Type_Array *ta) : _a(ta->_a), _max(ta->_max), _types(ta->_types) { }
|