1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-15 20:58:13 +01:00

(ia64_find_save_locs): Separate out the no-cache case so we don't

acquire the script-cache lock needlessly.

(Logical change 1.122)
This commit is contained in:
hp.com!davidm 2003-11-24 18:35:43 +00:00
parent 8a5d7aad9b
commit ffb9c88e0a

View file

@ -505,45 +505,52 @@ ia64_find_save_locs (struct cursor *c)
sigset_t saved_sigmask; sigset_t saved_sigmask;
int ret = 0; int ret = 0;
if (unlikely (c->as->caching_policy == UNW_CACHE_NONE))
{
struct ia64_script tmp_script;
if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0)
return ret;
script = &tmp_script;
script->ip = c->ip;
script->hint = 0;
script->count = 0;
if ((ret = build_script (c, script)) < 0)
{
if (ret != -UNW_ESTOPUNWIND)
dprintf ("%s: failed to build unwind script for ip %lx\n",
__FUNCTION__, (long) c->ip);
return ret;
}
run_script (script, c);
return 0;
}
cache = get_script_cache (c->as, &saved_sigmask); cache = get_script_cache (c->as, &saved_sigmask);
{ {
if (c->as->caching_policy == UNW_CACHE_NONE) script = script_lookup (cache, c);
debug (125, "%s: ip %lx %s in script cache\n",
__FUNCTION__, (long) c->ip, script ? "hit" : "missed");
if (!script)
{ {
struct ia64_script tmp_script;
if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0) if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0)
goto out; goto out;
script = &tmp_script; script = script_new (cache, c->ip);
script->ip = c->ip;
script->hint = 0;
script->count = 0;
ret = build_script (c, script);
}
else
{
script = script_lookup (cache, c);
debug (125, "%s: ip %lx %s in script cache\n",
__FUNCTION__, (long) c->ip, script ? "hit" : "missed");
if (!script) if (!script)
{ {
if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0) dprintf ("%s: failed to create unwind script\n", __FUNCTION__);
goto out; ret = -UNW_EUNSPEC;
goto out;
script = script_new (cache, c->ip);
if (!script)
{
dprintf ("%s: failed to create unwind script\n", __FUNCTION__);
ret = -UNW_EUNSPEC;
goto out;
}
cache->buckets[c->prev_script].hint = script - cache->buckets;
ret = build_script (c, script);
} }
c->hint = script->hint; cache->buckets[c->prev_script].hint = script - cache->buckets;
c->prev_script = script - cache->buckets;
ret = build_script (c, script);
} }
c->hint = script->hint;
c->prev_script = script - cache->buckets;
if (ret < 0) if (ret < 0)
{ {
if (ret != -UNW_ESTOPUNWIND) if (ret != -UNW_ESTOPUNWIND)