logoalt Hacker News

zbentley • today at 2:58 AM • 4 replies • view on HN

Not to be That Guy, but WINE doesn't use those techniques, and thus isn't an emulator.

It lightly translates binary formats (Windows executables) into Linux-compatible executable code, and then runs that code against libraries that implement Windows APIs in terms of Linux underneath. It's not an emulator in the same way that your libc isn't emulating lockf(3) in terms of fcntl(2) underneath. In web-dev parlance, we'd call WINE a polyfill.

Rosetta and QEMU on the other hand are emulators--emulators, in this instance, being a term of art that implies interpreting bespoke meaning from machine code instructions written in another program. Some emulators translate instructions 1:1, some have optimized stencils, some (like Rosetta) have kernel support for emulating very quickly, and some (maybe like Rosetta; sources disagree) also have hardware support as well.


Replies

yjftsjthsd-h • today at 6:25 AM

WINE emulates an ABI, rather than a CPU or such, but I'd happily argue that that's an emulator. (In fairness, though it's not generally described that way, I would call web polyfills API emulation)

➕ show 1 reply
leidenfrost • today at 3:09 AM

Wine as a polyfill makes so much more sense

userbinator • today at 3:59 AM

I believe WINE doesn't actually translate any instructions; it's a Windows PE loader and a bunch of libraries that implement Windows APIs using Linux equivalents.

➕ show 1 reply
throwaway27448 • today at 3:12 AM

> It lightly translates binary formats (Windows executables) into Linux-compatible executable code,

Does this not involve transpilation? I guess I was grouping that in under dynamic recompilation and AOT techniques.

Regardless, I don't think that there's a benefit from defining emulation from an implementation rather than an empirical perspective. If it runs a chunk of code as if it were in a different environment, I'm kind of ok to call it an emulator. To the sibling's point, a polyfill would also fit as an emulation layer here.