Thursday, June 18, 2015

Feature: Why Macs will Get ARM'd - Interstitial 2 - Bitcode

In previous posts, I addressed how Apple's complete ownership of the development stack is moving it inexorably into a position where it is free to do anything it wants with respect to the CPU architecture and instruction set, all transparently to customers and developers.

Some previous entries in this continuing series:

A continuing exploration of the likely future of the Mac:

Part I: Why Apple is Motivated
Part II: Why ARM is a Better Solution for Apple
Why Macs will Get ARM'd - Interstitial 1 - The A8 Datapoint

As I've stated before in various forums, Apple's complete control of the development and distribution stack would enable them to create ARM processors that need not hew completely to the ARM architecture or instruction set.

The vast majority of programmers targeting Apple devices code in either Swift or Objective-C, two languages that Apple essentially controls.  This has allowed Apple to add various language features that it finds beneficial to supporting its products.

Apple also controls the IDE, namely Xcode, which allows it to easily add meta-programming features like storyboard interfaces and the like.

Apple also controls the compiler, LLVM, which is designed to compile the (mostly) human-readable Swift or Objective-C to an Intermediate Representation, and then the Intermediate Representation is turned into the actual assembly language instructions needed for the target device.

Finally, Apple designs its own processors (the A- and S-series) for its watches and phones.

If Apple wants to add some hypothetical new hardware capability, like the ability to treat data streams as fully encrypted up until loaded into the on-chip data cache, and they want to add new instructions to do so, there's nothing stopping them.

Up until now, however, each time they added an instruction set variant to the mix, Xcode was forced to output fatter and fatter binaries, to target each possible device that the code could run on.

Enter the App Store and Bitcode.

For iOS 9, Apple has announced "Slicing."   The general idea is that instead of the developer uploading complete fat binaries containing object code executable on each target device, only the LLVM intermediate representation, or "bitcode," is uploaded to the App Store.  Then, when a customer wants to buy or download an app, Apple's App Store back end provides the appropriate executable, compiled by Apple, for that device.

This is a huge development.  Taken to its logical conclusion, this new capability allows Apple to change its CPU in any manner it wishes, at any time, whether or not the changes are compatible with previously compiled software.  This may also be the first step to the eventual ARM'ification of Mac, as well.

1 comment: