summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Watson <davejwatson@fb.com>2017-08-14 16:28:17 -0700
committerDave Watson <davejwatson@fb.com>2017-08-15 10:33:40 -0700
commit3b3a453a65867f39b4a2850d21955610f0fab649 (patch)
treee6581a78e305f45c46f52a5b4841eabf88c60935
parent152a96e291d8c5a268ab6891eeba92f49c94f15c (diff)
downloadlibunwind-3b3a453a65867f39b4a2850d21955610f0fab649.tar.gz
dwarf: Fix cache size calculation
The and mask trick only works for power-of-two sized things, but must be computed using the full size. This incorrectly resulted in a very small cache size. Found using bisect and 'make perf' in tests directory. blame rev: 0b51f5892df0691fc7b3b947647222ab8e57dd54
-rw-r--r--src/dwarf/Gparser.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c
index 8b5c1de2..25f2d2c6 100644
--- a/src/dwarf/Gparser.c
+++ b/src/dwarf/Gparser.c
@@ -679,7 +679,7 @@ rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
unsigned short head;
head = cache->rr_head;
- cache->rr_head = (head + 1) & (cache->log_size - 1);
+ cache->rr_head = (head + 1) & (DWARF_UNW_CACHE_SIZE(cache->log_size) - 1);
/* remove the old rs from the hash table (if it's there): */
if (cache->links[head].ip)
@@ -885,7 +885,7 @@ find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
int ret = 0;
intrmask_t saved_mask;
- if ((cache = get_rs_cache(c->as, &saved_mask)) &&
+ if ((cache = get_rs_cache(c->as, &saved_mask)) &&
(rs = rs_lookup(cache, c)))
{
/* update hint; no locking needed: single-word writes are atomic */
@@ -951,7 +951,7 @@ dwarf_make_proc_info (struct dwarf_cursor *c)
needed for unw_resume */
dwarf_state_record_t sr;
int ret;
-
+
/* Lookup it up the slow way... */
ret = fetch_proc_info (c, c->ip, 0);
if (ret >= 0)
@@ -1018,11 +1018,11 @@ dwarf_reg_states_iterate(struct dwarf_cursor *c,
case UNW_INFO_FORMAT_REMOTE_TABLE:
ret = dwarf_reg_states_table_iterate(c, cb, token);
break;
-
+
case UNW_INFO_FORMAT_DYNAMIC:
ret = dwarf_reg_states_dynamic_iterate (c, cb, token);
break;
-
+
default:
Debug (1, "Unexpected unwind-info format %d\n", c->pi.format);
ret = -UNW_EINVAL;