-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use computed goto in the VM #461
Comments
@Arcnor What do you think about this? |
You mean, removing the computed goto and relying on the compiler? From what I've seen, the compiler might do something like that, but it's not controllable nor guaranteed, so maybe you want to keep the existing behavior until tests are done? After my changes, testing if this is getting done by the various compilers should be easy. |
That said cleaner code should probably prevail, given this VM probably doesn't need the highest performance anyway... |
Actually, the VM needs high performance. I've been even thinking about implementing JIT compilation. I'll of course do benchmarks and tests first to be sure the compiler uses computed goto, that's why I've given this issue the lowest priority. |
Isn't this project meant to be used with Scratch, the learning platform? For those kind of projects I think even a normal interpreted loop will suffice, unless you have some special targets in mind or something... Writing a JIT is possible, but a project on its own (like |
There are many cases where performance is needed, for example in 3D projects. Check these out, for example: TurboWarp is a Scratch mod that compiles Scratch scripts to JavaScript. These projects would be much slower (or not run at all) if you tried them in the original Scratch VM. See https://docs.turbowarp.org/how I don't think I'll ever be able to beat TurboWarp with this project, but I believe it's possible with JIT compilation. |
I see, so very special projects, that's definitely not what I think of when I think about Scratch 😄 . Very cool nonetheless! And for sure, beating V8 is probably very difficult if not impossible, although your surface area might be much smaller, so YMMV. Let me know when you open the issue to work on that, I'd be interested in following, and maybe even contribute if time permits. |
Closing because the bytecode VM is going to be removed (#574). |
src/engine/virtualmachine_p.cpp
Compilers will turn the switch statement into computed goto automatically.
The text was updated successfully, but these errors were encountered: