111
|
1 // PR 39548 verify ssa ICE
|
|
2 //
|
|
3 // { dg-do compile { target { lp64 } } }
|
|
4 // { dg-options "-Wno-error -fno-exceptions -fno-tree-vrp -O2 -fprofile-generate -finline-limit=500 -std=c++98" }
|
131
|
5 // { dg-additional-options "-Wno-return-type" }
|
111
|
6
|
|
7 #include <map>
|
|
8 #include <vector>
|
|
9 #include <iostream>
|
|
10 #include <cstdlib>
|
|
11 using namespace std;
|
|
12 template<typename _FIter, typename _Tp> _FIter lower_bound(_FIter, _FIter, _Tp&);
|
|
13 template<class _Key> struct hash { };
|
|
14 template<class _Val> struct _Hashtable_node {
|
|
15 _Hashtable_node* _M_next;
|
|
16 _Val _M_val;
|
|
17 };
|
|
18 static const unsigned long __stl_prime_list[] = { 2, 3, 5 };
|
|
19 inline unsigned long prime(unsigned long __n) {
|
|
20 const unsigned long* __first = __stl_prime_list;
|
|
21 const unsigned long* __last = __stl_prime_list + 29;
|
|
22 const unsigned long* pos = lower_bound(__first, __last, __n);
|
|
23 return pos == __last ? *(__last - 1) : *pos;
|
|
24 }
|
|
25 template<class _Val, class _Key, class _HashFcn, class _ExtractKey, class _EqualKey, class _Alloc> struct hashtable {
|
|
26 typedef _Key key_type;
|
|
27 typedef _Val value_type;
|
|
28 typedef _HashFcn hasher;
|
|
29 typedef _EqualKey key_equal;
|
|
30 typedef size_t size_type;
|
|
31 typedef value_type& reference;
|
|
32 typedef _Hashtable_node<_Val> _Node;
|
|
33 typedef typename _Alloc::template rebind<value_type>::other allocator_type;
|
|
34 allocator_type get_allocator() const { }
|
|
35 typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;
|
|
36 typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc;
|
|
37 typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type;
|
|
38 _Node_Alloc _M_node_allocator;
|
|
39 void _M_put_node(_Node* __p) {
|
|
40 _M_node_allocator.deallocate(__p, 1);
|
|
41 }
|
|
42 hasher _M_hash;
|
|
43 key_equal _M_equals;
|
|
44 _ExtractKey _M_get_key;
|
|
45 _Vector_type _M_buckets;
|
|
46 size_type _M_num_elements;
|
|
47 hashtable(size_type __n, const _HashFcn& __hf, const _EqualKey& __eql, const allocator_type& __a = allocator_type()) : _M_num_elements(0) {
|
|
48 _M_initialize_buckets(__n);
|
|
49 }
|
|
50 ~hashtable() { clear(); }
|
|
51 reference find_or_insert(const value_type& __obj);
|
|
52 size_type count(const key_type& __key) const {
|
|
53 const size_type __n = _M_bkt_num_key(__key);
|
|
54 size_type __result = 0;
|
|
55 for (const _Node* __cur = _M_buckets[__n]; __cur; __cur = __cur->_M_next)
|
|
56 if (_M_equals(_M_get_key(__cur->_M_val), __key)) ++__result;
|
|
57 }
|
|
58 size_type erase(const key_type& __key);
|
|
59 void clear();
|
|
60 size_type _M_next_size(size_type __n) const { return prime(__n); }
|
|
61 void _M_initialize_buckets(size_type __n) {
|
|
62 const size_type __n_buckets = _M_next_size(__n);
|
|
63 _M_buckets.reserve(__n_buckets);
|
|
64 _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);
|
|
65 }
|
|
66 size_type _M_bkt_num_key(const key_type& __key) const {
|
|
67 return _M_bkt_num_key(__key, _M_buckets.size());
|
|
68 }
|
|
69 size_type _M_bkt_num_key(const key_type& __key, size_t __n) const {
|
|
70 return _M_hash(__key) % __n;
|
|
71 }
|
|
72 void _M_delete_node(_Node* __n) {
|
|
73 this->get_allocator().destroy(&__n->_M_val);
|
|
74 _M_put_node(__n);
|
|
75 }
|
|
76 };
|
|
77 template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: erase(const key_type& __key) {
|
|
78 const size_type __n = _M_bkt_num_key(__key);
|
|
79 _Node* __first = _M_buckets[__n];
|
|
80 if (__first) _Node* __cur = __first;
|
|
81 }
|
|
82 template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: clear() {
|
|
83 for (size_type __i = 0; __i < _M_buckets.size(); ++__i) {
|
|
84 _Node* __cur = _M_buckets[__i];
|
|
85 while (__cur != 0) { _M_delete_node(__cur); }
|
|
86 }
|
|
87 }
|
|
88 template<class _Key, class _Tp, class _HashFn = ::hash<_Key>, class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> > struct hash_map {
|
|
89 typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn, _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc> _Ht;
|
|
90 _Ht _M_ht;
|
|
91 typedef typename _Ht::key_type key_type;
|
|
92 typedef typename _Ht::value_type value_type;
|
|
93 typedef typename _Ht::hasher hasher;
|
|
94 typedef typename _Ht::key_equal key_equal;
|
|
95 typedef typename _Ht::size_type size_type;
|
|
96 typedef typename _Ht::allocator_type allocator_type;
|
|
97 hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) { }
|
|
98 _Tp& operator[](const key_type& __key) {
|
|
99 return _M_ht.find_or_insert(value_type(__key, _Tp())).second;
|
|
100 }
|
|
101 size_type count(const key_type& __key) const { return _M_ht.count(__key); }
|
|
102 size_type erase(const key_type& __key) {
|
|
103 return _M_ht.erase(__key);
|
|
104 }
|
|
105 };
|
|
106 extern size_t strlen (__const char *__s);
|
|
107 template <class C> struct scoped_ptr {
|
|
108 explicit scoped_ptr(C* p = __null) : ptr_(p) { delete ptr_; }
|
|
109 void reset(C* p = __null) {
|
|
110 if (p != ptr_) { delete ptr_; }
|
|
111 }
|
|
112 C& operator*() const {}
|
|
113 C* operator->() const {}
|
|
114 bool operator==(C* p) const { return ptr_ == p; }
|
|
115 bool operator!=(C* p) const { return ptr_ != p; }
|
|
116 C* ptr_;
|
|
117 };
|
|
118 namespace std {
|
|
119 class strstreambuf : public basic_streambuf<char, char_traits<char> > {
|
|
120 };
|
|
121 class strstream : public basic_iostream<char> {
|
|
122 public: int pcount() const;
|
|
123 char* str();
|
|
124 strstreambuf _M_buf;
|
|
125 };
|
|
126 };
|
|
127 const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
|
|
128 struct foo_1 {
|
|
129 foo_1(string* str) : str_(str) { }
|
|
130 operator bool() const {
|
|
131 return (__builtin_expect(str_ != __null, 0));
|
|
132 }
|
|
133 string* str_;
|
|
134 };
|
|
135 template<class t1, class t2> string* Makefoo_1(const t1& v1, const t2& v2, const char* names) {
|
|
136 strstream ss;
|
|
137 ss << names << " (" << v1 << " vs. " << v2 << ")";
|
|
138 return new string(ss.str(), ss.pcount());
|
|
139 }
|
|
140 template <class t1, class t2> inline string* Check_GTImpl(const t1& v1, const t2& v2, const char* names) {
|
|
141 if (v1 > v2) return __null;
|
|
142 else return Makefoo_1(v1, v2, names);
|
|
143 }
|
|
144 struct blah_54 {
|
|
145 blah_54(const char* file, int line, int severity);
|
|
146 ~blah_54();
|
|
147 ostream& stream() { };
|
|
148 };
|
|
149 class blah_0 : public blah_54 {
|
|
150 public: blah_0(const char* file, int line);
|
|
151 blah_0(const char* file, int line, const foo_1& result);
|
|
152 };
|
|
153 template <class Value, class Key, class HashFcn, class ExtractKey, class EqualKey, class Alloc> class dense_hashtable;
|
|
154 template <class V, class K, class HF, class ExK, class EqK, class A> struct dense_hashtable_iterator {
|
|
155 typedef V* pointer;
|
|
156 dense_hashtable_iterator(const dense_hashtable<V,K,HF,ExK,EqK,A> *h, pointer it, pointer it_end, bool advance) : ht(h), pos(it), end(it_end) {
|
|
157 if (advance) advance_past_empty_and_deleted();
|
|
158 }
|
|
159 pointer operator->() const { }
|
|
160 void advance_past_empty_and_deleted() {
|
|
161 while ( pos != end && (ht->test_empty(*this) || ht->test_deleted(*this)) ) ++pos;
|
|
162 }
|
|
163 const dense_hashtable<V,K,HF,ExK,EqK,A> *ht;
|
|
164 pointer pos, end;
|
|
165 };
|
|
166 template <class V, class K, class HF, class ExK, class EqK, class A> struct dense_hashtable_const_iterator {
|
|
167 typedef dense_hashtable_iterator<V,K,HF,ExK,EqK,A> iterator;
|
|
168 typedef dense_hashtable_const_iterator<V,K,HF,ExK,EqK,A> const_iterator;
|
|
169 typedef const V& reference;
|
|
170 typedef const V* pointer;
|
|
171 dense_hashtable_const_iterator(const dense_hashtable<V,K,HF,ExK,EqK,A> *h, pointer it, pointer it_end, bool advance) : ht(h), pos(it), end(it_end) {
|
|
172 if (advance) advance_past_empty_and_deleted();
|
|
173 }
|
|
174 dense_hashtable_const_iterator(const iterator &it) : pos(it.pos), end(it.end) {}
|
|
175 reference operator*() const { return *pos; }
|
|
176 pointer operator->() const {}
|
|
177 void advance_past_empty_and_deleted() {
|
|
178 while ( pos != end && (ht->test_empty(*this) || ht->test_deleted(*this))) ++pos;
|
|
179 }
|
|
180 const_iterator& operator++() { }
|
|
181 bool operator!=(const const_iterator& it) const { }
|
|
182 const dense_hashtable<V,K,HF,ExK,EqK,A> *ht;
|
|
183 pointer pos, end;
|
|
184 };
|
|
185 template <class Value, class Key, class HashFcn, class ExtractKey, class EqualKey, class Alloc> class dense_hashtable {
|
|
186 public: typedef Key key_type;
|
|
187 typedef Value value_type;
|
|
188 typedef HashFcn hasher;
|
|
189 typedef EqualKey key_equal;
|
|
190 typedef size_t size_type;
|
|
191 typedef dense_hashtable_iterator<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc> iterator;
|
|
192 typedef dense_hashtable_const_iterator<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc> const_iterator;
|
|
193 static const float HT_OCCUPANCY_FLT;
|
|
194 static const float HT_EMPTY_FLT;
|
|
195 static const size_t HT_MIN_BUCKETS = 32;
|
|
196 iterator end() {
|
|
197 return iterator(this, table + num_buckets, table + num_buckets, true);
|
|
198 }
|
|
199 const_iterator end() const {
|
|
200 return const_iterator(this, table + num_buckets, table+num_buckets,true);
|
|
201 }
|
|
202 void set_value(value_type* dst, const value_type& src) {
|
|
203 new(dst) value_type(src);
|
|
204 }
|
|
205 void destroy_buckets(size_type first, size_type last) {
|
|
206 for (; first != last; ++first) table[first].~value_type();
|
|
207 }
|
|
208 private: void squash_deleted() {
|
|
209 if ( num_deleted ) {
|
|
210 dense_hashtable tmp(*this);
|
|
211 swap(tmp);
|
|
212 }
|
|
213 }
|
|
214 public: void set_deleted_key(const value_type &val) { squash_deleted(); }
|
|
215 bool test_deleted(size_type bucknum) const {
|
|
216 return (use_deleted && num_deleted > 0 && equals(get_key(delval), get_key(table[bucknum])));
|
|
217 }
|
|
218 bool test_deleted(const const_iterator &it) const {
|
|
219 return (use_deleted && num_deleted > 0 && equals(get_key(delval), get_key(*it)));
|
|
220 }
|
|
221 bool set_deleted(const_iterator &it) {
|
|
222 set_value(const_cast<value_type*>(&(*it)), delval);
|
|
223 }
|
|
224 bool test_empty(size_type bucknum) const {
|
|
225 return equals(get_key(emptyval), get_key(table[bucknum]));
|
|
226 }
|
|
227 bool test_empty(const const_iterator &it) const {
|
|
228 return equals(get_key(emptyval), get_key(*it));
|
|
229 }
|
|
230 void fill_range_with_empty(value_type* table_start, value_type* table_end) {
|
|
231 uninitialized_fill(table_start, table_end, emptyval);
|
|
232 }
|
|
233 void set_empty(size_type buckstart, size_type buckend) {
|
|
234 destroy_buckets(buckstart, buckend);
|
|
235 fill_range_with_empty(table + buckstart, table + buckend);
|
|
236 }
|
|
237 size_type size() const {
|
|
238 return num_elements - num_deleted;
|
|
239 }
|
|
240 size_type bucket_count() const { }
|
|
241 static const size_type ILLEGAL_BUCKET = size_type(-1);
|
|
242 size_type min_size(size_type num_elts, size_type min_buckets_wanted) {
|
|
243 size_type sz = HT_MIN_BUCKETS;
|
|
244 while ( sz < min_buckets_wanted || num_elts >= sz * enlarge_resize_percent ) sz *= 2;
|
|
245 }
|
|
246 void maybe_shrink() {
|
|
247 if (shrink_threshold > 0 && (num_elements-num_deleted) < shrink_threshold && bucket_count() > HT_MIN_BUCKETS ) {
|
|
248 size_type sz = bucket_count() / 2;
|
|
249 sz /= 2;
|
|
250 dense_hashtable tmp(*this, sz);
|
|
251 swap(tmp);
|
|
252 }
|
|
253 }
|
|
254 void resize_delta(size_type delta, size_type min_buckets_wanted = 0) {
|
|
255 if ( consider_shrink ) maybe_shrink();
|
|
256 const size_type needed_size = min_size(num_elements + delta, min_buckets_wanted);
|
|
257 if ( needed_size > bucket_count() ) {
|
|
258 const size_type resize_to = min_size(num_elements - num_deleted + delta, min_buckets_wanted);
|
|
259 dense_hashtable tmp(*this, resize_to);
|
|
260 swap(tmp);
|
|
261 }
|
|
262 }
|
|
263 void copy_from(const dense_hashtable &ht, size_type min_buckets_wanted = 0) {
|
|
264 clear();
|
|
265 const size_type resize_to = min_size(ht.size(), min_buckets_wanted);
|
|
266 num_elements++;
|
|
267 }
|
|
268 explicit dense_hashtable(size_type n = 0, const HashFcn& hf = HashFcn(), const EqualKey& eql = EqualKey(),const ExtractKey& ext = ExtractKey()) : num_deleted(0), use_deleted(false), use_empty(false), delval(), emptyval(), enlarge_resize_percent(HT_OCCUPANCY_FLT), shrink_resize_percent(HT_EMPTY_FLT), table(__null), num_buckets(min_size(0, n)), num_elements(0) {
|
|
269 reset_thresholds();
|
|
270 }
|
|
271 dense_hashtable(const dense_hashtable& ht, size_type min_buckets_wanted = 0) : num_deleted(0), use_deleted(ht.use_deleted), use_empty(ht.use_empty), delval(ht.delval), emptyval(ht.emptyval), enlarge_resize_percent(ht.enlarge_resize_percent), shrink_resize_percent(ht.shrink_resize_percent), table(__null), num_buckets(0), num_elements(0) {
|
|
272 reset_thresholds();
|
|
273 copy_from(ht, min_buckets_wanted);
|
|
274 set_value(&emptyval, ht.emptyval);
|
|
275 enlarge_resize_percent = ht.enlarge_resize_percent;
|
|
276 copy_from(ht);
|
|
277 }
|
|
278 ~dense_hashtable() {
|
|
279 if (table) {
|
|
280 destroy_buckets(0, num_buckets);
|
|
281 free(table);
|
|
282 }
|
|
283 }
|
|
284 void swap(dense_hashtable& ht) {
|
|
285 std::swap(equals, ht.equals);
|
|
286 {
|
|
287 value_type tmp;
|
|
288 set_value(&delval, ht.delval);
|
|
289 set_value(&ht.delval, tmp);
|
|
290 set_value(&ht.emptyval, tmp);
|
|
291 }
|
|
292 std::swap(table, ht.table);
|
|
293 std::swap(num_buckets, ht.num_buckets);
|
|
294 reset_thresholds();
|
|
295 ht.reset_thresholds();
|
|
296 }
|
|
297 void clear() {
|
|
298 if (table) destroy_buckets(0, num_buckets);
|
|
299 num_buckets = min_size(0,0);
|
|
300 set_empty(0, num_buckets);
|
|
301 }
|
|
302 pair<size_type, size_type> find_position(const key_type &key) const {
|
|
303 const size_type bucket_count_minus_one = bucket_count() - 1;
|
|
304 size_type bucknum = hash(key) & bucket_count_minus_one;
|
|
305 size_type insert_pos = ILLEGAL_BUCKET;
|
|
306 while ( 1 ) {
|
|
307 if ( test_empty(bucknum) ) {
|
|
308 if ( insert_pos == ILLEGAL_BUCKET ) return pair<size_type,size_type>(ILLEGAL_BUCKET, insert_pos);
|
|
309 }
|
|
310 else if ( test_deleted(bucknum) ) {
|
|
311 if ( insert_pos == ILLEGAL_BUCKET ) insert_pos = bucknum;
|
|
312 }
|
|
313 else if ( equals(key, get_key(table[bucknum])) ) {
|
|
314 return pair<size_type,size_type>(bucknum, ILLEGAL_BUCKET);
|
|
315 }
|
|
316 }
|
|
317 }
|
|
318 iterator find(const key_type& key) {
|
|
319 if ( size() == 0 ) return end();
|
|
320 pair<size_type, size_type> pos = find_position(key);
|
|
321 if ( pos.first == ILLEGAL_BUCKET ) return end();
|
|
322 return iterator(this, table + pos.first, table + num_buckets, false);
|
|
323 }
|
|
324 const_iterator find(const key_type& key) const {
|
|
325 if ( size() == 0 ) return end();
|
|
326 pair<size_type, size_type> pos = find_position(key);
|
|
327 if ( pos.first == ILLEGAL_BUCKET ) return end();
|
|
328 return const_iterator(this, table + pos.first, table+num_buckets, false);
|
|
329 }
|
|
330 size_type count(const key_type &key) const {
|
|
331 pair<size_type, size_type> pos = find_position(key); }
|
|
332 pair<iterator, bool> insert_noresize(const value_type& obj) {
|
|
333 const pair<size_type,size_type> pos = find_position(get_key(obj));
|
|
334 if ( pos.first != ILLEGAL_BUCKET) {
|
|
335 return pair<iterator,bool>(iterator(this, table + pos.first, table + num_buckets, false), false);
|
|
336 }
|
|
337 else {
|
|
338 if ( test_deleted(pos.second) ) { ++num_elements; }
|
|
339 return pair<iterator,bool>(iterator(this, table + pos.second, table + num_buckets, false), true);
|
|
340 }
|
|
341 }
|
|
342 pair<iterator, bool> insert(const value_type& obj) {
|
|
343 resize_delta(1);
|
|
344 return insert_noresize(obj);
|
|
345 }
|
|
346 size_type erase(const key_type& key) {
|
|
347 const_iterator pos = find(key);
|
|
348 if ( pos != end() ) {
|
|
349 set_deleted(pos);
|
|
350 }
|
|
351 }
|
|
352 hasher hash;
|
|
353 key_equal equals;
|
|
354 ExtractKey get_key;
|
|
355 size_type num_deleted;
|
|
356 bool use_deleted;
|
|
357 bool use_empty;
|
|
358 value_type delval;
|
|
359 value_type emptyval;
|
|
360 float enlarge_resize_percent;
|
|
361 float shrink_resize_percent;
|
|
362 size_type shrink_threshold;
|
|
363 size_type enlarge_threshold;
|
|
364 value_type *table;
|
|
365 size_type num_buckets;
|
|
366 size_type num_elements;
|
|
367 bool consider_shrink;
|
|
368 void reset_thresholds() {
|
|
369 enlarge_threshold = static_cast<size_type>(num_buckets * shrink_resize_percent);
|
|
370 }
|
|
371 };
|
|
372 template<> struct hash<long> {
|
|
373 size_t operator()(long x) const {
|
|
374 }
|
|
375 };
|
|
376 template<> struct hash<unsigned long> {
|
|
377 size_t operator()(unsigned long x) const {
|
|
378 }
|
|
379 };
|
|
380 template <class Key, class T, class HashFcn = hash<Key>, class EqualKey = equal_to<Key>, class Alloc = allocator<T> > class dense_hash_map {
|
|
381 struct SelectKey {
|
|
382 const Key& operator()(const pair<const Key, T>& p) const {
|
|
383 return p.first;
|
|
384 }
|
|
385 };
|
|
386 typedef dense_hashtable<pair<const Key, T>, Key, HashFcn, SelectKey, EqualKey, Alloc> ht;
|
|
387 ht rep;
|
|
388 public: typedef typename ht::key_type key_type;
|
|
389 typedef T data_type;
|
|
390 typedef typename ht::value_type value_type;
|
|
391 typedef typename ht::size_type size_type;
|
|
392 typedef typename ht::iterator iterator;
|
|
393 typedef typename ht::const_iterator const_iterator;
|
|
394 iterator end() {
|
|
395 return rep.end();
|
|
396 }
|
|
397 iterator find(const key_type& key) { return rep.find(key); }
|
|
398 data_type& operator[](const key_type& key) {
|
|
399 iterator it = find(key);
|
|
400 return insert(value_type(key, data_type())).first->second;
|
|
401 }
|
|
402 pair<iterator, bool> insert(const value_type& obj) {
|
|
403 return rep.insert(obj);
|
|
404 }
|
|
405 void set_deleted_key(const key_type& key) {
|
|
406 rep.set_deleted_key(value_type(key, data_type()));
|
|
407 }
|
|
408 size_type erase(const key_type& key) { return rep.erase(key); }
|
|
409 };
|
|
410 template <class Value, class HashFcn = hash<Value>, class EqualKey = equal_to<Value>, class Alloc = allocator<Value> > class dense_hash_set {
|
|
411 struct Identity {
|
|
412 const Value& operator()(const Value& v) const { return v; }
|
|
413 };
|
|
414 typedef dense_hashtable<Value, Value, HashFcn, Identity, EqualKey, Alloc> ht;
|
|
415 ht rep;
|
|
416 public: typedef typename ht::key_type key_type;
|
|
417 typedef typename ht::value_type value_type;
|
|
418 typedef typename ht::size_type size_type;
|
|
419 typedef typename ht::const_iterator iterator;
|
|
420 size_type count(const key_type& key) const {
|
|
421 return rep.count(key);
|
|
422 }
|
|
423 pair<iterator, bool> insert(const value_type& obj) {
|
|
424 pair<typename ht::iterator, bool> p = rep.insert(obj);
|
|
425 }
|
|
426 size_type erase(const key_type& key) {
|
|
427 return rep.erase(key);
|
|
428 }
|
|
429 };
|
|
430 class linked_ptr_internal {
|
|
431 public: bool depart() { if (next_ == this) return true; }
|
|
432 mutable linked_ptr_internal const* next_;
|
|
433 };
|
|
434 template <typename T> class linked_ptr {
|
|
435 public: explicit linked_ptr(T* ptr = __null) {
|
|
436 }
|
|
437 ~linked_ptr() { depart(); }
|
|
438 T& operator*() const { }
|
|
439 T* value_;
|
|
440 linked_ptr_internal link_;
|
|
441 void depart() {
|
|
442 if (link_.depart()) delete value_;
|
|
443 }
|
|
444 };
|
|
445 class blah_3 {
|
|
446 const char* ptr_;
|
|
447 int length_;
|
|
448 public: blah_3(const char* str) : ptr_(str), length_((str == __null) ? 0 : static_cast<int>(strlen(str))) { }
|
|
449 };
|
|
450 class blah_5;
|
|
451 class Bitmap {
|
|
452 public: Bitmap(unsigned int size) : array_size_(RequiredArraySize(size)) { }
|
|
453 static unsigned int RequiredArraySize(unsigned int num_bits) { return (num_bits + 31) >> 5; }
|
|
454 unsigned int array_size_;
|
|
455 };
|
|
456 enum blah_31 { CREATIVE_FORMAT_TEXT_NARROW, kNumblah_31s };
|
|
457 enum blah_33 { BLACKLISTED };
|
|
458 template <typename EnumT> class blah_55;
|
|
459 typedef blah_55<blah_31> blah_31Set;
|
|
460 enum blah_36 { APPROVAL_STATUS_APPROVED, APPROVAL_STATUS_UNKNOWN };
|
|
461 enum blah_37 { hahah_INVALID, hahah_KEYWORD };
|
|
462 template<typename EnumT> class blah_55 {
|
|
463 public: blah_55(int enum_size);
|
|
464 bool Insert(EnumT x);
|
|
465 const int enum_size_;
|
|
466 Bitmap elements_;
|
|
467 };
|
|
468 template<typename EnumT> blah_55<EnumT>::blah_55(int enum_size) :enum_size_(enum_size), elements_(enum_size) {
|
|
469 while (foo_1 _result = Check_GTImpl(1, 0, "enum_size" " " ">" " " "0")) blah_0(".h", 1902, _result).stream();
|
|
470 };
|
|
471 enum blah_38 {
|
|
472 ttttttt_9, };
|
|
473 class blah_46 {
|
|
474 public: blah_46() : hahaha_id_(0), type_(hahah_INVALID), approval_status_(APPROVAL_STATUS_APPROVED) {
|
|
475 }
|
|
476 blah_46(long cid) : hahaha_id_(cid), type_(hahah_INVALID), approval_status_(APPROVAL_STATUS_APPROVED) {
|
|
477 }
|
|
478 long id() const {
|
|
479 return (static_cast<long>(hahaha_id_) << 16) >> 16;
|
|
480 }
|
|
481 static const blah_46 kBlacklistedID;
|
|
482 bool operator == (const blah_46& x) const { return id() == x.id(); }
|
|
483 bool operator < (const blah_46& x) const { return id() < x.id(); }
|
|
484 long hahaha_id_ : 48;
|
|
485 blah_37 type_ : 8;
|
|
486 blah_36 approval_status_ : 4;
|
|
487 };
|
|
488 template <> struct hash<blah_46> {
|
|
489 size_t operator()(const blah_46 &x) const {
|
|
490 return size_t(x.id());
|
|
491 }
|
|
492 };
|
|
493 class blah_57 {
|
|
494 public: blah_57();
|
|
495 void AddReason(blah_33 reason, const blah_3& debug_str, const blah_46& hahaha_id, bool );
|
|
496 void set_collects_multiple_reasons(bool t) { }
|
|
497 private: struct foo_3 {
|
|
498 string reject_desc;
|
|
499 };
|
|
500 foo_3 first_reason_;
|
|
501 };
|
|
502 template <class T> struct foo_5 : public unary_function<T*, long> {
|
|
503 long operator()(const T* p) const {
|
|
504 long id = reinterpret_cast<long>(p);
|
|
505 if (id < 2) return -id;
|
|
506 }
|
|
507 };
|
|
508 template <class T> class DensePtrSet : public dense_hashtable<T*, long, hash<long>, foo_5<T>, equal_to<long>, allocator<T*> > {
|
|
509 public: DensePtrSet() {
|
|
510 this->set_deleted_key(reinterpret_cast<T*>(1));
|
|
511 }
|
|
512 const T* Find(long key) const {
|
|
513 typename DensePtrSet<T>::const_iterator it = this->find(key);
|
|
514 return it != this->end() ? *it : __null;
|
|
515 }
|
|
516 };
|
|
517 struct foo_7 {
|
|
518 foo_7(bool spell_correction, bool query_broadening, bool previous_query, bool near_aaaaa, bool same_length, float mult, float exp_score) : shengmo_0(spell_correction), shengmo_1(query_broadening), shengmo_2(previous_query), shengmo_3(near_aaaaa), shengmo_4(same_length), multiplier(mult), expansion_score(exp_score) {
|
|
519 }
|
|
520 int CompareSameKeywordMatch(const foo_7& compare) const;
|
|
521 bool shengmo_0, shengmo_1, shengmo_2, shengmo_3, shengmo_4;
|
|
522 float multiplier, expansion_score;
|
|
523 };
|
|
524 enum blah_41 {
|
|
525 ACP_ECPM_EARLY = 2 };
|
|
526 struct foo_8 { unsigned int packed_ctr1; };
|
|
527 struct foo_9 { foo_9() {}};
|
|
528 class blah_16;
|
|
529 class blah_17;
|
|
530 class foo_12 { public: foo_12() {}
|
|
531 unsigned long hahaha_id() const {}
|
|
532 unsigned int qbb_score() const {}
|
|
533 private: static const vector<blah_46> hmmmmh_4;
|
|
534 long hahaha_id_ : 40;
|
|
535 };
|
|
536 class foo_13 {
|
|
537 public: typedef dense_hash_map<long, int> BestMap;
|
|
538 foo_13() { best_rrrrrrr_.set_deleted_key(-1); }
|
|
539 void erase(long ad_group_id) {
|
|
540 best_rrrrrrr_.erase(ad_group_id);
|
|
541 }
|
|
542 typedef BestMap::iterator iterator;
|
|
543 typedef BestMap::const_iterator const_iterator;
|
|
544 const_iterator begin() const { }
|
|
545 iterator end() { return best_rrrrrrr_.end(); }
|
|
546 iterator find(long ad_group_id) { return best_rrrrrrr_.find(ad_group_id); }
|
|
547 const foo_12& GetMatch(const_iterator it) const {}
|
|
548 void hmmmmh_27(long ad_group_id, const foo_12& addme);
|
|
549 private: BestMap best_rrrrrrr_;
|
|
550 vector<foo_12> rrrrrrr_buffer_;
|
|
551 };
|
|
552 struct foo_10 : public dense_hash_set<blah_46> {};
|
|
553 class foo_9Set : public DensePtrSet<foo_9> {};
|
|
554 typedef map<blah_46, foo_7*> foo_6Data;
|
|
555 typedef hash_map<long, linked_ptr<blah_57> > RejectedAdGroupMap;
|
|
556 enum blah_43 {};
|
|
557 class foo_14 {
|
|
558 public: foo_14(const unsigned int, const blah_16*, const int*);
|
|
559 bool GathersMultipleRejectionReasons() const;
|
|
560 void hmmmmh_30(blah_46 hahaha_id, blah_38 type);
|
|
561 const foo_7* Insertfoo_6(const blah_46 hahaha_id, bool shengmo_0, bool shengmo_1, bool shengmo_2, bool shengmo_3, bool shengmo_4_rewrite, float multiplier, float context_score);
|
|
562 void hmmmmh_7(blah_46 hahaha_id, blah_38 type);
|
|
563 foo_9* Insertfoo_9();
|
|
564 bool hmmmmh_8(long ad_group_id, const foo_12 &entry);
|
|
565 void hmmmmh_9(long ad_group_id);
|
|
566 foo_13::iterator hmmmmh_0(long ad_group_id);
|
|
567 bool hmmmmh_8(long ad_group_id, foo_13::iterator best, const foo_12& entry);
|
|
568 void hmmmmh_5(const blah_46 hahaha_id);
|
|
569 void hmmmmh_29(const blah_46 hahaha_id);
|
|
570 bool hmmmmh_12(const blah_46 hahaha_id) const;
|
|
571 bool hmmmmh_13(const blah_46 hahaha_id) const;
|
|
572 const foo_9* Getfoo_9(const blah_46 hahaha_id) const;
|
|
573 bool Gathersfoo_9() const {}
|
|
574 const foo_10* rrrrrrr_type_data() const {}
|
|
575 const foo_10* negative_rrrrrrr_type_data() const {}
|
|
576 const foo_10* positive_rrrrrrr_type_data() const {}
|
|
577 const foo_9Set* kw_info_set() const { }
|
|
578 const foo_6Data* rewrite_data() const {}
|
|
579 const vector<blah_17>& query_rectangles() const {}
|
|
580 void hmmmmh_14();
|
|
581 void AddQueryRectangle(const blah_17& query_rectangle);
|
|
582 void hmmmmh_15(long ad_group_id, const blah_46 hahaha_id, blah_33 reject_class, const char* reject_desc = __null);
|
|
583 void hmmmmh_16(const vector<long>& rejected_sssr_ids);
|
|
584 void Copy(const foo_14& cmi);
|
|
585 void hmmmmh_10();
|
|
586 private: const blah_16* ad_request_;
|
|
587 const int* cr_query_;
|
|
588 blah_43 gather_flags_;
|
|
589 vector<blah_17> query_rectangles_;
|
|
590 foo_10 rrrrrrr_type_data_;
|
|
591 foo_9Set kw_info_set_;
|
|
592 foo_6Data rewrite_data_;
|
|
593 scoped_ptr<RejectedAdGroupMap> rejected_sssr_map_;
|
|
594 foo_13 ad_group_rrrrrrr_data_;
|
|
595 vector<blah_46> geo_hahaha_;
|
|
596 bool geo_hahaha_is_sorted_;
|
|
597 foo_10 negative_rrrrrrr_type_data_, positive_rrrrrrr_type_data_;
|
|
598 scoped_ptr<foo_10> extra_hahaha_set_;
|
|
599 int dimension_id_;
|
|
600 blah_31Set creative_formats_;
|
|
601 scoped_ptr<dense_hash_set<unsigned long> > near_aaaaa_rrrrrrr_fps_;
|
|
602 blah_41 comparison_policy_;
|
|
603 blah_46 next_virtual_hahaha_id_;
|
|
604 vector<void*>* sub_queries_;
|
|
605 bool allow_only_whitelisted_customers_, automatic_hahaha_rrrrrrr_;
|
|
606 scoped_ptr<blah_5> kw_arena_, expanded_rrrrrrr_arena_;
|
|
607 };
|
|
608 class blah_19 {
|
|
609 void hmmmmh_3();
|
|
610 enum blah_45 {};
|
|
611 };
|
|
612 void blah_19::hmmmmh_3() {}
|
|
613 class blah_16 {
|
|
614 public: int near_aaaaa_rrrrrrr_fps_size() const {}
|
|
615 unsigned long near_aaaaa_rrrrrrr_fps(int i) const {}
|
|
616 };
|
|
617 class blah_21 {
|
|
618 protected: blah_21(char* first_block, const size_t block_size, bool align_to_page);
|
|
619 void* GetMemoryFallback(const size_t size, const int align);
|
|
620 void* GetMemory(const size_t size, const int align) {
|
|
621 if ( size > 0 && size < remaining_ && align == 1 ) {
|
|
622 last_alloc_ = freestart_;
|
|
623 }
|
|
624 return GetMemoryFallback(size, align);
|
|
625 }
|
|
626 char* freestart_;
|
|
627 char* last_alloc_;
|
|
628 size_t remaining_;
|
|
629 };
|
|
630 class blah_5 : blah_21 {
|
|
631 public: char* Alloc(const size_t size) {
|
|
632 return reinterpret_cast<char*>(GetMemory(size, 1));
|
|
633 }
|
|
634 };
|
|
635 class blah_25 {
|
|
636 public: virtual ~blah_25();
|
|
637 };
|
|
638 class blah_17 : blah_25 { };
|
|
639 void Fillfoo_8(const foo_12& x2, struct foo_8* out) {
|
|
640 out->packed_ctr1 = x2.qbb_score();
|
|
641 }
|
|
642 const vector<blah_46> foo_12::hmmmmh_4;
|
|
643 foo_14::foo_14(const unsigned int gather_flags, const blah_16* ad_request, const int* cr_query): ad_request_(ad_request), cr_query_(cr_query), gather_flags_(static_cast<blah_43>(gather_flags)), geo_hahaha_is_sorted_(false), dimension_id_(0), creative_formats_(kNumblah_31s), comparison_policy_(ACP_ECPM_EARLY), sub_queries_(new vector<void*>()), allow_only_whitelisted_customers_(false), automatic_hahaha_rrrrrrr_(false) {
|
|
644 hmmmmh_10();
|
|
645 }
|
|
646 void foo_14::hmmmmh_5(const blah_46 hahaha_id) {
|
|
647 negative_rrrrrrr_type_data_.insert(hahaha_id);
|
|
648 }
|
|
649 void foo_14::hmmmmh_7(blah_46 hahaha_id, blah_38 type) { }
|
|
650 foo_13::iterator foo_14::hmmmmh_0( long ad_group_id) {
|
|
651 return ad_group_rrrrrrr_data_.find(ad_group_id);
|
|
652 }
|
|
653 bool foo_14::hmmmmh_8(long ad_group_id, foo_13::iterator best, const foo_12& entry) {
|
|
654 rejected_sssr_map_->erase(ad_group_id);
|
|
655 ad_group_rrrrrrr_data_.hmmmmh_27(ad_group_id, entry);
|
|
656 }
|
|
657 bool foo_14::hmmmmh_8(long ad_group_id, const foo_12& entry) {
|
|
658 foo_13::iterator best = hmmmmh_0(ad_group_id);
|
|
659 }
|
|
660 void foo_14::hmmmmh_9(long ad_group_id) {
|
|
661 ad_group_rrrrrrr_data_.erase(ad_group_id);
|
|
662 }
|
|
663 void foo_14::hmmmmh_10() {
|
|
664 if (near_aaaaa_rrrrrrr_fps_ != __null) {
|
|
665 blah_54(".cc", 226, WARNING).stream() << "";
|
|
666 for (int j = 0;
|
|
667 j < ad_request_->near_aaaaa_rrrrrrr_fps_size(); j++) {
|
|
668 near_aaaaa_rrrrrrr_fps_->insert(ad_request_->near_aaaaa_rrrrrrr_fps(j));
|
|
669 }
|
|
670 }
|
|
671 }
|
|
672 const foo_7* foo_14::Insertfoo_6(const blah_46 hahaha_id, bool shengmo_0, bool shengmo_1, bool shengmo_2, bool shengmo_3, bool shengmo_4_rewrite, float multiplier, float context_score) {
|
|
673 if (rrrrrrr_type_data_.count(hahaha_id) > 0) return __null;
|
|
674 foo_7* new_info = new(expanded_rrrrrrr_arena_->Alloc(sizeof(foo_7))) foo_7(shengmo_0,shengmo_1, shengmo_2, shengmo_3, shengmo_4_rewrite, multiplier, context_score);
|
|
675 pair<foo_6Data::iterator, bool> status = rewrite_data_.insert( make_pair(hahaha_id, new_info));
|
|
676 foo_7* inserted = status.first->second;
|
|
677 if (!status.second) {
|
|
678 if (inserted->CompareSameKeywordMatch(*new_info) < 0) *inserted = *new_info;
|
|
679 }
|
|
680 }
|
|
681 foo_9* foo_14::Insertfoo_9() {
|
|
682 foo_9* info = new(kw_arena_->Alloc(sizeof(foo_9))) foo_9;
|
|
683 if (Gathersfoo_9()) kw_info_set_.insert(info);
|
|
684 creative_formats_.Insert(CREATIVE_FORMAT_TEXT_NARROW);
|
|
685 }
|
|
686 bool foo_14::hmmmmh_12(const blah_46 hahaha_id) const {
|
|
687 if (rrrrrrr_type_data_.count(hahaha_id)) return true;
|
|
688 }
|
|
689 bool foo_14::hmmmmh_13(const blah_46 hahaha_id) const {
|
|
690 if (positive_rrrrrrr_type_data_.count(hahaha_id)) return true;
|
|
691 }
|
|
692 const foo_9* foo_14::Getfoo_9(const blah_46 hahaha_id) const {
|
|
693 if (Gathersfoo_9()) return kw_info_set_.Find(hahaha_id.id());
|
|
694 static int occurrences_383 = 0, occurrences_mod_n_383 = 0;
|
|
695 if (++occurrences_mod_n_383 > 1000) occurrences_mod_n_383 -= 1000;
|
|
696 }
|
|
697 void foo_14::hmmmmh_15(long ad_group_id, const blah_46 hahaha_id, blah_33 reject_class, const char* reject_desc) {
|
|
698 if (rejected_sssr_map_ == __null) {
|
|
699 blah_54("a.cc", 413, ERROR).stream() << "re NULL";
|
|
700 rejected_sssr_map_.reset(new RejectedAdGroupMap);
|
|
701 }
|
|
702 if (rejected_sssr_map_->count(ad_group_id) == 0) {
|
|
703 blah_57* ad_rejection = new blah_57();
|
|
704 ad_rejection->set_collects_multiple_reasons( GathersMultipleRejectionReasons());
|
|
705 (*rejected_sssr_map_)[ad_group_id] = linked_ptr<blah_57>(ad_rejection);
|
|
706 }
|
|
707 blah_57& ad_rejection = *(*rejected_sssr_map_)[ad_group_id];
|
|
708 ad_rejection.AddReason(reject_class, reject_desc, hahaha_id, false);
|
|
709 }
|
|
710 void foo_14::hmmmmh_16(const vector<long>& rejected_sssr_ids) {
|
|
711 for (vector<long>::const_iterator it = rejected_sssr_ids.begin();
|
|
712 it != rejected_sssr_ids.end(); ++it) {
|
|
713 ad_group_rrrrrrr_data_.erase(*it);
|
|
714 for (foo_13::const_iterator it = ad_group_rrrrrrr_data_.begin();
|
|
715 it != ad_group_rrrrrrr_data_.end(); ++it) {
|
|
716 hmmmmh_15(it->first, ad_group_rrrrrrr_data_.GetMatch(it).hahaha_id(), BLACKLISTED);
|
|
717 }
|
|
718 }
|
|
719 hmmmmh_30(blah_46::kBlacklistedID, ttttttt_9);
|
|
720 }
|
|
721 void foo_14::Copy(const foo_14& cmi) {
|
|
722 rrrrrrr_type_data_ = *cmi.rrrrrrr_type_data();
|
|
723 negative_rrrrrrr_type_data_ = *cmi.negative_rrrrrrr_type_data();
|
|
724 positive_rrrrrrr_type_data_ = *cmi.positive_rrrrrrr_type_data();
|
|
725 if (cmi.Gathersfoo_9()) {
|
|
726 kw_info_set_ = *cmi.kw_info_set();
|
|
727 rewrite_data_ = *cmi.rewrite_data();
|
|
728 }
|
|
729 hmmmmh_14();
|
|
730 for (int i = 0; i < cmi.query_rectangles().size();
|
|
731 ++i) AddQueryRectangle(cmi.query_rectangles()[i]);
|
|
732 }
|
|
733 void foo_13::hmmmmh_27(long ad_group_id, const foo_12& addme) {
|
|
734 int& best_index = best_rrrrrrr_[ad_group_id];
|
|
735 rrrrrrr_buffer_.push_back(addme);
|
|
736 }
|
|
737 void foo_14::hmmmmh_29(const blah_46 hahaha_id) {
|
|
738 if (extra_hahaha_set_ != __null) extra_hahaha_set_->erase(hahaha_id);
|
|
739 }
|