DIGG IT!
Published
Tuesday, February 26, 2008
at
1:44 PM
.
At
MAX 2007 we showcased an internal project called "C/C++ to ActionScript Compiler" at the sneaks and Kevin Lynch mentioned the
project at Engage 2008 yesterday. The project is a cross-compiler for ActionScript allowing any C or C++ code to run in
Adobe Flash Player or
Adobe AIR. The project has some interesting implications for extending
Adobe's platform in terms of legacy code, programming languages, and other open source code libraries. The key is that many other programming languages are built atop C/C++ to be more specific:
Java,
Python,
Ruby,
PHP,
Lua,
Perl,
C# (Mono),
JavaScript, and many more...
Part of this implementation includes a pattern in ActionScript that allows for "green threading" that supports executing synchronous code in the asynchronous ActionScript virtual machine. The work done here is quite groundbreaking and has highlighted quite a few performance improvements in the current virtual machine while expanding the capability of the platform.
Like many organizations
Adobe has lots of legacy C/C++ code ranging from PhotoShop filters, to PDF renderers, to readers and writers of every file format in existence, font libraries, to very complex vector renderers, and text layout code. Beyond Adobe there are many open source libraries that could be leveraged as components as well. The big thing for me is that these are not ports of these libraries, they run identical to the original source code down. For example the behavior of Python in Flash Player is identical to
C-Python vs the ported behavior under the
IronPython and
Jython projects. The goal here is to bring lots of these legacy assets, code libraries, and languages into Flash Player and Adobe AIR perfectly so that any developer can leverage them cross-platform to build software. It would not shock me to see some of these components added into the Flash Player component cache so that they essentially are built into the player on first use.

As an example of the complexity of this project, the engineers ported the C++ version of Quake 1 engine into Flash Player and it worked perfectly and performed well. It is an extreme case but showcased the potential of this project.
To set expectations this project is Adobe internal at this time. It will be interesting to watch how this evolves over time and how much richer Adobe Flash Player and Adobe AIR become as software platforms. We are working on some game changing things, stay tuned!
Cheers,
Ted :)
looking forward...
Whoa.
Are you saying that I could potentially write a socket server or P2P client that runs on AIR?
Python in Flash Player.....:O
Java, Python, Ruby, PHP, Lua, Perl, C# (Mono), JavaScript, and many more...
AND
More importantly AS2
So, where for is the AS2 machine compiled in AS3?
I'm guessing you guys have the source for that one :)
You know failing to fully support legacy programming languages is something that Microsoft does. You're not just like them are you?
Very impressive if pure C/C++ actually compiles and works with reasonable performance.
Ted, doesn't this platform-specifity kill the whole idea of cross-platform-ness, because now it is not entirely clear what dependencies are to external platform-specifc libraries. I thought that was one of the biggest advantages of Actionscript, write once (mostly) works anywhere AS is (mostly).
I realize Adobe probably wants to use it to decouple front- from backend development, but it feels dangerously close to a defragmentation of the whole Flash platform
I think my heart skipped a beat when I read this post. Thanks to Adobe, the 21st century will be excellent for developpers.
I guess it's Quake I not III
Quake 3 or 1?
Or WebKit in the Flash player so I can stop developing my own xhtml renderer for Flex...
It seems interesting. I saw the video of Quake 3 running on the flash player and it was really smooth.
The tools are able to compile targetting the actual flash player or the new one ?
Or do them simply translate code to AS3 ?
very interesting :)
but what about a small C/C++ lib or command-line tool which need to use a specific system access that flash or AIR can't access ?
ok it's internal, you can't give use details ..ok
is this tool would ever become non-internal :) ?
Would the source C code need to be pure C -- free of framework calls and OS specifics?
The engine was Quake 1. Post has been corrected.
Ted
Supporting gcc's Objective-C?
In the videos, code like this can be seen:
var xslPtr:int = __allocString( xsl.toString() );
var resPtr:int = __call(machineC, xmlPtr, 0 );
var retStr:String = __stringFromMem( resPtr );
For one, this makes it seem like the legacy code is 'embedded' into the Flash file, instead of truly cross compiled. Does this technology actually compile C down to AVM2 bytecode? It'd be great to have this elaborated on. :)
Also, these are quite low level calls. Manipulating pointers like this seems pretty unsafe. This seems opposed to Flash's traditionally strict security policies! :) -- not to mention other's concerns about platform dependence.
In any case, this is exciting, albeit odd, step for Adobe. :) I look forward to see what comes from it!
Wow !! This is amazing!
I'm not sure but it kinda looks like Director's Xtras... no?
I wanna see the VIDEO!
I cant imagine it, and hard to believe it. What about Performance?
You do a revolution...
This is really cool! But the real question is: WHERE CAN I FIND THAT .AIR PACKAGE?! ;) And can you compile it with the grapple hook mod?
Beau
Don't get excited too quickly, remember these comments may be searched in 20 years and you can make people laugh by your pre-mature excitations (remember the 80s?).
Right now a simple youtube video player in flash is a bloody cpu eater in linux, never mind porting quake and playing it in flash under linux.
The problem of flash player high cpu waste has been around for ever and clearly adobe is only loyal to m$.
That is all great, but in the mean time I have a bunch of Java code running on the server that I would like to leverage on the client without running a localy hosted java server. Is there any way to load java libraries from AIR. I don't want to have to port my Java code to AS so I can run it in the client, that would be nuts!.
Sounds great, but for example what if I wanted to write an app in Java, but I wanted to make calls to an ActionScript library such as Away3D or Papervision, will this be possible?
agree with XIX
where is the compatibility for AS2 under AIR?
i'd love to use AIR as a more powerful / stable desktop projector, using some online data , for apps that need it .... but don't think i can .... without porting lots of code from AS2 to AS3?
no efficiencies there ...
Very impressive if pure C/C++ actually compiles and works with reasonable performance.
Very impressive if pure C/C++ actually compiles and works with reasonable performance.
Or WebKit in the Flash player so I can stop developing my own xhtml renderer for Flex...
Wow, this seems really interesting and could potentially boost the size of the AS3/Flex/Air developers community.
Very impressive if pure C/C++ actually compiles and works with reasonable performance.
Any update on this?
It's a project called Alchemy on Labs now...http://labs.adobe.com/technologies/alchemy/