Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
6f86ac7
refactor!: A major refactoring of rwasm compiler and executor (#9)
dmitry123 May 8, 2025
3fa8734
fix: re-export legacy crate
dmitry123 May 8, 2025
c4560aa
fix: fix no_std compilation issues
dmitry123 May 8, 2025
7a3a37f
fix: fix e2e test for 32 bit mode
b33ngo May 12, 2025
b3fb5b5
feat(svm): increas initial global memory 2 times (#11)
bfdays May 13, 2025
fb33c35
Feat(svm): put increased N_MAX_MEMORY_PAGES under the feature (#12)
bfdays May 13, 2025
3f47f74
fix: enable tracer without metadata
dmitry123 May 14, 2025
523708a
feat: add snippets for i64 ops for add/sub/div/mul
dmitry123 May 14, 2025
4546163
feat(i32): add emitter for karatsuba i64 mul
dmitry123 May 15, 2025
c314b61
chore: add benchmarks
dmitry123 May 15, 2025
4e2a5d4
feat(compiler): the new version of rwasm compiler
dmitry123 May 18, 2025
99b88ad
Merge branch 'devel' into next
dmitry123 May 18, 2025
8003d07
chore(benchmarks): update input value from 47 to 43
dmitry123 May 18, 2025
8f63516
fix: migrate e2e testing suite to the latest rwasm
dmitry123 May 22, 2025
73a07ec
fix: fix a lot of compilation issues, don't store entrypoint offset (…
dmitry123 May 22, 2025
3ae40bb
fix: bug with checking func refs, add more i64 snippets with tests, a…
dmitry123 May 24, 2025
7fd1602
ci: fix running tests in ci/cd
dmitry123 May 25, 2025
ddc631e
ci: fix running tests in ci/cd
dmitry123 May 25, 2025
2604c07
ci: install rust toolchain
dmitry123 May 25, 2025
65e50d5
fix(benchmarks): remove unused tests and simplify logic
dmitry123 May 25, 2025
79f39a5
fix(benchmarks): handle wasm2wat errors gracefully
dmitry123 May 25, 2025
fecef14
refactor: elliminate func segment and source pc from rwasm module
dmitry123 May 25, 2025
bbc5d57
docs: reformat comments in RwasmModule for clarity
dmitry123 May 25, 2025
52baf74
fpu: integrated floating point operations on 32-bit stack size, disab…
dmitry123 May 26, 2025
81581cf
fix: signature calculation for indirect calls
dmitry123 May 26, 2025
47ac74b
refactor: remove unused types and drop_keep logic, replace rwasm erro…
dmitry123 May 26, 2025
c0b7cc7
refactor: remove OpcodeData and simplify instruction handling & encod…
dmitry123 May 26, 2025
22f3770
fpu: add conditional support for floating-point operations, remove ex…
dmitry123 May 26, 2025
54e8f76
refactor: untyped value now uses u32 bit
dmitry123 May 26, 2025
2e73a4c
refactor: implemented i64 operations inside instruction set
dmitry123 May 26, 2025
2ccc572
refactor: add i64 opcodes (add, mul, div_s, div_u, rem_s, rem_u, etc)…
dmitry123 May 27, 2025
d151eaf
fix: compilation fixes and an additional unsigned division test
dmitry123 May 27, 2025
7ba1559
refactor: decomposed i64 opcodes impls
dmitry123 May 27, 2025
dd26e6e
refactor: moved opcode emitters for dev/rem into separate files
dmitry123 May 27, 2025
5ae6e5d
refactor: improve vm executor, add wasm tests, and update benchmarks
dmitry123 May 27, 2025
8906113
feat: rework br table translation
b33ngo May 28, 2025
46b8115
fix: bug with clearing data/elem flags after exec, bug with sp memory…
dmitry123 May 28, 2025
02b95d0
Merge branch 'feat/compiler' of github.com:fluentlabs-xyz/rwasm into …
dmitry123 May 28, 2025
0d442c2
fix: fix error label resolving
b33ngo May 28, 2025
93f06c3
feat: new benchmarks including cached/no-cached modules, refactored &…
dmitry123 May 28, 2025
7ff46a6
Merge branch 'feat/compiler' of github.com:fluentlabs-xyz/rwasm into …
dmitry123 May 28, 2025
2bdd47d
refactor: reformat `br_table` target translation
dmitry123 May 28, 2025
8a19861
fix: simplify stack handling and update test execution
dmitry123 May 28, 2025
34bda80
chore: artifact cleanup, add codecov calculation
dmitry123 May 28, 2025
38d4777
fix: prevent Makefile crash on wasm2wat conversion failure
dmitry123 May 28, 2025
b6802f9
chore: add `grcov` dependency to coverage workflow
dmitry123 May 28, 2025
8976a4f
fix: improve lcov merging logic in Makefile
dmitry123 May 28, 2025
7b26bac
fix: update lcov generation and mark fuzz tests ignored
dmitry123 May 28, 2025
3037751
chore: rename GitHub workflow names for clarity
dmitry123 May 28, 2025
db4c01d
chore: add Codecov badge to README and update ignore list
dmitry123 May 28, 2025
cb76ab6
refactor tracing
nagatoism May 28, 2025
7550767
refactor tracer
nagatoism May 29, 2025
ad0b48d
add code and aux_value for opcode
nagatoism May 29, 2025
c812eda
fix: unignore `test_block` and update Makefile targets
dmitry123 Jun 2, 2025
8581cfc
refactor(tracing): tiny refactoring and compilation fixes of tracer
dmitry123 Jun 2, 2025
5e39d1c
Merge branch 'feat/compiler' into zkvm-tracing
dmitry123 Jun 2, 2025
be7feda
enable tracing
nagatoism Jun 3, 2025
89d0be1
fix some bug on tracing
nagatoism Jun 3, 2025
74a0271
add step func
nagatoism Jun 3, 2025
e0250c8
fmt
nagatoism Jun 3, 2025
98157cb
add post op record
nagatoism Jun 3, 2025
ee00d1b
add memory indexing
nagatoism Jun 4, 2025
8371f87
refactor: extract control flow and system ops
dmitry123 Jun 5, 2025
fc02485
add mem index
nagatoism Jun 5, 2025
ac90080
refactor(tracing): clean up tracing code and VM state usage
dmitry123 Jun 5, 2025
f8e9f38
Merge branch 'feat/compiler' into zkvm-tracing
dmitry123 Jun 5, 2025
e0ef410
fix: add serde for opcode
nagatoism Jun 5, 2025
e38ac79
fix: add serde for rwasmmodule
nagatoism Jun 5, 2025
0d0200b
chore(tracer): typo fixes
dmitry123 Jun 7, 2025
85eacf1
Merge remote-tracking branch 'origin/feat/tracing' into feat/tracing
dmitry123 Jun 7, 2025
8b55b90
fix: expose exec_instr api
nagatoism Jun 9, 2025
37939ef
fix: add serde for rwasmmodule
nagatoism Jun 9, 2025
1c9e8f9
fix:enable serde/derive for tracing
nagatoism Jun 9, 2025
25581cf
feat: new tracer
nagatoism Jun 10, 2025
678ccd5
Merge remote-tracking branch 'origin/devel' into feat/tracing
dmitry123 Jun 11, 2025
75dc414
fix(tracer): fix missing mut
dmitry123 Jun 11, 2025
4939fdb
fix(tracer): fix dump stack function
dmitry123 Jun 12, 2025
0c96aec
fix(tracer): fix trace calculation
dmitry123 Jun 12, 2025
392167a
fix: add serde for rwasmodule
nagatoism Jun 15, 2025
9255805
feat:add run step
nagatoism Jun 15, 2025
9acf7bc
fix: make tracer public
nagatoism Jun 17, 2025
463e058
fix: record memory when op is i32const
nagatoism Jun 17, 2025
39cbbc5
fix: record relative position for stack pointer
nagatoism Jun 17, 2025
082b0c7
Merge branch 'devel' into feat/tracing
dmitry123 Jun 18, 2025
cb97cf8
fix: fix ip go over when running snippet program
nagatoism Jun 19, 2025
8a3e60c
fix: fix tracing load and store
nagatoism Jun 23, 2025
f4ef8b4
merge devel
nagatoism Jun 23, 2025
71c93b3
fix: fix tracing local ins
nagatoism Jun 23, 2025
6e31303
feat: trace event data
nagatoism Jun 26, 2025
0aed613
feat:restore rwasm executor from relative ip
nagatoism Jul 8, 2025
88a50e5
Merge branch 'devel' into feat/tracing
dmitry123 Jul 8, 2025
81e2e9d
fix: make linker thread safe
nagatoism Jul 10, 2025
5637cbd
fix: make linker thread safe
nagatoism Jul 10, 2025
02a0066
fix: update clk
nagatoism Jul 12, 2025
34379a0
fix: set clk increment as 1
nagatoism Jul 12, 2025
5471e97
fix: fix clk increase before execution
nagatoism Jul 12, 2025
354e6bc
fix: change stack size to maximal
nagatoism Jul 13, 2025
3907ea0
fix: fix record mr argument
nagatoism Jul 15, 2025
155c964
fix: fix read stack
nagatoism Jul 17, 2025
1686816
fix: mem index global memory
nagatoism Jul 24, 2025
88f944b
fix: fix memory load record
nagatoism Jul 27, 2025
734e676
add unaligned memory
nagatoism Jul 29, 2025
0d0505f
fix: fix unaligned load address
nagatoism Jul 29, 2025
1fcb50b
fix: fix res_record for localset
nagatoism Jul 30, 2025
6c6cf46
feat: add branching tracing
nagatoism Aug 5, 2025
4b5b3c5
feat: add tracing call
nagatoism Aug 10, 2025
21c7c5d
feat: add call data in tracer
nagatoism Aug 14, 2025
a0159ae
feat: calldata for tracer
nagatoism Aug 18, 2025
be96d4f
fix: fix updating call sp
nagatoism Aug 19, 2025
dc52ee7
feat: add table events
nagatoism Aug 26, 2025
fcd3753
add fatop
nagatoism Sep 9, 2025
3d97060
fix: fix mw
nagatoism Sep 9, 2025
1c7b4ee
fix: add extra data to fat op event
nagatoism Sep 11, 2025
11a4405
fix: fix cycle for table init
nagatoism Sep 18, 2025
f26673c
fix: fix global cumulative sum
nagatoism Sep 23, 2025
97fe4ad
merge devel
nagatoism Sep 25, 2025
04f5fc1
fix: temperary set table max size be 64
nagatoism Sep 30, 2025
c1a2aba
fix(tracer): correct memory alignment
djadjka Oct 5, 2025
fc62a86
fix(tracer): fix wrong dst_addr in table_init
djadjka Oct 5, 2025
35acaee
feat(segment-caching): simple BitVecInlined wrapper for BitVec to sup…
bfdays Oct 6, 2025
40a7b69
fix(tracer): add offset of 32 to virtual address to prevent writes to…
djadjka Oct 8, 2025
2139ca9
chore: remove legacy folder (#59)
dmitry123 Oct 8, 2025
ee94444
feat(rwasm-optimisations): recycling for global memory; mmap support …
bfdays Oct 8, 2025
84d2b37
chore(deps): bump actions/checkout from 4 to 5 (#56)
dependabot[bot] Oct 8, 2025
8e6bfe4
chore(deps): bump dawidd6/action-download-artifact from 3 to 11 (#55)
dependabot[bot] Oct 8, 2025
7482706
chore: fix typo in benchmark
dmitry123 Oct 8, 2025
bcc771d
chore: remove eprintln for wasmtime
dmitry123 Oct 8, 2025
9890ab1
feat(rwasm-optimisation): turn on pooling-allocator; enable unix-memo…
bfdays Oct 14, 2025
7fced48
fix: don't store acquired call/value stack inside engine (#62)
dmitry123 Oct 14, 2025
8c9bc09
Revert "fix: don't store acquired call/value stack inside engine (#62…
dmitry123 Oct 15, 2025
b6259d6
fix: don't store acquired call/value stack inside engine (#64)
dmitry123 Oct 15, 2025
c9e69fe
fix(vm): fix missing stack recycle (#65)
dmitry123 Oct 15, 2025
99298f1
chore: tiny fixes for running tests
dmitry123 Oct 15, 2025
e525a3f
fix: default config for shared engine (#67)
dmitry123 Oct 16, 2025
e792a1c
fix: correct N_MAX_TABLE_SIZE
djadjka Oct 16, 2025
bd8839b
merge devel WIP
nagatoism Oct 21, 2025
bf2fd48
merge devel
nagatoism Oct 21, 2025
d3cc9d3
fix: fix tracing feature after merge devel
nagatoism Oct 21, 2025
c807520
chore: rebase from feat/tracing
nagatoism Oct 21, 2025
a402706
feat: add stack addr for all op
nagatoism Oct 16, 2025
a09bb3e
style: cargo fmt
nagatoism Oct 22, 2025
05403e0
Merge pull request #66 from fluentlabs-xyz/feat/addr-rangecheck
nagatoism Oct 22, 2025
768c493
chore: remove unused code
nagatoism Oct 22, 2025
af1b5e2
Merge pull request #73 from fluentlabs-xyz/djadjka/table-grow
djadjka Oct 30, 2025
96630fc
fix: add I32Extend8S and I32Extend16S to alu and unary
djadjka Nov 6, 2025
8a3dd09
add memory access for i64 ops (#80)
nagatoism Nov 10, 2025
7d2d17f
rebase feat/tracing (#74)
nagatoism Nov 13, 2025
d7ecff9
Revert "rebase feat/tracing (#74)" (#82)
nagatoism Nov 13, 2025
e1f7aa1
fix (#83)
nagatoism Nov 18, 2025
5c32130
fix i32mul64 (#85)
nagatoism Nov 19, 2025
e2915dd
Feat/add call indirect (#86)
nagatoism Nov 20, 2025
f17213b
fix
nagatoism Nov 20, 2025
1b24127
feat: add sig check (#88)
nagatoism Dec 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: github.event_name == 'push'
runs-on: ubuntu-amd64-8core
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run Criterion (save baseline "devel")
Expand Down Expand Up @@ -40,14 +40,14 @@ jobs:
contents: read
pull-requests: write # needed to comment on PRs (won’t work for forks; see note below)
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

# Try to fetch the latest successful baseline from devel
- name: Download baseline from devel
id: dl
uses: dawidd6/action-download-artifact@v3
uses: dawidd6/action-download-artifact@v11
continue-on-error: true # allow first PRs without a baseline
with:
workflow: bench.yml
Expand Down
13 changes: 11 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 34 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[package]
name = "rwasm"
edition = "2021"
authors = [
"Dmitry Savonin <dmitry@fluentlabs.xyz>",
]
authors = ["Dmitry Savonin <dmitry@fluentlabs.xyz>"]
repository = "https://github.com/fluentlabs-xyz/rwasm"
readme = "README.md"
license = "MIT"
Expand All @@ -16,28 +14,45 @@ hashbrown = { version = "0.15.2", features = ["alloc"] }
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
paste = { version = "1.0", default-features = false }
bytes = { version = "1.10.1", default-features = false }
downcast-rs = { version = "2.0.1", default-features = false, features = ["sync"] }
bincode = { version = "2.0.1", default-features = false, features = ["alloc", "derive"] }
downcast-rs = { version = "2.0.1", default-features = false, features = [
"sync",
] }
bincode = { version = "2.0.1", default-features = false, features = [
"alloc",
"derive",
] }
num-traits = { version = "0.2", default-features = false }
bitvec = { version = "1.0.1", default-features = false, features = ["alloc"] }
libm = "0.2.1"
smallvec = "1.15.0"
num-derive = "0.4.2"
spin = "0.10.0"
fnv = { version = "1.0.7", default-features = false }

# tracing
serde = { version = "1.0.219", features = ["derive"], optional = true }

# wasmtime
wasmtime = { git = "https://github.com/fluentlabs-xyz/wasmtime", branch = "devel", optional = true, features = ["disable-fpu", "cache"] }
#wasmtime = { path = "../wasmtime/crates/wasmtime", optional = true, features = ["disable-fpu"] }
wasmtime = { git = "https://github.com/fluentlabs-xyz/wasmtime", branch = "devel", optional = true, features = [
"disable-fpu",
"cache",
] }
#wasmtime = { path = "../wasmtime/crates/wasmtime", optional = true, features = ["disable-fpu", "cache"] }
anyhow = { version = "1.0.98", default-features = false, optional = true }
directories = { version = "6.0.0", optional = true }
futures = { version = "0.3.31", optional = true }
cfg-if = "1.0.4"

# wasmi
wasmi = { version = "0.47.0", default-features = false }

# unix-memory
libc = { version = "0.2.172", default-features = false, features = [
"align",
"extra_traits",
"const-extern-fn",
], optional = true }

[dev-dependencies]
rand = "0.9.1"
wat = "1.230.0"
Expand All @@ -51,14 +66,21 @@ std = [
"num-traits/std",
"bitvec/std",
"wasmtime?/std",
"unix-memory",
"pooling-allocator",
]
more-max-pages = []
serde = [
"dep:serde", "serde/derive"
]
serde = ["dep:serde", "serde/derive"]
tracing = ["serde"]
debug-print = []
test-build = []
debug-print = ["std"]
fpu = []
wasmtime = ["dep:wasmtime", "dep:anyhow", "dep:futures"]
cache-compiled-artifacts = ["wasmtime", "dep:directories"]
pooling-allocator = []
pooling-allocator = []
unix-memory = ["dep:libc"]

[[test]]
name = "integration"
path = "tests/snippets.rs"
required-features = ["test-build"]
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ test-specific-cases:
cd wasm && make
cd snippets && make
# run tests
cargo test --color=always --no-fail-fast --manifest-path Cargo.toml
cargo test --color=always --no-fail-fast --manifest-path e2e/Cargo.toml
cargo test --color=always --no-fail-fast --manifest-path Cargo.toml --no-default-features --features=std,wasmtime
cargo test --color=always --no-fail-fast --manifest-path Cargo.toml --no-default-features --features=std,wasmtime,unix-memory
cargo test --color=always --no-fail-fast --manifest-path e2e/Cargo.toml --no-default-features --features=std,wasmtime
cargo test --color=always --no-fail-fast --manifest-path e2e/Cargo.toml --no-default-features --features=std,wasmtime,unix-memory
cargo +nightly-2025-09-20 test --color=always --no-fail-fast --manifest-path snippets/Cargo.toml
# run nitro test (with release flag)
cargo test --release --package rwasm --test nitro-verifier test_nitro_verifier -- --ignored
cargo test --release --package rwasm --test nitro-verifier test_nitro_verifier --no-default-features --features=std,wasmtime -- --ignored
cargo test --release --package rwasm --test nitro-verifier test_nitro_verifier --no-default-features --features=std,wasmtime,unix-memory -- --ignored

.PHONY: coverage
coverage:
Expand All @@ -31,4 +34,8 @@ clean:
# Delete all Cargo.lock files except the root
find . -name Cargo.lock ! -path './Cargo.lock' -type f -exec rm -f {} +

.PHONY: test
test:
cargo test

all: test-specific-cases
2 changes: 1 addition & 1 deletion benchmarks/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target
Cargo.lock
lib.wat
lib.wasm
lib.wasm
40 changes: 35 additions & 5 deletions benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,42 @@ debug-assertions = false
rpath = false
codegen-units = 1

[dependencies]
criterion = { version = "0.7.0", default-features = false, features = [] }

[dev-dependencies]
criterion = { version = "0.7.0", default-features = false, features = [] }
rwasm = { path = "..", features = ["std", "wasmtime"] }
rand = { version = "0.9.2" }
wat = "1.230.0"
bitvec = { version = "1.0.1", default-features = false, features = ["alloc"] }
revm-interpreter = "25.0.3"
revm-bytecode = "6.2.2"
hex-literal = "1.0.0"

[[bench]]
name = "bench"
harness = false
name = "bitvec"
harness = false

[[bench]]
name = "compilation"
harness = false

[[bench]]
name = "fib32"
harness = false

[[bench]]
name = "fib64"
harness = false

[[bench]]
name = "fib256"
harness = false

[[bench]]
name = "parsing"
harness = false

[dependencies]
alloy-primitives = { version = "1.4.0", default-features = false }

[features]
default = ["rwasm/unix-memory"]
4 changes: 2 additions & 2 deletions benchmarks/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: build
build:
RUSTFLAGS="-C link-arg=-zstack-size=0" cargo b --target=wasm32-unknown-unknown --release --no-default-features
RUSTFLAGS="-C link-arg=-zstack-size=1024" cargo b --target-dir=./target --target=wasm32-unknown-unknown --release --no-default-features
cp ./target/wasm32-unknown-unknown/release/fib.wasm ./lib.wasm
wasm2wat ./lib.wasm > ./lib.wat || true
wasm2wat ./lib.wasm > ./lib.wat || true
Loading