https://github.com/xiaoxiaojx/wvm
A toy WebAssembly virtual machine.
https://github.com/xiaoxiaojx/wvm
wasm webassembly
Last synced: about 2 months ago
JSON representation
A toy WebAssembly virtual machine.
- Host: GitHub
- URL: https://github.com/xiaoxiaojx/wvm
- Owner: xiaoxiaojx
- Created: 2023-10-04T14:17:18.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-04T14:17:57.000Z (about 2 years ago)
- Last Synced: 2025-03-31T22:48:24.426Z (7 months ago)
- Topics: wasm, webassembly
- Language: C++
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# wvm
A toy WebAssembly virtual machine.
> It is mainly used for learning 📖 ✍️, Inspired by [twvm](https://github.com/Becavalier/twvm) and [WebAssemblyToolkit](https://github.com/yaozhongxiao/WebAssemblyToolkit).## Getting Started
```bash
make build && ./wvm ./hello-world.wasm
```
```bash
-> parse
-> parseMagicNumber: [ 0 97 115 109 ]
-> parseVersion: [ 1 0 0 0 ]
-> parseSection
-> parseSectionId: 1
-> parseSectionId: 3
-> parseSectionId: 7
-> parseSectionId: 10
-> instantiate
-> func
-> entryFuc: add
-> execute
-> call: 0,paramCount: 2
-> local.get: 0
-> local.get: 1
-> call: 1,paramCount: 2
-> local.get: 0
-> local.get: 1
-> op.I32Add
-> x: 2,y: 1
-> ret: 3
ret: 3
```