Over a year ago, Adobe open sourced Tamarin, and there was much rejoicing.
As part of the source drop, Adobe included an actionscript compiler written in actionscript.
Fast-forward to now. Tamarin has evolved quite a bit, and the self-hosting compiler is a lot closer to being done. However, much like a mogwai fed after midnight, it has mutated from its cute AS3 codebase to a somewhat more alien ES4 state.
On the plus side, it still targets a vanilla AVM2, so there aren’t new weird opcodes to worry about. Yet, anyway.
Long story short, I’ve ported that stuff into an as3 library. It’s not done, and won’t be done until the es4 self-compiler itself is done.
It works though, whenever it doesn’t crash. You can try it here.
It has a lot of potential too. Let me count the ways:
- Dynamically compiled code within the flash player. eval() is possibly the most misused command in JS, but you can do some really neat stuff with it. Plus, the flash VM lets you segregate code rather well, so you can eval() code without chancing a clobber of your existing code. With a bit more investigation, it might even be possible to run untrusted code safely. Maybe.
- Letting web apps accelerate themselves by eval()-ing themselves in the flash VM. It’d require proxying the browser DOM through ExternalInterface and the Proxy class, which might negate some of the speed benefits. Still, it could probably beat up every other implementation on a SunSpider benchmark, and take their lunch money too.
- A poor man’s ScreamingMonkey. If esc ever gets to support the full set of ES4 proposals, then every non-ES4 browser out there that already has Flash could suddenly run ES4. That’s a nifty thought right there.
Anyway, that’s a way off. For now, I’ll try and backport esc updates on a semi-regular basis.
Also, crypto people, I haven’t forgotten you. I’ll put a better ASN-1 parser and a bunch of contributed bug fixes out soon.
Oh, and happy new year!Explore posts in the same categories: flash, actionscript, eval