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

Use VisitOperator trait in new FuncTranslator #645

Merged
merged 6 commits into from
Feb 3, 2023

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Feb 3, 2023

This PR carves out a FuncTranslator type from the big FuncBuilder type.
The FuncBuilder type now owns a FuncTranslator as one of its fields.
All translation logic now lives inside the FuncTranslator type.
The FuncTranslator properly implements the VisitOperator trait to translate functions.
The FuncBuilder has the job to validate any Wasm bytecode before translating it via the VisitOperator trait.

This PR goes one step further into a direction that will allow us to have a well defined interface for wasmi multi Engine backend support.

Also make them private.
Also move VisitOperator for FuncBuilder into mod.rs.
So far all the translation (or visit) methods were simple methods but mimicking the VisitOperator trait. This commit now turns all those free standing methods into trait method impls.
@paritytech-cicd-pr
Copy link

BENCHMARKS

NATIVEWASMTIME
BENCHMARKMASTERPRDIFFMASTERPRDIFFWASMTIME OVERHEAD
execute/
bare_call_0
1.46ms 1.40ms 🟢 -4.43% 1.16ms 1.16ms ⚪ 0.76% 🟢 -17%
execute/
bare_call_0/typed
1.09ms 1.02ms 🟢 -6.05% 784.02µs 779.78µs ⚪ -0.30% 🟢 -24%
execute/
bare_call_1
1.51ms 1.44ms 🔴 -4.82% 1.40ms 1.43ms 🔴 2.46% 🟢 -0%
execute/
bare_call_16
2.37ms 2.50ms 🔴 4.68% 4.45ms 4.46ms 🔴 0.40% 🟡 78%
execute/
bare_call_16/typed
1.83ms 1.82ms ⚪ -1.08% 2.80ms 2.84ms 🔴 1.31% 🟡 56%
execute/
bare_call_1/typed
1.21ms 1.14ms 🟢 -5.80% 1.18ms 1.22ms 🔴 2.61% 🟢 7%
execute/
bare_call_4
1.61ms 1.59ms 🟢 -1.11% 2.03ms 2.02ms ⚪ -0.24% 🟢 27%
execute/
bare_call_4/typed
1.19ms 1.14ms 🟢 -3.17% 1.31ms 1.30ms ⚪ -0.67% 🟢 14%
execute/
br_table
1.17ms 1.19ms 🔴 1.12% 1.37ms 1.36ms ⚪ -0.46% 🟢 15%
execute/
count_until
682.99µs 682.83µs ⚪ 0.00% 2.12ms 2.15ms ⚪ 1.47% 🔴 214%
execute/
factorial_iterative
328.30µs 326.13µs ⚪ -0.67% 946.57µs 950.10µs ⚪ 0.25% 🔴 191%
execute/
factorial_recursive
658.91µs 654.22µs ⚪ -0.67% 1.34ms 1.35ms ⚪ 0.10% 🔴 106%
execute/
fib_iterative
1.40ms 1.40ms ⚪ 0.15% 5.15ms 5.18ms ⚪ 0.44% 🔴 270%
execute/
fib_recursive
6.06ms 5.94ms 🟢 -2.26% 11.99ms 11.75ms 🟢 -2.02% 🟡 98%
execute/
global_bump
983.93µs 983.63µs ⚪ 0.08% 2.48ms 2.45ms 🟢 -1.31% 🔴 149%
execute/
global_const
741.96µs 742.27µs ⚪ 0.03% 2.55ms 2.55ms ⚪ 0.05% 🔴 244%
execute/
host_calls
25.96µs 26.00µs ⚪ 0.12% 39.44µs 39.05µs ⚪ -1.14% 🟢 50%
execute/
memory_fill
1.25ms 1.25ms ⚪ -0.25% 4.15ms 4.16ms ⚪ 0.06% 🔴 232%
execute/
memory_sum
1.19ms 1.19ms ⚪ 0.06% 4.15ms 4.16ms ⚪ 0.46% 🔴 248%
execute/
memory_vec_add
2.60ms 2.60ms ⚪ -0.03% 7.59ms 7.60ms ⚪ 0.20% 🔴 192%
execute/
recursive_is_even
1.12ms 1.17ms 🔴 4.75% 2.33ms 2.29ms 🟢 -2.15% 🟡 95%
execute/
recursive_ok
157.75µs 158.89µs ⚪ 0.70% 340.51µs 315.58µs 🟢 -7.20% 🟡 99%
execute/
recursive_scan
186.34µs 182.61µs ⚪ -1.51% 404.94µs 380.32µs 🟢 -6.02% 🔴 108%
execute/
recursive_trap
15.88µs 16.45µs 🔴 3.49% 29.69µs 31.65µs 🔴 6.45% 🟡 92%
execute/
regex_redux
530.62µs 525.83µs ⚪ -0.85% 1.42ms 1.38ms 🟢 -2.32% 🔴 163%
execute/
rev_complement
487.72µs 493.98µs 🔴 1.49% 1.43ms 1.42ms ⚪ -0.86% 🔴 187%
execute/
tiny_keccak
350.99µs 335.29µs 🟢 -4.54% 1.16ms 1.16ms ⚪ 0.95% 🔴 247%
execute/
trunc_f2i
735.08µs 734.24µs ⚪ -0.04% 2.13ms 2.13ms ⚪ -0.09% 🔴 190%
instantiate/
wasm_kernel
64.79µs 64.41µs ⚪ -3.54% 72.51µs 71.74µs ⚪ 0.13% 🟢 11%
translate/
erc1155
204.32µs 209.37µs 🔴 2.31% 388.89µs 386.04µs ⚪ -0.73% 🟡 84%
translate/
erc20
100.10µs 102.75µs 🔴 2.22% 191.20µs 190.99µs ⚪ 0.08% 🟡 86%
translate/
erc721
143.62µs 146.29µs 🔴 1.87% 277.80µs 278.72µs ⚪ 0.30% 🟡 91%
translate/
spidermonkey
0.00ns 0.00ns 🔴 2.37% 0.00ns 0.00ns ⚪ 0.20% 🟢 0%
translate/
wasm_kernel
3.71ms 3.78ms 🔴 1.78% 7.27ms 7.24ms ⚪ -0.43% 🟡 92%

Link to pipeline

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.

2 participants