Skip to content
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

Performance and optimization improvements, changes to encoding #184

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Rob23oba
Copy link
Contributor

This pr replaces encoding.js with a more optimized version which works with a wasm module (or arraybuffer). Some formats were changed to accomodate this, e.g.: immediates are no longer encoded, e.g. [ Opcodes.i32_const, ...signedLEB128(x) ] -> [ Opcodes.i32_const, x ] which makes a lot of reading much more straightforward, the entire opcode is always in the first index, e.g. Opcodes.i32_trunc_sat_f64_s -> [ Opcodes.i32_trunc_sat_f64_s ]. Additionally, the backtrace system has been reworked to use binary search to find the correct instruction instead of searching everything. Because of the previous two changes, a lot of other code needed to be reworked in order to fit the new scheme. Also: block types in Porffor.wasm are now encoded as their name instead of their id and multi-value block types are also supported (e.g. [ Opcodes.if, [ [ Valtype.f64, Valtype.i32 ], [ Valtype.i32 ] ] ] which is encoded if f64 i32 -> i32 in Porffor.wasm). Because it bothered me there is also now a more proper way of doing constant evaluation with opt.js (giant table jumpscare) and optimizations relating to drop have been generalized (oh wow this so much more involved than before). (yeah I couldn't resist adding optimizations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant