wasm-utils/README.md

26 lines
1015 B
Markdown
Raw Normal View History

2017-05-30 15:06:46 +04:00
# wasm-utils
2017-04-12 20:52:01 +04:00
2017-05-30 15:06:46 +04:00
Collection of WASM utilities used in Parity and WASM contract devepment
2017-04-12 20:52:01 +04:00
2017-05-30 15:06:46 +04:00
## Symbols optimizer (wasm-opt)
2017-04-12 20:52:01 +04:00
```
2017-05-30 15:06:46 +04:00
cargo run --release --bin wasm-opt -- <contract.wasm>
2017-04-12 20:52:01 +04:00
```
2017-05-30 15:06:46 +04:00
This will optimize WASM symbols tree to leave only those elements that are used by contract `call` function entry.
2017-04-12 20:52:01 +04:00
2017-05-30 15:06:46 +04:00
## Gas counter (wasm-gas)
2017-04-12 20:53:31 +04:00
2017-05-30 15:06:46 +04:00
For development puposes, raw WASM contract can be injected with gas counters (the same way as it done by Parity runtime when running contracts)
2017-04-12 20:52:01 +04:00
2017-05-30 15:06:46 +04:00
```
cargo run --release --bin wasm-gas -- <contract
```
## Allocators substiution (wasm-ext)
Parity WASM runtime provides simple memory allocators, if contract requires. When relied on this allocators, WASM binary size can be greatly reduce. This utility scans for `_malloc`, `_free` invokes inside the WASM binary and substitutes it with invokes of the imported `_malloc`, `_free`. Should be run before `wasm-opt` for better results.
All executables use corresponding api methods in the root crate and can be combined in other build tools.