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

Implement reference-types Wasm proposal #635

Merged
merged 121 commits into from Jan 31, 2023
Merged

Conversation

Robbepop
Copy link
Collaborator

Closes #496.

Many are failing at the moment since reference-types is not yet implemented in wasmi. The goal of this PR is to make all tests pass again.
@paritytech-cicd-pr
Copy link

paritytech-cicd-pr commented Jan 25, 2023

BENCHMARKS

NATIVEWASMTIME
BENCHMARKMASTERPRDIFFMASTERPRDIFFWASMTIME OVERHEAD
execute/
bare_call_0
1.39ms 1.39ms 🟢 0.71% 1.11ms 1.22ms 🔴 9.81% 🟢 -13%
execute/
bare_call_0/typed
1.09ms 1.07ms 🟢 -2.12% 775.02µs 828.09µs 🔴 6.78% 🟢 -23%
execute/
bare_call_1
1.44ms 1.47ms 🟢 1.18% 1.34ms 1.48ms 🔴 10.14% 🟢 1%
execute/
bare_call_16
2.54ms 2.42ms 🟢 -3.44% 4.24ms 4.32ms 🔴 1.50% 🟡 78%
execute/
bare_call_16/typed
1.87ms 1.87ms ⚪ -0.15% 2.67ms 2.77ms 🔴 3.56% 🟢 48%
execute/
bare_call_1/typed
1.21ms 1.17ms 🟢 -3.35% 1.15ms 1.18ms 🔴 2.74% 🟢 1%
execute/
bare_call_4
1.59ms 1.66ms 🔴 5.06% 1.89ms 2.03ms 🔴 7.23% 🟢 22%
execute/
bare_call_4/typed
1.17ms 1.21ms 🔴 2.78% 1.32ms 1.31ms ⚪ -0.63% 🟢 8%
execute/
br_table
1.24ms 1.29ms 🔴 3.75% 1.37ms 1.39ms ⚪ 1.26% 🟢 8%
execute/
count_until
671.05µs 682.31µs 🔴 1.48% 2.12ms 1.94ms 🟢 -7.15% 🔴 184%
execute/
factorial_iterative
329.90µs 327.09µs ⚪ -1.40% 914.40µs 949.52µs 🔴 3.72% 🔴 190%
execute/
factorial_recursive
689.62µs 661.27µs 🟢 -3.87% 1.36ms 1.37ms ⚪ 0.72% 🔴 107%
execute/
fib_iterative
1.49ms 1.40ms 🟢 -6.96% 5.04ms 5.15ms 🔴 2.01% 🔴 269%
execute/
fib_recursive
6.08ms 6.02ms 🟢 -1.61% 12.33ms 11.71ms 🟢 -4.27% 🟡 95%
execute/
global_bump
1.05ms 982.27µs 🟢 -6.96% 2.61ms 2.52ms 🟢 -3.46% 🔴 157%
execute/
global_const
727.88µs 742.25µs ⚪ 2.57% 2.46ms 2.55ms 🔴 3.43% 🔴 244%
execute/
host_calls
27.11µs 28.14µs ⚪ 1.54% 34.96µs 42.87µs 🔴 22.96% 🟡 52%
execute/
memory_fill
1.21ms 1.26ms 🔴 2.33% 4.04ms 4.17ms 🔴 3.56% 🔴 230%
execute/
memory_sum
1.21ms 1.21ms ⚪ -0.70% 3.99ms 4.15ms 🔴 4.01% 🔴 244%
execute/
memory_vec_add
2.44ms 2.62ms 🔴 7.58% 7.78ms 7.66ms 🟢 -1.81% 🔴 192%
execute/
recursive_is_even
1.15ms 1.11ms 🟢 -3.15% 2.23ms 2.41ms 🔴 8.05% 🔴 116%
execute/
recursive_ok
147.68µs 159.11µs 🔴 7.68% 315.15µs 346.71µs 🔴 9.91% 🔴 118%
execute/
recursive_scan
183.67µs 181.74µs ⚪ -0.80% 397.01µs 415.51µs 🔴 3.43% 🔴 129%
execute/
recursive_trap
14.35µs 16.03µs 🔴 11.73% 30.41µs 31.85µs 🔴 4.87% 🟡 99%
execute/
regex_redux
527.64µs 537.44µs 🔴 1.62% 1.41ms 1.41ms ⚪ -0.56% 🔴 162%
execute/
rev_complement
466.50µs 495.99µs 🔴 6.32% 1.42ms 1.43ms ⚪ 0.79% 🔴 188%
execute/
tiny_keccak
330.21µs 334.05µs 🔴 1.25% 1.17ms 1.15ms 🟢 -1.52% 🔴 244%
execute/
trunc_f2i
726.32µs 757.18µs 🔴 3.89% 2.19ms 2.14ms 🟢 -2.41% 🔴 183%
instantiate/
wasm_kernel
62.51µs 64.92µs ⚪ 3.60% 72.83µs 71.57µs ⚪ -1.82% 🟢 10%
translate/
erc1155
203.77µs 200.82µs 🟢 -1.68% 371.59µs 383.51µs 🔴 3.34% 🟡 91%
translate/
erc20
101.39µs 100.17µs ⚪ -1.38% 180.66µs 185.58µs 🔴 2.80% 🟡 85%
translate/
erc721
145.54µs 142.47µs 🟢 -2.14% 263.95µs 270.15µs 🔴 2.45% 🟡 90%
translate/
spidermonkey
0.00ns 0.00ns ⚪ 0.41% 0.00ns 0.00ns 🔴 3.37% 🟢 0%
translate/
wasm_kernel
3.72ms 3.71ms ⚪ -0.27% 7.02ms 7.18ms 🔴 2.19% 🟡 94%

