Hacker News new | past | comments | ask | show | jobs | submit login

Is there any way to capture or view Rosetta's output, i.e. to use Rosetta as a tool for porting x86 code to the M1?



You’d surely only need that if you had significant raw assembly to translate, in which case you’d have to assume that there were technical reasons for exact memory layout in x86, or perf reasons where you’d presumably want handcoded arm64 assembly?


Yes, that is exactly the case. I am involved in the effort to port Clozure Common Lisp to the M1 and it has a lot of bespoke assembly code.

(The x86_64 version of CCL actually works under Rosetta (more or less) which absolutely blows my mind since it's a compiler that emits x86 code at run-time!)


One issue you'd hit is that Rosetta is going to do fairly linear translation, and isn't going to improve calling conventions to the native one (in practice not terrible as x86_64 mercifully has enough registers for the all arguments in the general case).

In a sense if you were to go through the hand assembly one at a time and do 1:1 substitution with ARMv8 equivalent you'd probably be able to do a bit better, just because you don't have to consider behaviour of generic x86 code.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: