Skip to content

Instantly share code, notes, and snippets.

@Quodss
Last active September 10, 2024 02:41
Show Gist options
  • Save Quodss/9127db152ababb88e011002fa3227f68 to your computer and use it in GitHub Desktop.
Save Quodss/9127db152ababb88e011002fa3227f68 to your computer and use it in GitHub Desktop.
urwasm TODO

Interpreter in Hoon

  • Change memory model: random access via (map page-number=@ page-array=@)
  • Revisit the model of block/loop/if and call/call_indirect execution: it appears that the current model causes unnecessary copies of the entire membuffer, slowing down the computation. So instead of cloning the core, interpreting an expression and back-propagating changes in the global state, I need to call an evaluating arm that will edit the global state in-place
  • Cache function fetching:
    • Have a gate fetch-operation within apply-instruction that takes term of an instruction as an argument and returns a number of operands to be consumed and a gate to be applied to the immediate arguments and consumed operands
    • Cache that gate
    • Fetching gate and operation gates must be defined outside of hwasm core
    • Use four letters for operators (shoudld speed things up since 4 letter term is a direct atom)
  • Floating point: verify roundings and such (iirc they are different in Wasm spec and default settings of ++rs and ++rd cores)
    • is it enough to change the settings?
  • add missing sections (import is the most important one)
    • add some gate examples with import section (printf, Nock evaluation)
      • Nock and Hoon evaluation would probably be enough for static stuff (printf with ~& directly)
      • choose subject for Hoon evaluation when calling a function or instantiating a module (a sort of permissioning)
    • add some thread examples with import section (scry, pass a card, set a timer)
      • add permissioning in a form of a filter for cards returned by Wasm module
    • (Rust) make a crate with functions that can be imported from urwasm
  • actually compute expressions for globals' values/data offsets
  • Rewrite the parser: length check, functional parsing (almost) everywhere
  • Add validation, move parsing and validation to wasm mark file to parse and validate at commit
  • Rewrite the interpreter: remove typechecks since they are redundant after the validation

Jetting

  • how wasm3 represents parsed module? when does it convert wasm instructions to its own bytecode? can I change parsed representation with the one in Hoon? (important for suspending the computation)
  • Softfloat in wasm3
  • Remove validation flag in the jet, add debug mode where traces are printed on crash from failed validation (to find the source of the discrepancy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment