Clever Adobe compilation trick sneaks Flash apps onto iPhone
Up to now, Apple's prohibition against anyone's runtime modules from appearing on its iPhone without authorization has been one of two central reasons that Adobe's Flash video and Flash platform have not made their appearance there -- the other reason being simply that Steve Jobs doesn't like it.
But at its annual MAX developers' conference in Los Angeles this week, Adobe's engineers unveiled a surprise: It's planning a public beta release of Flash Professional CS5 that will go through a new and unique set of hoops to enable developers to write or export apps built for the Flash runtime, to run on the iPhone as native apps. The new Flash Pro will use a mechanism for Flash application developers to deploy their apps on the iPhone anyway, even without the Flash mobile runtime.
That mechanism is the evolution of an academic project -- namely, the work of the Computer Science Dept. at the University of Illinois-Champaign. It's an open source project called Low-Level Virtual Machine (LLVM), and it's a way to effectively bury the compilation element of a language interpreter below the application layer where the runtime module normally resides, deep into object code.
"On the iPhone, we don't have a browser plug-in. Flash Player 10.1 isn't available, and you can't browse to this application and just start using it," explained Adobe engineer Adrian Ludwig, in a company video released during MAX.
"So what developers have to do is go inside of Flash Pro, and they have to export that project to a native application for the iPhone. While you're using Flash Pro to build these applications, it's being converted from SWF down to IPA, which is the native file for applications on the iPhone. So it's installed -- there's no runtime interpretation, there's no JIT. These are applications that are built according to all of the rules that have been established in the iPhone developer program."
Seven Flash games have already been developed for iPhone, and have begun distribution this week through Apple's App Store -- a clear indication that these apps do follow Apple's rules.
As Aditya Bansod, another Adobe engineer, blogged on Monday, "We created a new compiler front end that allowed LLVM to understand ActionScript 3 and used its existing ARM back end to output native ARM assembly code. We call this Ahead of Time (AOT) compilation -- in contrast to the way Adobe Flash Player and Adobe AIR function on the desktop using Just in Time (JIT) compilation. Since we are able to compile ActionScript to ARM ahead of time, the application gets all the performance benefits that the JIT would offer and the license compliance of not requiring a runtime in the final application."
The downside of this architecture is that the hoops Apple made Adobe jump through, bypass the normal route an iPhone app would take to communicate with the iPhone itself. As a result, much of the iPhone API is inaccessible from within an exported Flash app; although Flash evangelist Mark Doherty presented an initial list of iPhone features that will not work in a Flash app, one gets the distinct feeling that it's not yet even an exhaustive list.
Which limits the class of Flash apps one can port to the iPhone to mostly games; and indeed, that's the focus of the first seven such apps that Adobe is demonstrating. As for rerouting Adobe's ingenious detour closer to the phone itself in the future, Doherty pointed to a future version of the company's Flex Mobile Framework, whose code-name "Slider" gives you a hint as to where it's directing at least one offshoot of its platform.