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

Add simple translation step to internal ISeq #76

Merged
merged 24 commits into from
Apr 7, 2024

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Apr 7, 2024

Benchmark #1: ./.build/release/wasmkit-cli.main run /Users/katei/ghq/github.com/swiftwasm/tmp/Profiles/clock.swift.wasm
  Time (mean ± σ):     646.6 ms ±   6.1 ms    [User: 621.2 ms, System: 15.9 ms]
  Range (min … max):   640.4 ms … 661.3 ms    10 runs

Benchmark #2: ./.build/release/wasmkit-cli.branch run /Users/katei/ghq/github.com/swiftwasm/tmp/Profiles/clock.swift.wasm
  Time (mean ± σ):     608.7 ms ±  12.1 ms    [User: 585.6 ms, System: 12.1 ms]
  Range (min … max):   598.4 ms … 631.3 ms    10 runs

Summary
  './.build/release/wasmkit-cli.branch run /Users/katei/ghq/github.com/swiftwasm/tmp/Profiles/clock.swift.wasm' ran
    1.06 ± 0.02 times faster than './.build/release/wasmkit-cli.main run /Users/katei/ghq/github.com/swiftwasm/tmp/Profiles/clock.swift.wasm'

Improvements

  • Extract WasmParser into separate module
    • The new Parser is visitor-based to be friendly to stream translator
  • Add InstructionTranslator, which translate parsed instructions into internal VM instruction sequence
    • Translate while collecting popCount/copyCount on value stack
    • This idea is inspired by sidetable design of Ben L. Titzer's work1
  • Remove control label information from execution state

TODO

Footnotes

  1. Ben L. Titzer. 2022. A fast in-place interpreter for WebAssembly. Proc. ACM Program. Lang. 6, OOPSLA2, Article 148 (October 2022), 27 pages. https://doi.org/10.1145/3563311

@kateinoigakukun kateinoigakukun merged commit 8956e15 into main Apr 7, 2024
6 checks passed
@kateinoigakukun kateinoigakukun deleted the katei/flatten-opcodes branch April 7, 2024 12:15
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