Lines Matching defs:cache
77 flush_script_cache (struct ia64_script_cache *cache)
81 cache->lru_head = IA64_UNW_CACHE_SIZE - 1;
82 cache->lru_tail = 0;
87 cache->buckets[i].lru_chain = (i - 1);
88 cache->buckets[i].coll_chain = -1;
89 cache->buckets[i].ip = 0;
92 cache->hash[i] = -1;
98 struct ia64_script_cache *cache = &as->global_cache;
105 if (!spin_trylock_irqsave (&cache->busy, *saved_maskp))
110 cache = &ia64_per_thread_cache;
113 if (AO_test_and_set (&cache->busy) == AO_TS_SET)
119 lock_acquire (&cache->lock, *saved_maskp);
124 if (atomic_read (&as->cache_generation) != atomic_read (&cache->generation))
126 flush_script_cache (cache);
127 cache->generation = as->cache_generation;
129 return cache;
133 put_script_cache (unw_addr_space_t as, struct ia64_script_cache *cache,
140 spin_unlock_irqrestore (&cache->busy, *saved_maskp);
143 AO_CLEAR (&cache->busy);
146 lock_release (&cache->lock, *saved_maskp);
152 script_lookup (struct ia64_script_cache *cache, struct cursor *c)
154 struct ia64_script *script = cache->buckets + c->hint;
164 index = cache->hash[hash (ip)];
168 script = cache->buckets + index;
174 c->hint = cache->buckets[c->prev_script].hint =
175 (script - cache->buckets);
180 script = cache->buckets + script->coll_chain;
194 script_new (struct ia64_script_cache *cache, unw_word_t ip)
200 head = cache->lru_head;
201 script = cache->buckets + head;
202 cache->lru_head = script->lru_chain;
205 cache->buckets[cache->lru_tail].lru_chain = head;
206 cache->lru_tail = head;
212 tmp = cache->buckets + cache->hash[index];
221 cache->hash[index] = tmp->coll_chain;
229 tmp = cache->buckets + tmp->coll_chain;
235 script->coll_chain = cache->hash[index];
236 cache->hash[index] = script - cache->buckets;
642 struct ia64_script_cache *cache = NULL;
650 cache = get_script_cache (c->as, &saved_mask);
651 if (!cache)
653 Debug (1, "contention on script-cache; doing uncached lookup\n");
657 script = script_lookup (cache, c);
658 Debug (8, "ip %lx %s in script cache\n", (long) c->ip,
669 script = script_new (cache, c->ip);
677 cache->buckets[c->prev_script].hint = script - cache->buckets;
685 c->prev_script = script - cache->buckets;
698 put_script_cache (c->as, cache, &saved_mask);
719 struct ia64_script_cache *cache;
724 cache = get_script_cache (c->as, &saved_mask);
725 if (!cache)
726 return ret; /* cache is busy */
728 /* Re-check to see if a cache entry has been added in the meantime: */
729 script = script_lookup (cache, c);
733 script = script_new (cache, c->ip);
744 put_script_cache (c->as, cache, &saved_mask);
751 struct ia64_script_cache *cache;
755 cache = get_script_cache (c->as, &saved_mask);
756 if (!cache)
757 return -UNW_ENOINFO; /* cache is busy */
759 script = script_lookup (cache, c);
763 put_script_cache (c->as, cache, &saved_mask);