It's a very cool project I've thought about gettinng involved with. My company has a number of complex flash games that will not initialize in shumway, but for toys and small apps it works about half the time -- and that's cool! So far, when it works, performance is about 3x slower.
I work on Shumway, and we would love to get more complex Flash games running. Would you and your company like to help our team get these games running? Performance is a hit or miss, sometimes we can be really fast, sometimes really slow, it all depends on either:
1. We haven't implemented some feature well enough.
2. We can't implement a feature in JavaScript/HTML5 and we have to emulate it in a very slow way. In these cases, we can either improve the Web Platform to support these features natively, or work with various game developers to avoid using them.
We're a small dev team but I'm happy to help out. I've submitted code to moz-central before, but I noticed shumway is in anpther repo. What type of help did you have in mind?
Could someone help me understand the logic behind this project?
Actionscript runs in a VM, that's native code. It seems like Mozilla's argument is that the AS VM is buggy and, thus, is/was/could be exploited often, so it's a security liability.
Their solution to this problem (as far as I understood) is to interprete the SWF bytecode using JavaScript/HTML5, because JavaScript runs in a sandbox.
Isn't anyone concerned that this is not the best solution to the problem? What's the difference between bugs in the AS VM and bugs in the JS VM? The JS VM is native code too, I don't see anyone rushing to replace it.
If the JS VM is more mature, then this is just a matter of getting the AS VM to that maturity level. If someone wrote clang while gcc existed for many years, why can't Mozilla focus their efforts on writing a better AS VM, instead of writing an emulation layer?
Given that both AS and JS are ECMAScripts, why can't AS be compiled in a way that allows it to run on the JS VMs?
If the bytecode generated by the AS compiler doesn't match what a JS VM can execute, then, since the AS bytecode will necessarily mimic features available in the language (and the languages are similar), why can't we translate the AS bytecode into JS bytecode?
> If the bytecode generated by the AS compiler doesn't match what a JS VM can execute, then, since the AS bytecode will necessarily mimic features available in the language (and the languages are similar), why can't we translate the AS bytecode into JS bytecode?
That's essentially what Shumway does. Unless things have significantly changed over the last year when I last looked at it, Shumway's AVM2 implementation is a JIT that compiles ActionScript to JavaScript (and thereby produces JS bytecode by going through "eval"). The tricky thing is that, because of extra features that ActionScript has that JS doesn't (namespaces, most notably) it has to speculate and recompile as needed to get good performance. So Shumway isn't an ahead-of-time static JIT, but it is a dynamically recompiling JIT.
We do in fact translate AS (AVM2) bytecode into JS source. We can't target JS bytecode because we would like Shumway to run on every browser, not just Firefox. Maintaining one JS VM is a lot easier than dealing with two. Although it is fairly tricky to emulate AS features in JS, it's significantly easier than rewriting / maintaining a VM like Tamarin.
It may be possible to translate Flash bytecode to JavaScript, but an interpreter will almost always be more accurate. In this particular case, being accurate first is important. Performance can be fixed later by adding a JIT-like mode.
Shumway runs in every browser, including IE. The extension however is Firefox-only, but it should be easy to make it run in Safari or Chrome. We're just not familiar enough with those code bases to do it ourselves. It involves some intimate knowledge about how to intercept Flash player initialization.
Is it easier if Flash isn't installed? Because I don't have Flash installed at all, which is why I'm interested in Shumway. I have Chrome installed purely to use when I need Flash support.