Show HN: Rust Toolchain for iOS Bitcode
github.com
github.com
Bitcode is an intermediate format produced by LLVM, which allows for optimization passes to be applied to it across different languages. For example, C, C++, Swift, ObjC, and Rust can all benefit from some of the same bitcode optimization passes.
In theory Apple wanted this so they could improve the performance of applications when distributed on some of their platforms, though the benefits and potential of this has been a bit dubious. It did mean that Rust (until this) couldn’t easily target those Apple products.
Thanks for the correction.
As an example here’s Chris Lattner tweeting about that use case:
https://twitter.com/clattner_llvm/status/1091186386634326017...
Only if their new architecture looked a lot like Intel/ARM. Bitcode can’t paper over all architectural differences.
Not everything that Apple does lands on upstream.
So to a degree this might be true. But my guess is there is very little benefit here. It’s not clear to me if this could even optimize for the presence of a new vector unit, for example.
As Apple designs their own silicon and calling convention, they were able to pull this off for the S3 → S4 transition (the latter of which is AArch64 running with ILP32).
Now that there is a stable Swift ABI, at least it's theoretically possible to add a first-class Swift interoperability support to Rust, but it's a quite a chunk of work that nobody has attempted yet.
Currently the practical approach is to write the UI in Swift and Rust on the back-end, e.g. gif.ski app does it this way: https://github.com/sindresorhus/Gifski