3 ms·
IIRC from our similar code, the LEA (load effective address) instruction is useful for doing adds / subtracts of arbitrary integers without updating the flags.
by mark_undoio 4y ago
IIRC from our similar code, the LEA (load effective address) instruction is useful for doing adds / subtracts of arbitrary integers without updating the flags.
Flags turn out to be quite the annoyance for the kind of in-process virtualization needed by Time Travel Debug. You need to instrument code with minimal overhead so, on the one hand, you don't want to save/restore flags all the time .... And on the other hand it still all has to work when flags get used.
- psychphysic 4y agoMultiplication even.
- timmisiak 4y agoYes, saving and restoring flags is very expensive. I thought about talking about that in the article but figured that was too much of a detour. Darek Mihocka wrote a really interesting article about how to optimize flag calculations in an x86 emulator: http://emulators.com/docs/nx11_flags.htm http://emulators.com/docs/nx11_flags.htm Although looking at your username I suspect you may have read this one before...
- mark_undoio 4y agoI had not read it before! Thanks for the link. I don't get too involved with our JIT other than to occasionally peer into some code and go "ooooh"