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

separate module decoding state/methods into their own struct #226

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

marler8997
Copy link
Contributor

@marler8997 marler8997 commented Jun 11, 2024

This change moves the state (fixed buffer stream) and methods (decode/read) around decoding a module into a separate struct Decoder so they can be discarded after the module is decoded.

Along with this change, I also fixed a few more things I noticed along the way:

  • removed version field from Module (unused)
  • combined common code between min/max limit cases
  • rename module field to wasm_bin on Module struct to distinguish the wasm binary buffer from the higher level module object
  • fixed readSlice so it doesn't call skipBytes which unnecessarily
    copies the entire slice and throws it away
  • add .zig-cache to .gitignore for zig 0.13.0

* remove fixed buffer stream from Module and all the decode/read functions
  and move then into a separate Decoder struct so they can be discarded
  after decoding is complete
* removed version field from Module (unused)
* combined common code between min/max limit cases
* rename `module` field to `wasm_bin` on Module struct to distinguish the
  wasm binary buffer from the higher level module object
* fixed `readSlice` so it doesn't call skipBytes which unnecessarily
  copies the entire slice and throws it away
* add .zig-cache to .gitignore for zig 0.13.0
@malcolmstill malcolmstill merged commit ba53488 into malcolmstill:master Jun 13, 2024
17 checks passed
@malcolmstill
Copy link
Owner

Thanks for this @marler8997

@marler8997 marler8997 deleted the moduleDecoder branch June 15, 2024 13:58
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.

2 participants