Lines Matching full:script
14 * They are cached for later re-use. Each script is specific for a
16 * that the script depends on (most unwind descriptors are
24 * o each unwind script has its own read-write lock; a thread must acquire
25 * a read lock before executing a script and must acquire a write lock
26 * before modifying a script
27 * o if both the unw.lock spinlock and a script's read-write lock must be
98 unsigned short lru_head; /* index of lead-recently used script */
99 unsigned short lru_tail; /* index of most-recently used script */
113 /* hash table that maps instruction pointer to script index: */
116 /* script cache: */
138 } script; member
1214 cache_match (struct unw_script *script, unsigned long ip, unsigned long pr) in cache_match() argument
1216 read_lock(&script->lock); in cache_match()
1217 if (ip == script->ip && ((pr ^ script->pr_val) & script->pr_mask) == 0) in cache_match()
1220 read_unlock(&script->lock); in cache_match()
1227 struct unw_script *script = unw.cache + info->hint; in script_lookup() local
1239 if (cache_match(script, ip, pr)) { in script_lookup()
1241 return script; in script_lookup()
1248 script = unw.cache + index; in script_lookup()
1250 if (cache_match(script, ip, pr)) { in script_lookup()
1253 unw.cache[info->prev_script].hint = script - unw.cache; in script_lookup()
1254 return script; in script_lookup()
1256 if (script->coll_chain >= UNW_HASH_SIZE) in script_lookup()
1258 script = unw.cache + script->coll_chain; in script_lookup()
1264 * On returning, a write lock for the SCRIPT is still being held.
1269 struct unw_script *script, *prev, *tmp; in script_new() local
1273 STAT(++unw.stat.script.news); in script_new()
1280 script = unw.cache + head; in script_new()
1281 unw.lru_head = script->lru_chain; in script_new()
1285 * script->lock. Thus, if the write_trylock() fails, we simply bail out. The in script_new()
1289 if (!write_trylock(&script->lock)) in script_new()
1292 /* re-insert script at the tail of the LRU chain: */ in script_new()
1296 /* remove the old script from the hash table (if it's there): */ in script_new()
1297 if (script->ip) { in script_new()
1298 index = hash(script->ip); in script_new()
1302 if (tmp == script) { in script_new()
1311 /* old script wasn't in the hash-table */ in script_new()
1317 /* enter new script in the hash table */ in script_new()
1319 script->coll_chain = unw.hash[index]; in script_new()
1320 unw.hash[index] = script - unw.cache; in script_new()
1322 script->ip = ip; /* set new IP while we're holding the locks */ in script_new()
1324 STAT(if (script->coll_chain < UNW_CACHE_SIZE) ++unw.stat.script.collisions); in script_new()
1326 script->flags = 0; in script_new()
1327 script->hint = 0; in script_new()
1328 script->count = 0; in script_new()
1329 return script; in script_new()
1333 script_finalize (struct unw_script *script, struct unw_state_record *sr) in script_finalize() argument
1335 script->pr_mask = sr->pr_mask; in script_finalize()
1336 script->pr_val = sr->pr_val; in script_finalize()
1338 * We could down-grade our write-lock on script->lock here but in script_finalize()
1341 * we're done using the script. in script_finalize()
1346 script_emit (struct unw_script *script, struct unw_insn insn) in script_emit() argument
1348 if (script->count >= UNW_MAX_SCRIPT_LEN) { in script_emit()
1349 UNW_DPRINT(0, "unwind.%s: script exceeds maximum size of %u instructions!\n", in script_emit()
1353 script->insn[script->count++] = insn; in script_emit()
1357 emit_nat_info (struct unw_state_record *sr, int i, struct unw_script *script) in emit_nat_info() argument
1398 script_emit(script, insn); in emit_nat_info()
1402 compile_reg (struct unw_state_record *sr, int i, struct unw_script *script) in compile_reg() argument
1483 script_emit(script, insn); in compile_reg()
1485 emit_nat_info(sr, i, script); in compile_reg()
1496 script_emit(script, insn); in compile_reg()
1523 * Build an unwind script that unwinds from state OLD_STATE to the
1530 struct unw_script *script = NULL; in build_script() local
1542 STAT(++unw.stat.script.builds; start = ia64_get_itc()); in build_script()
1551 script = script_new(ip); in build_script()
1552 if (!script) { in build_script()
1553 UNW_DPRINT(0, "unwind.%s: failed to create unwind script\n", __func__); in build_script()
1554 STAT(unw.stat.script.build_time += ia64_get_itc() - start); in build_script()
1557 unw.cache[info->prev_script].hint = script - unw.cache; in build_script()
1591 compile_reg(&sr, UNW_REG_RP, script); in build_script()
1592 script_finalize(script, &sr); in build_script()
1593 STAT(unw.stat.script.parse_time += ia64_get_itc() - parse_start); in build_script()
1594 STAT(unw.stat.script.build_time += ia64_get_itc() - start); in build_script()
1595 return script; in build_script()
1625 script->flags = sr.flags; in build_script()
1665 STAT(unw.stat.script.parse_time += ia64_get_itc() - parse_start); in build_script()
1680 script_emit(script, insn); in build_script()
1693 compile_reg(&sr, i, script); in build_script()
1696 compile_reg(&sr, i, script); in build_script()
1707 STAT(unw.stat.script.parse_time += ia64_get_itc() - parse_start); in build_script()
1709 script_finalize(script, &sr); in build_script()
1710 STAT(unw.stat.script.build_time += ia64_get_itc() - start); in build_script()
1711 return script; in build_script()
1720 run_script (struct unw_script *script, struct unw_frame_info *state) in run_script() argument
1727 STAT(++unw.stat.script.runs; start = ia64_get_itc()); in run_script()
1728 state->flags = script->flags; in run_script()
1729 ip = script->insn; in run_script()
1730 limit = script->insn + script->count; in run_script()
1817 STAT(unw.stat.script.run_time += ia64_get_itc() - start); in run_script()
1855 "unwind.%s: failed to locate/build unwind script for ip %lx\n", in find_save_locs()