Slashdot Log In
Adobe Releases C/C++ To Flash Compiler
Posted by
samzenpus
on Wednesday November 19, @06:47PM
from the transmutations dept.
from the transmutations dept.
SnT2k writes "Adobe recently released the beta version of Alchemy which compiles C/C++ code into AS3 bytecode (which runs on AVM2) that can run on the Flash or Flex platform and boasts increased performance for computationally-intensive tasks (but still slower than native C/C++). It was demonstrated last year during the Chicago MAX 2007 to run Quake. A few months later it has been demonstrated to run a Python interpreter and Nintendo Emulator. One interesting tidbit is that the thing is built upon the open source LLVM Compiler Infrastructure."
Related Stories
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading... please wait.

Still no contact info, so I'll post here... (Score:5, Interesting)
I've been interested in this idea since the presentation at the LLVM dev meeting. I'd be interested in extending clang to use the native ActionScript object model for Objective-C objects, and adding a GNUstep back end to use the native flash drawing primitives so that we can easily port Cocoa apps to run in a browser. Unfortunately, there was no contact information listed anywhere on the presentation or on this site, so I haven't been able to get in touch with anyone at Adobe Labs about this.
Reply to This
Re:Still no contact info, so I'll post here... (Score:5, Funny)
Reply to This
Parent
Re:Still no contact info, so I'll post here... (Score:5, Funny)
Why does everybody as for a pony, but not a stable to keep it in, or food to keep it alive?
Does Pony meat taste that good?
Reply to This
Parent
Re:Still no contact info, so I'll post here... (Score:5, Interesting)
I don't know first hand, but apparently horse meat is supposed to be very tasty. "The F-Word" (Gordan Ramsay cooking show in the UK) did an episode where they prepared horse meat, talked about the history of horses and talked to a farmer that raises them for their meat etc. It was really interesting.
In one part they were handing out samples near a horse-race track (they do that with lots of "exotic" foods. Go out into public and get people to try it and give their reactions etc.) and got asked by the police to leave. Not relevant but I thought it was funny.
-1 OT
Reply to This
Parent
Re:Still no contact info, so I'll post here... (Score:5, Informative)
horse meat does taste good, low fat and kind of sweet. i think the closest analogy to horse meat is ostrich meat. i would prefer a horse steak to a beef steak every time.
just don't try the mongol horse salami. it doesn't taste very good and the meat sticks between your teeth.
Reply to This
Parent
Re:Still no contact info, so I'll post here... (Score:5, Funny)
Why does everybody as for a pony, but not a stable to keep it in, or food to keep it alive?
Does Pony meat taste that good?
Because when it's a pony from Adobe you know that it will soon crash and die, and it wouldn't know what stable is anyway.
Reply to This
Parent
Re:C/C++ Trojan Horse (Score:5, Funny)
Reply to This
Parent
It has been said (Score:5, Interesting)
This seems to further cement flash as a worthy application environment, especially given the perceived problem in flash appeared to be its inefficiency.
Looking forward to better flash games... (Or perhaps not if im not wanting to procrastinate).
Reply to This
Re:It has been said (Score:5, Insightful)
I'd be willing to wager that you've used responsibly designed Flash applets before and simply assumed them to be cleverly implemented Javascript because they didn't explode all over the screen in a cavalcade of light and sound.
Nothing about Flash compels the developer or designer to author something "garish and obnoxious" any more than Javascript or CSS do. Its versatility merely allows for greater abuse.
Reply to This
Parent
Virtualize Everything (Score:5, Funny)
Wow, I can compile my C/C++ code to run on a slow virtual machine instead of a native cpu architecture.
I haven't had this much fun ever since I discovered the java Virtual Machine written in java.
It brings back the heady days of my 8088.
Reply to This
Re:Virtualize Everything (Score:5, Insightful)
If you have a complete C++ application that runs fine on native code, then obviously this would be silly. But if you bothered to RTFA, you know that this serves a simple and obvious purpose: reuse. If you need rendering code for your Flash game, and the best code available is in C or C++, it's a lot easier to just recompile the code than it is to hand-translate the code into ActionScript.
Reply to This
Parent
Re:Virtualize Everything (Score:5, Informative)
http://jikesrvm.org/ [jikesrvm.org]
Reply to This
Parent
Re:Virtualize Everything (Score:5, Insightful)
There's nothing inherently bad about the concept. It's in fact quite interesting to have the JVM optimise itself along with the programs running inside it. And while the JikesRVM, being a research VM, does not run as fast as Sun's VM or IBM's commercial VMs, it's not that slow either (definitely not as slow as you'd first think of a JVM implemented in Java).
Reply to This
Parent
Re:Virtualize Everything (Score:5, Funny)
JikesRVM has a small "bootstrap" VM that is used to get the main VM going, but after startup everything is run in the main VM (including the main VM itself).
I am getting mental stack overflows just trying to parse that.
Reply to This
Parent
Re:A Cluster-Aware Distributed Java Virtual Machin (Score:5, Funny)
http://www.google.com/url?sa=t&source=web&ct=res&cd=5&url=http%3A%2F%2Fcs.anu.edu.au%2F~Peter.Strazdins%2Fseminars%2FdJVM.pdf&ei=FK0kSafSAZSo0gScxs3FDw&usg=AFQjCNHrPDWFanLbyUu3kX-lEkzZrWR6bw&sig2=jcMo0CIWzGg_nZVLvDHpxA
My first thought on reading this post was that the super-long Google url WAS the cluster-aware distributed virtual machine.
So, how long until Google reveals its next project: Compile C++ to a Google URL, and visit the URL to see your program running?
Reply to This
Parent
More details (Score:5, Informative)
You post your ideas for Adobe here: http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=72&catid=755&entercat=y [adobe.com] These forums are closely watched by the flash player team.
Reply to This
Designflow -- Very Cool (Score:5, Interesting)
More details here: http://www.llvm.org/devmtg/2008-08/ [llvm.org] (Look for the topic - Flash C Compiler: Compiling C code to the Adobe Flash Virtual Machine)
While scrolling down looking for the Adobe talk, I found this:
Designflow: using LLVM to compile to Hardware - This project uses LLVM to compile code to a mixed hardware and software implementation. This detects pieces of programs that may be efficiently compiled to VHDL and synthesized them onto an FPGA. The rest of the program is compiled to PowerPC code and uses to drive the FPGA. The system automatically handles data migration and other handshaking between the two systems.
Waaaayyyy more interesting than LLVM for flash. This is cool!!!
Reply to This
Parent
Increased performance (Score:5, Interesting)
Increased performance over what exactly? Is there some other 'slower' bytecode that the VM runs? The summary fails to mention this. I don't see how compiling C++ to the AS3 bytecode would be any faster than compiling some Flash language to AS3 bytecode, or writing AS3 bytecode directly. I assume it is the AS3 bytecode itself that is faster, in which case the 'compiling C++' part is irrelevant to the increased performance.
Reply to This
Re:Increased performance (Score:5, Interesting)
The point is that the LLVM project can do far more optimization before being compiled to bytecode than Adobe's ActionScript compiler is doing, and as a result it runs faster.
Yes... Adobe's ActionScript compiler sucks at generating bytecode for their own VM, and even they admit it.
Reply to This
Parent
This is not where Adobes priorities should be! (Score:5, Interesting)
The Flash VM is slow beyond belief when getting into large data-structures, event its native array parsing is incredibly slow.
Object instantiation is slower than molasses. We were averaging about 7 seconds to instantiate about 500 fairly complex objects that in most any other language, compiled or interpreted would have easily been created in a thousandth of that time.
The Flash VM's garbage collection is perfectly incapable of doing anything that involves long application run-times and leaks memory all over the place, even inside its native low-level components. It got to the point that even doing any proactive cleanup in our code was totally fruitless and I am sorry to add that a lot of the proactive steps we were taking have been left by the wayside because it is utterly hopeless to release all the memory you have taken back to the system.
Loading an SWF inside another SWF and then disposing of it will not stop the loaded SWF's playback and it does not release it from memory. Instead of Adobe fixing this obvious bug they just added a different method in Flash 10 called "unload and stop" or something like that. This requires anyone who wants to fix this issue to go back and refactor their code!
There are also numerous inconsistencies between applications that run in Flash and those that run in AIR, even though the code base is the same and the idea is that you do not have to change any obvious code to make it work in one platform or another.
Even flashes most basic function, doing vector drawings and animations fails horribly under load. We have had to hack and jury-rig numerous fixes in to compensate for Flash's seemingly random graphical glitches.
If Adobe wants to be taken seriously as a application platform developer, especially one that is used on the desktop they need to get their shit together because right now it feels like a childs toy or half-assed attempt to enter a new market.
Unfortunately the project, the client, and the management have chosen this path for us and we are stuck with it so I really hope that Adobe gets it together because its been a royal pain doing this sort of work on their platform.
Reply to This
Re:This is not where Adobes priorities should be! (Score:4, Insightful)
Reply to This
Parent
Re:This is not where Adobes priorities should be! (Score:5, Insightful)
I think I see your problem right there... there is nothing like using the right tools for the job, and this is nothing like using the right tools for the job. ;-)
Reply to This
Parent
Re:This is not where Adobes priorities should be! (Score:5, Interesting)
Yes, many times, and no I do not think my code is ever perfect, or even near perfect, but the proof is in the pudding, you can make very simple test cases and see very obvious drawbacks using just their code/UI components.
One of the problems with working with Flex is that sometimes you have to do things that seem incredibly retarded to get things done. Look at the extensive use of the callLater method in a lot of the Flex SDK code. This method basically says "ok things aren't done, so do it later." Not only does this seem to just patch a problem with not correctly sequencing your methods to fire when they are able to, but it creates huge memory leaks and is horribly hard to debug as you rarely can see past the point of the callLater in the stack.
This reminds me of another problem, in the fact that you can not catch run-time errors at the "root/base" level of the Flash/Flex/AIR application, and even better, if you do not have a debug version of Flash player (and forget it in AIR) then it just completely ignores the error and continues on as if nothing has happened. This then causes Flash to start chucking random errors and glitches that might get caught in your own try-catch blocks much, much later, and you will find that code that works perfectly under every imaginable situation is now glitching with really no known cause. Debugging can be quite the nightmare in Flash.
Reply to This
Parent
Re:Quake. Quake for fucks sake! (Score:4, Interesting)
Reply to This
Parent
A good Javascript isn't all that slow (Score:5, Interesting)
Here are some basic timings I made just to give a rough feel for the relative speeds (don't read too much into them). The first entry provides the timings for C, which is obviously compiled, purely as a basis for comparison with the scripting languages. Note that the times for C are in milliseconds, while the rest are in seconds, lower is better:
Execution times for recursive F/P factorial(n) to
Langs @ 2008 Times: n=1 n=170 difference
C 0.000 ms 0.090 ms 0.090 ms
Lua 0.001 s 0.005 s 0.004 s
Parrot-opt/iterative 0.013 s 0.018 s 0.005 s
Parrot/iterative 0.014 s 0.019 s 0.005 s
V8-Javascript 0.007 s 0.013 s 0.006 s
Ocaml 0.022 s 0.029 s 0.007 s
Python 0.013 s 0.027 s 0.014 s
Parrot-opt/recursive 0.013 s 0.029 s 0.016 s
Mozilla-Javascript 0.001 s 0.018 s 0.017 s
Perl 0.002 s 0.021 s 0.019 s
Nickle 0.031 s 0.065 s 0.034 s
Parrot/recursive 0.014 s 0.056 s 0.042 s
Ruby 0.041 s 0.095 s 0.054 s
Lua_on_Parrot 0.303 s 1.314 s 1.011 s
Although every scripting language is still at least some 50 times slower than compiled C, interpreters and language VMs in general have been improving steadily over recent years, and Javascript in particular is getting a lot of attention now, with more optimizations in the pipeline from all the major players.
The gap will shrink, guaranteed.
[Sorry about the Code posting mode, it's not very easy on the eyes
Reply to This
Parent