4 ms·
> that a simple backflow analysis wouldn’t reveal Famous last words, "simple". What about sequences like: pushfd pop eax and eax, ebx Now you need t
by anyfoo 4y ago
> that a simple backflow analysis wouldn’t reveal
Famous last words, "simple". What about sequences like:
pushfd
pop eax
and eax, ebx
Now you need to know what ebx is to know for certain that PF and AF are irrelevant. Which is very likely, but not guaranteed, and the halting problem rears its ugly head.
I don't know whether there are good heuristics there or even how common that really is, but my gut feeling is that it may still be easy to "accidentally" drop into the slow AF/PF-preserving case, which can hurt in performance-critical code.
On the other hand, calculating AF/PF in hardware in the first place seems, from my outside view at least, much simpler, and appears to prevent a great deal of potential headache.
- ant6n 4y agoArguably, pushfd is a use of af/pf, unless the corresponding bits on stack are unused (which is hard to prove)
- anyfoo 4y agoThat's kind of what I did here, I "used" the bits on the stack by loading them into eax and ANDing them with whatever's in ebx. But yeah, the value could also be more directly referenced on the stack...
- ant6n 4y agoI meant “use” in terms of a live variable analysis: https://en.m.wikipedia.org/wiki/Live-variable_analysis https://en.m.wikipedia.org/wiki/Live-variable_analysis