Link to pipeline

This allows to have size_of<Func> == size_of<Option<Func>>
This is in preparation for the introduction of the ExternRef type that is going to be a non-Copy type since internally it will be reference counted.
It no longer owns its data itself but uses to the store to do so just like any other entity in wasmi.
Thesse methods were taken over from the Wasmtime API.
Just like in the Wasmtime API. Better mirroring.
This also removes the Display impl for Value.
The wasmi CLI tool now instead implements its own way to display Value which makes more sense anyways.
The Display implementation now resides in wasmi_cli which was its only user and makes more sense since Display impls usually are biased.
This better mirrors the Wasmtime API.
@codecov-commenter
Copy link

Codecov Report

Merging #635 (e795b37) into master (5f9d81a) will increase coverage by 2.69%.
The diff coverage is 76.52%.

@@            Coverage Diff             @@
##           master     #635      +/-   ##
==========================================
+ Coverage   78.50%   81.19%   +2.69%     
==========================================
  Files          85       87       +2     
  Lines        7270     7706     +436     
==========================================
+ Hits         5707     6257     +550     
+ Misses       1563     1449     -114     
Impacted Files Coverage Δ
crates/core/src/untyped.rs 97.21% <ø> (-0.09%) ⬇️
crates/wasmi/src/engine/bytecode/mod.rs 100.00% <ø> (ø)
crates/wasmi/src/engine/func_builder/visit.rs 87.50% <ø> (-12.50%) ⬇️
crates/wasmi/src/engine/resumable.rs 81.13% <ø> (ø)
crates/wasmi/src/engine/tests.rs 98.66% <ø> (ø)
crates/wasmi/src/func_type.rs 93.84% <ø> (-2.77%) ⬇️
crates/wasmi/src/module/import.rs 80.00% <ø> (+2.22%) ⬆️
crates/wasmi/src/module/instantiate/error.rs 11.53% <ø> (+11.53%) ⬆️
crates/wasmi/src/module/mod.rs 73.72% <ø> (+0.72%) ⬆️
crates/core/src/value.rs 73.52% <33.33%> (+11.21%) ⬆️
... and 57 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Robbepop Robbepop marked this pull request as ready for review January 31, 2023 13:56
@Robbepop Robbepop merged commit c15d525 into master Jan 31, 2023
@Robbepop Robbepop deleted the rf-implement-reference-types branch January 31, 2023 14:02
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.

Implement Wasm proposal: reference-types
3 participants