Skip to content
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 losing track of spilled registers when called outside of insertion phase. #3821

Closed
hgreving2304 opened this issue Sep 9, 2019 · 3 comments · Fixed by #3822
Closed

Comments

@hgreving2304
Copy link

When using drreg outside of the insertion phase, it defaults to a forward scan of the ilist to determine register liveness. At the beginning of the function drreg_forward_analysis, it flat-rate sets ever_spilled to false for each register. So if you call drreg_reserve_register() more than once, the ever_spilled of the first is false again. As a consequence, registers except the one of the last call of drreg_reserve_register() are never restored.

@johnfxgalea
Copy link
Contributor

When and why would you use drreg_reserve_register outside the insertion phase?

@hgreving2304
Copy link
Author

Using it in other phases is explicitly allowed (xref http://dynamorio.org/docs/page_drreg.html), except no optimization will be performed. For example the drreg-test has an example in instru2instru. I am not sure why instru2instru is important, but for example I currently need it for app2app, for an emulation sequence.

hgreving2304 pushed a commit that referenced this issue Sep 9, 2019
Re-setting the spilled flag causes earlier recorded registers's spill flag to reset. Those
registers will then not restore. Resetting the spilled flag is not needed as it will be
set in drreg_reserve_reg_internal().

Fixes #3821
@derekbruening
Copy link
Contributor

drreg use outside of the insertion phase will only work today if there is no other drreg use in that client or its libraries. See #3823.

hgreving2304 pushed a commit that referenced this issue Sep 12, 2019
…3822)

Re-setting the spilled flag causes earlier recorded registers's spill flag to reset. Those
registers will then not restore. A latent issue was filed with respect to resetting ever_spilled,
xref #3827.

A test was added to drreg-test that exposes the bug.

Fixes #3821
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants