Article View: comp.arch
Article #295Binary translation (was: Almost Ready to Repeat the Cycle)
From: Anton Ertl
Date: Fri, 23 Oct 2026 07:55
Date: Fri, 23 Oct 2026 07:55
39 lines
3075 bytes
3075 bytes
BGB <cr88192@gmail.com> writes: >On 10/22/2026 11:47 AM, Anton Ertl wrote: >> OTOH, it seems to work ok for Apple with Rosetta. >> > >Yes. > >ARM64 works well here. I think that Apple's *implementations* of ARM A64 (all OoO on the Macs) work well. >There also seems to be some interest in the RISC-V space for dynamic >translation of x86 to RISC-V; though emulating x86 on RISC-V is likely >to lead to a not exactly small number of things that are difficult to >emulate efficiently (EFLAGS being almost kinda evil in some ways; and >then on an ISA that is in some ways rather poorly equipped to try to >fake it). The flags are always a problem, and I don't think that ARM A64 has significant advantages over RISC-V here. Yes it has flags of its own, but the instructions do not set them the same way as AMD64. AMD64 has instructions that sometimes set the flags and sometimes don't, it has instructions that set C and/or V separately from NZP. And AFAIK ARM A64 has subtract with carry (and corresponding carry handling on compares), while AMD64 has subtract with borrow; so the meaning of the carry is inverted between the two after a subtract or compare instruction, while it agrees after an add instruction. So the binary translator essentially has to prepare for the worst case and generate all the AMD64 flags in case they are then used in a way that the binary translator does not see (e.g., after an indirect branch), and if the usage is known, can eliminate most or all of this flag-generation code. Pretty much the same for RISC-V. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID:
<2026Oct23.095556@mips.complang.tuwien.ac.at>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<6ad51222.27689359@news.eternal-september.org> <memo.20261020202111.15264J@jgd.cix.co.uk> <11bb7b6$93g4$1@dont-email.me> <1792685413-5857@newsgrouper.org> <2026Oct22.184735@mips.complang.tuwien.ac.at> <11bed14$1c7dh$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.arch Subject: Binary translation (was: Almost Ready to Repeat the Cycle) Date: Fri, 23 Oct 2026 07:55:56 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 39 Message-ID: <2026Oct23.095556@mips.complang.tuwien.ac.at> References: <6ad51222.27689359@news.eternal-september.org> <memo.20261020202111.15264J@jgd.cix.co.uk> <11bb7b6$93g4$1@dont-email.me> <1792685413-5857@newsgrouper.org> <2026Oct22.184735@mips.complang.tuwien.ac.at> <11bed14$1c7dh$1@dont-email.me> Injection-Date: Fri, 23 Oct 2026 08:12:59 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1669557"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VBZvpuYCmSHUZt4y0yr/b"; posting-host="2fa3e9841a62cba7e672273caf15be57" Cancel-Lock: sha1:KJZRsSkxQ4lV4KLPIx92JZe06yM= sha256:8oGNrwItm37s5ysJ5K3H/MLIEHmp+K2DSwyRWCuXuN4= sha1:KC+B6wHT6fj0iu8D6Blk74X6imU= sha256:uuGE5asiZLfjuEbmsa3uTic+6SefEgbc2pN+mqh4vHM= X-newsreader: xrn 10.11