-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drreg: register spilling mediation framework #511
Comments
From [email protected] on July 10, 2011 13:53:03 Summary: drreg: provide permanently-stolen reg support? |
From [email protected] on March 09, 2012 06:51:05 xref other extensions from the master extension discussion: drutil ( issue #295 ), drwrap ( issue #296 ), drmgr ( issue #402 ), drsyscall ( https://code.google.com/p/drmemory/issues/detail?id=822 ), drcallstack ( https://code.google.com/p/drmemory/issues/detail?id=823 ), drmalloc ( https://code.google.com/p/drmemory/issues/detail?id=824 ), umbra ( https://code.google.com/p/drmemory/issues/detail?id=825 ) |
From [email protected] on May 11, 2012 11:44:53 *** INFO drmgr and drreg discussion :meeting_DrM_2012_1_25: xref issue #164/PR 494720: add a post-instru pass that checks for errors in register preservation drreg and drmgr discussion highlights:
*** TODO drreg framework :meeting_DrM_2012_5_11: how does client tell us lifetime of values in scratch registers? so drreg API to request whole-bb reg during analysis phase:
API to request app value to be restored (for OP_lea for shadow map, e.g.) but want more than just pick best regs and keep app values in spill slots
have -conservative option for whether to use dead regs (can turn on if for using Extensions:
Summary: drreg: register spilling mediation framework |
From [email protected] on June 14, 2012 10:31:15 |
From [email protected] on July 15, 2013 13:52:20 pasting more notes: ** TODO later thoughts virtual regs would be by far the easiest to use. however, they require drmem is not linear: for check_ignore_unaddr mem2mem, jmps down below and |
** TODO revised interface: no up-front whole-bb, just simple reserve+unreserve interface Originally I had these in drreg_options_t:
The only reason to hardcode the number of whole-bb regs up front, and to
From a pure user interface point of view, drreg would be much simpler if it Xref discussion above about the original interface of drreg just picking If too many regs are reserved across an app instr, we may run out of To handle fault xl8, we can decode the in-cache bb and walk forward Might still want "local" hints so drreg saves less-used-in-bb regs Would any unreserved regs warrant keeping spilled across app instrs? |
Xref #1771 |
** TODO add lazy restore of aflags consecutive drx_insert_counter_update() (after #1771 adds drxmgr test using drreg in the counter routine): pre:
post:
Adding to the drreg test:
|
** TODO support use in shared gencode outside of bb event, and in instru2instru phase DrMem's pattern mode wants to save aflags w/ liveness analysis in the Maybe for this pattern case we can add flags saving in insert phase and in Xref the non-drmgr API discussion about a parallel set of routines: drregi_*. We could keep the same API signatures if we store liveness in pt, just like Or, we add nothing extra in the API, and liveness is computed on the spot Gencode support seems a subset: the user probably wants to spill while |
drreg is complete enough that we should be able to close this soon. With 00d39c7 in place, it now matches the efficiency of the hand-coded spilling in the samples and as part of #1273 I was able to convert all the remaining samples to use drreg. I'm going to wait until the Dr. Memory port to drreg is complete as a few issues remain there that might require additions or possibly changes to the interface. d749f93 i#511 drreg: initial framework, liveness analysis, and aflags implementation |
Adding a note here to remember to remove the "work in progress...interface may be in flux" from drreg.dox when closing this. Another note: the drreg barrier needed when invoking things like dr_insert_mbr_instrumentation() needs to be better documented. One annoying thing hit when converting the samples was that a sample not using drreg but using drx_insert_counter_increment and drmgr was forced to init drreg on its own. Perhaps we can solve this by having drx_init call drreg_init but in a "weak" way so that any pre-existing or later call overrides it? |
Xref #1963 |
Adds support for several conflicts between aflags and xax on x86: failing to reserve xax due to lazy aflags still residing in xax; failing to reserve aflags if xax is taken; and failing to get the app aflags value if xax is taken. For the first one, we throw away the lazy aflags. For the other two, we reserve a temporary scratch register, xchg it with xax, and restore it afterward. We place aflags in TLS and do not try to keep it in a register. Issue: #511
Adds support for several conflicts between aflags and xax on x86: failing to reserve xax due to lazy aflags still residing in xax; failing to reserve aflags if xax is taken; and failing to get the app aflags value if xax is taken. For the first one, we throw away the lazy aflags. For the other two, we reserve a temporary scratch register, xchg it with xax, and restore it afterward. We place aflags in TLS and do not try to keep it in a register. Issue: #511
Adds two drreg features to help support separate control flow paths such as a slowpath and a fastpath: drreg_reservation_info_ex(), which provides information on registers which have been unreserved but not yet lazily restored, and drreg_statelessly_restore_app_value() which restores app state without changing drreg state, to retain parity with a separate path. Adds some tests of the new features. Issue: #511
Adds two drreg features to help support separate control flow paths such as a slowpath and a fastpath: drreg_reservation_info_ex(), which provides information on registers which have been unreserved but not yet lazily restored, and drreg_statelessly_restore_app_value() which restores app state without changing drreg state, to retain parity with a separate path. Adds some tests of the new features. Issue: #511
Adds a query routine to identify whether an instruction is a spill or restore generated by drreg. Adds a sanity check test. Issue: #511
Adds a query routine to identify whether an instruction is a spill or restore generated by drreg. Removes over-zealous asserts about accessing another thread's DR spill slots. Fixes failure to restore on a fault spills to DR spill slots, but ignores the 3rd DR spill slot when restoring to avoid problems whose full solution is left to #2933. Adds a sanity check test. Issue: #511
Are there any more available notes on the support of virtual registers by any chance? In particular, I am wondering whether the allocation of physical registers would be done in the final phase related to Instrumentation-to-instrumentation transformations? Moreover, how would DynamoRIO reason over virtual registers in previous stages? I assume there needs to be some new class of special registers that the IR may handle? |
A virtual register feature was never implemented and never got far enough to have a detailed design. If you were interested in adding such a feature I would suggest filing a separate issue and writing some kind of design proposal. |
From [email protected] on July 10, 2011 16:52:53
we plan to build a "drreg" extension that provides register liveness
analysis and stealing. one thing we didn't plan to do but we may want to
is to add a feature to permanently steal a register. when only need access
to a few fields though, directly-addressable TLS should be more performant:
but when have a lot of fields a stolen register could be more efficient.
Original issue: http://code.google.com/p/dynamorio/issues/detail?id=511
The text was updated successfully, but these errors were encountered: