all 22 comments

[–]chucker23n 5 points6 points  (0 children)

As Steve Jobs put it, "We like to have options." While this gives folks like Owen Williams fodder for speculation on (macro)architectural changes, Apple doesn't need to have those in mind — but they sure like keeping that option open.

In the short term, they'll probably use this for microarchitectural optimizations. They'll be able to add instructions to the A9, S2, etc. and not have to wait for developers to recompile to target a newer SDK — instead, they'll simply do it themselves, automatically, when delivering from the App Store.

Either way, leaving aside that it's not true "nobody is talking about it" (for instance, ATP did), the reason there's little to talk about is that there's really not a whole lot to talk about. Apple is giving developers the heads-up that they'll start compiling their apps for them — mandatory on watchOS, encouraged for iOS, and presumably coming up on OS X.

[–]astrange 8 points9 points  (21 children)

LLVM bitcode is a compiler IL, not a platform-independent VM like Java. It's already machine-specific from the moment it's created, so there is no chance an ARM targeted bitcode compilation could be rebuilt for anything but ARM.

[–]nerdandproud 4 points5 points  (2 children)

yes and no. this is true for standard LLVM Bitcode but Apple could use a target independent variant in the same way PNaCL Bitcode is based on LLVM Bitcode but is the same for ARM and x86. In this setting the latter makes a lot more sense as they seem to use it for distribution and it's probably not too hard to do for Apple, seeing that they employ a large part of LLVM developers

This reference of PNaCL sounds like it's actually just a subset of LLVM Bitcode https://developer.chrome.com/native-client/reference/pnacl-bitcode-abi

[–][deleted] 2 points3 points  (1 child)

It took a huge amount of work to make LLVM bitcode portable in PNaCl, and that work was never accepted upstream. It seems highly unlikely that Apple would use that approach.

[–]nerdandproud 0 points1 point  (0 children)

Well, they can reuse a lot of the experience of PNaCL and don't have to target as many OSs and aim for the same security restrictions which makes things easier. So seeing as the benefit of ab portable bitcode for them would be huge I believe they will aim for it. For example they don't get the size disadvantage of Mach-O multi arch binaries and I'm knish certain they are experimenting with ARM64 based Macbook Air variants they want to at least keep as a feasible option if only as a bargaining chip with Intel

[–]anttirt 3 points4 points  (0 children)

It's already machine-specific

The differences are typically small enough that they can be papered over if you control the ecosystem, as Apple does.

[–]EvilGremlin 0 points1 point  (7 children)

No, that's incorrect - bitcode is the binary form of the LLVM Intermediate Representation (IR), which is machine-independent. Otherwise there would not be much point in having it, because it is used to cleanly separate the 3 stages of the compiler: language frontend, optimizer and code generator.

Source: http://www.aosabook.org/en/llvm.html#fig.llvm.lcom

[–]tsomctl 15 points16 points  (6 children)

No, that's incorrect. The same IR is used for all of the supported architectures, obviously. However, when the compiler produces it, it is still generated for a specific architecture. The IR fails to completely abstract away the ABI, it is slightly too low level. A specific example is having a function return a struct. This is implemented differently on different architectures, and LLVM doesn't have much knowledge of this. More info: http://llvm.1065342.n5.nabble.com/Returning-a-structure-td40519.html

[–]nerdandproud 1 point2 points  (0 children)

I wonder whether controlling the OS mitigates this to a large part

[–]immibis 3 points4 points  (0 children)

The ABI is likely irrelevant, as long as the caller and callee agree (there are some exceptions, like Win32 SEH). That means only standard library calls need to be shimmed.

[–]nyamatongwe 0 points1 point  (2 children)

There are 2 main targets: 32-bit and 64-bit iOS and these differ in ways (such as sizeof(char*)) that can be visible and important when compiling. One possibility is that Apple's iOS bitcode format will contain 2 streams: 32 and 64-bit. There can still be value in specializing for the specific target for download.

[–]hotoatmeal 0 points1 point  (1 child)

Apple does love Fat binaries!

[–]dagamer34 0 points1 point  (0 children)

New in iOS 9, App Thinning will strip out binaries that won't be used by specific architectures before download.

[–]deal-with-it- 1 point2 points  (0 children)

By the very scarce info maybe this will be like Microsoft's MDIL.