DynamoRIO / DynamoRIO/drmemory
instrumentation size reduction optimizations
- Dominant language
- C
- Stars
- 2.7k
- Forks
- 290
- PR merge metrics
- No merged PRs in 30d
Description
_From [derek.br...@gmail.com](https://code.google.com/u/117968039472581148324/) on December 10, 2010 17:57:56_
PR 446802
some optimizations to reduce instrumentation size, driven by space
constraints where DR's 128M reservation quickly runs out of
memory on my swapless vm when running many processes simultaneously:
- only check addressability of addressing reg once per bb if not written
to later: ebp is typical.
have per-bb struct that has reg array saying for each "known to be
addressable": set when check, clear when app instr writes.
- share spills across multiple instrs
except that violates DR spill slot specs (xref issue #53/PR 315355)
can share w/ adjust_esp at least.
or can use dr_raw_tls_calloc() from issue #108 (already using for shadow reg)
for even more spill slots => added as -num_spill_slots a while ago.
even if using own spill slots, have to then provide fixup on fault via
restore_state event.
should start w/ eflags: easiest to analyze. if not written in bb,
save at top via eax but put into our spill slot and restore eax.
restore eflags at bottom of bb.
then restore_state just has to restore eflags.
- jcc instrumentation very wasteful: saving eflags just to check shadow
eflags definedness. if have check_cmps on and jcc preceded by cmp/test,
eliminate the check? at least hoist it prior to the app's cmp/test and
avoid saving eflags.
actually this is similar to eliding redundant addressability check:
elide redundant eflags check if prev instr writes all 6 aflags and
had its sources checked.
- don't re-check definedness for dup src (e.g., "test eax,eax")
- turn on -bb_single_restore_prefix since cache space is more important
than ibl perf
I also have a number of other plans/ideas, will file eventually either in
this container case or separately
```
PR 446802: instrumentation size reduction optimizations
optimizations to reduce instrumentation size, driven by space constraints
where DR's 128M reservation quickly runs out of memory on
my swapless vm when running many processes simultaneously:
infrastructure:
* added inter-instr, intra-bb info for general sharing of info
across instrs
* fixed bug in -num_spill_slots: was using DR slots for shared_slowpath
* made -num_spill_slots 5 by default: slight perf hit for extra cache line
beyond DR's slots, but necessary to do inter-instr opts
optimizations:
* elide redundant register addressability checks (e.g., ebp as base in
consecutive instrs)
* if eflags live, save eflags once at top of bb and place in tls slot.
requires we use our own slots since DR's aren't live across instrs,
and that we have a state restoration event.
* don't check definedness of duplicate sources (e.g., "test eax,eax")
* for cmp/test+jcc -check_cmps don't need to instrument jcc
* turned on -bb_single_restore_prefix since cache space is more important
than ibl perf
results: 11% on hello
```
_Original issue: http://code.google.com/p/drmemory/issues/detail?id=135_
Contributor guide
Assessment
This issue has not been assessed yet.