Re:Apple’s Bitcode Telegraphs Future CPU Plans
by bobajeff on Tuesday June 16, 2015 @05:41PM
(#9728878)
Perhaps someone can explain to me why converting a binary straight from one architecture to another couldnt be done. If emulators can work why not translaters?
[ Parent
| on HN ]
Re:Apple’s Bitcode Telegraphs Future CPU Plans
by Someone on Tuesday June 16, 2015 @06:03PM
(#9728986)
An emulator has run-time information, a translator does not.
That can be important information. For example, the translator might not figure out where data embedded in the code (for example a jump table) ends, and, consequently, continue translating from a point mid-way into a multi-byte instruction.
Translating code that generates code (as done in JIT engines or to speed up image processing kernels) also is a challenge; the best one realistically can do is to translate the existing code as-is and then call the translator at run time to do the translation. If that works, the 'call the translator' step may kill any performance that was won by generating code.
Of course, self-modifying code is a challenge, too.
Re:Apple’s Bitcode Telegraphs Future CPU Plans
by ahomescu1 on Tuesday June 16, 2015 @09:41PM
(#9729676)
The problem is that perfect disassembly (figuring out where every instruction starts, and if bytes are instructions or data) of an arbitrary program is undecidable. Emulators get around that problem by only disassembling instructions that actually get executed at run-time (and therefore can safely be called "code").