feat: resolve Solidity jump patterns#375
Open
DaniPopes wants to merge 28 commits into
Open
Conversation
Merging this PR will improve performance by 54.63%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
# Conflicts: # crates/revmc-codegen/src/bytecode/passes/block_analysis.rs
…umps-v2 # Conflicts: # crates/revmc-codegen/src/bytecode/mod.rs # crates/revmc-codegen/src/bytecode/passes/block_analysis.rs # crates/revmc-codegen/src/compiler/translate/mod.rs
Skip the fallback abstract interpretation pass when the split pass already hit its iteration cap, since conservative invalidation has restored safe local snapshots and the fallback was resolving zero jumps in the regressing contracts. Also avoid no-op constant-set joins for stack states and snapshots. Local Criterion compile/translate measurements improved onchain_lm_v2 from ~15.0ms to ~4.20ms, fiat_token from ~11.8ms to ~5.81ms, and usdc_proxy from ~1.32ms to ~1.03ms while preserving burntpix at ~2.36ms.
Collaborator
Author
|
big gains are from marking inner child contracts as dead code, e.g. regression are tolerable. they're at translate phase which overall is <10% of the total compilation time anyway, so not that measurable overall. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This resolves Solidity-style dynamic jump patterns with context-sensitive abstract interpretation while keeping unresolved jumps conservative. The analysis preserves separate return-target contexts for internal-function style dispatch, handles constant
JUMPIconditions, and compiles finite mixed valid/invalid target sets as multi-jumps with the invalid case handled by the switch default.The latest update avoids redundant abstract interpretation when the split analysis already hit its iteration cap and skips no-op constant-set joins while merging stack states and snapshots. That keeps the large codegen wins from the added jump precision without paying the prior translate-time regression on contracts where the extra pass resolved nothing.
Benchmarks
All-benchmark results vs
main: unopt.ll -13.5%, opt.ll -14.0%, opt.s -12.4%, JIT size -9.4%, total compile time -14.9%, translate time -13.4%, finalize -15.4%, and codegen -14.8%. The largest output and compile-time wins are on0xfc5900eac5…,0x9806ed1505…, andburntpix; most unchanged-output contracts are near flat, with the main compile-time regressions in this run concentrated in already-unmodified outputs such assnailtracerandfiat_token.Codegen statistics
Full details
370
=
126
=
354
=
400 B
=
2
=
2
=
2
=
5
=
4
=
362
=
128
=
392
=
530 B
=
2
=
2
=
2
=
5
=
6
=
1038
=
359
=
602
=
914 B
=
9
=
9
=
3
=
0
-
0
-
61771
=
27714
=
47245
=
125.8 KiB
=
1540
=
2172
=
452
=
29
=
600
=
12346
-7.6% 🟢
3286
-24.6% 🟢
5970
-15.1% 🟢
19.0 KiB
-8.4% 🟢
237
-11.2% 🟢
323
-7.4% 🟢
31
-11.4% 🟢
16
+23.1% 🔴
33
+17.9% 🔴
1036
=
376
=
715
=
1.6 KiB
=
17
=
21
=
6
=
0
-
0
-
13822
-5.7% 🟢
4458
-21.4% 🟢
7570
-29.7% 🟢
21.1 KiB
-24.2% 🟢
247
-20.1% 🟢
416
-8.0% 🟢
53
=
24
+118.2% 🔴
49
+48.5% 🔴
371
=
183
=
339
=
633 B
=
1
=
15
=
0
-
0
-
0
-
7446
=
2914
=
5085
=
11.8 KiB
=
104
=
196
=
22
=
9
=
8
=
82413
=
29357
=
49530
=
153.7 KiB
=
1803
=
2575
=
313
=
86
=
140
=
46530
=
17194
=
28601
=
87.0 KiB
=
926
=
1398
=
176
=
44
=
69
=
87275
=
32338
=
51399
=
165.1 KiB
=
2061
=
2819
=
362
=
169
=
547
=
145378
=
64808
=
112445
=
331.6 KiB
=
4577
=
5099
=
866
=
228
=
3958
=
28825
=
10991
=
18680
=
48.5 KiB
=
575
=
861
=
100
=
39
=
224
=
2111
=
576
=
887
=
2.2 KiB
=
29
=
32
=
6
=
0
-
0
-
1917
=
584
=
1043
=
2.8 KiB
=
34
=
54
=
8
=
2
=
2
=
614
=
241
=
473
=
764 B
=
9
=
10
=
2
=
1
=
1
=
526
=
203
=
466
=
765 B
=
7
=
6
=
2
=
2
=
2
=
23955
-0.7% 🟢
9021
-4.4% 🟢
15488
-6.9% 🟢
29.7 KiB
=
507
-3.6% 🟢
817
-1.2% 🟢
50
=
31
+63.2% 🔴
62
+129.6% 🔴
65644
=
24072
=
43717
=
111.8 KiB
=
1369
=
1654
=
169
=
61
=
289
=
102768
-54.7% 🟢
43026
-51.8% 🟢
77523
-47.9% 🟢
122.5 KiB
-49.0% 🟢
3138
-45.2% 🟢
3446
-48.9% 🟢
578
-43.9% 🟢
237
-33.8% 🟢
1269
-62.4% 🟢
138819
=
43852
=
74687
=
241.9 KiB
=
3125
=
4732
=
253
=
161
=
1856
=
150890
=
50065
=
88699
=
320.2 KiB
=
3797
=
5088
=
832
=
186
=
751
=
151235
=
50172
=
87776
=
318.5 KiB
=
3808
=
5077
=
823
=
205
=
1375
=
160455
=
56591
=
95933
=
324.5 KiB
=
4110
=
4911
=
864
=
84
=
562
=
53912
-57.9% 🟢
16279
-64.3% 🟢
27403
-59.8% 🟢
91.2 KiB
-55.2% 🟢
953
-63.1% 🟢
1520
-56.0% 🟢
147
-63.4% 🟢
106
-60.4% 🟢
371
-54.3% 🟢
131624
=
47929
=
75179
=
228.9 KiB
=
2675
=
3449
=
663
=
142
=
773
=
145835
=
53262
=
81626
=
260.8 KiB
=
2895
=
4360
=
974
=
270
=
405
=
130152
=
47438
=
74390
=
226.5 KiB
=
2645
=
3413
=
659
=
143
=
776
=
25172
-75.3% 🟢
7404
-78.4% 🟢
12713
-74.0% 🟢
44.8 KiB
-69.8% 🟢
542
-72.3% 🟢
744
-73.1% 🟢
72
-75.6% 🟢
55
-57.7% 🟢
275
-55.0% 🟢
1774612
-13.5% 🟢
644947
-14.0% 🟢
1086930
-12.4% 🟢
3.2 MiB
-9.4% 🟢
41744
-12.1% 🟢
55221
-11.7% 🟢
8490
-9.9% 🟢
2340
-12.4% 🟢
14407
-16.4% 🟢
Compile times
Full compile times
11.1ms
+23.2% 🔴
187.9µs
-11.3% 🟢
578.7µs
+48.8% 🔴
6.18ms
+16.8% 🔴
4.19ms
+33.1% 🔴
11.4ms
+15.5% 🔴
185.9µs
+5.7% 🔴
394.2µs
+2.9% 🔴
6.47ms
+13.3% 🔴
4.36ms
+20.9% 🔴
14.7ms
+9.0% 🔴
341.3µs
+2.8% 🔴
553.4µs
+4.4% 🔴
8.50ms
+7.1% 🔴
5.27ms
+13.1% 🔴
2.580s
+27.1% 🔴
8.75ms
+9.9% 🔴
12.4ms
-0.4% 🟢
1.440s
+24.0% 🔴
1.120s
+32.1% 🔴
196.5ms
+2.0% 🔴
2.81ms
+31.3% 🔴
4.77ms
+71.6% 🔴
121.4ms
+8.0% 🔴
67.5ms
-10.3% 🟢
21.4ms
+19.3% 🔴
336.3µs
+16.9% 🔴
621.8µs
+16.9% 🔴
12.2ms
+16.7% 🔴
8.22ms
+23.7% 🔴
219.9ms
-40.2% 🟢
2.69ms
+17.1% 🔴
3.74ms
+20.7% 🔴
130.2ms
-39.3% 🟢
83.3ms
-43.8% 🟢
11.8ms
+25.7% 🔴
196.8µs
+15.2% 🔴
463.2µs
+14.5% 🔴
6.90ms
+22.6% 🔴
4.28ms
+33.2% 🔴
129.1ms
+5.6% 🔴
1.77ms
-6.8% 🟢
1.91ms
-24.2% 🟢
76.6ms
+5.4% 🔴
48.9ms
+8.0% 🔴
1.894s
+16.1% 🔴
17.9ms
+18.9% 🔴
17.3ms
+7.7% 🔴
1.152s
+18.6% 🔴
706.0ms
+12.1% 🔴
794.2ms
+1.6% 🔴
7.93ms
+11.1% 🔴
9.35ms
+1.4% 🔴
474.9ms
+3.0% 🔴
302.0ms
-0.7% 🟢
1.673s
-0.1% 🟢
16.0ms
+10.7% 🔴
17.0ms
+3.9% 🔴
1.001s
+0.8% 🔴
638.6ms
-1.8% 🟢
4.276s
-8.7% 🟢
29.4ms
+43.0% 🔴
26.8ms
-2.6% 🟢
2.772s
-4.7% 🟢
1.448s
-16.3% 🟢
555.8ms
-15.2% 🟢
5.00ms
-1.2% 🟢
5.95ms
-5.7% 🟢
360.7ms
-18.3% 🟢
184.2ms
-9.0% 🟢
20.4ms
-6.4% 🟢
530.7µs
+1.6% 🔴
760.4µs
+0.5% 🔴
12.0ms
-6.4% 🟢
7.05ms
-7.5% 🟢
25.5ms
-1.1% 🟢
432.7µs
-8.1% 🟢
684.5µs
-0.8% 🟢
14.4ms
-3.7% 🟢
10.00ms
+3.2% 🔴
11.1ms
-6.2% 🟢
216.1µs
-5.3% 🟢
441.5µs
-5.4% 🟢
6.35ms
-7.8% 🟢
4.09ms
-3.9% 🟢
10.9ms
-5.9% 🟢
201.7µs
+9.8% 🔴
438.5µs
+10.6% 🔴
6.27ms
-1.0% 🟢
4.01ms
-14.6% 🟢
391.4ms
-10.1% 🟢
4.80ms
+19.7% 🔴
5.26ms
+10.0% 🔴
246.3ms
-9.1% 🟢
135.1ms
-13.1% 🟢
1.655s
-3.7% 🟢
245.4ms
+3.1% 🔴
14.9ms
-6.4% 🟢
842.3ms
-4.7% 🟢
552.1ms
-4.8% 🟢
2.546s
-56.6% 🟢
32.4ms
-7.9% 🟢
19.4ms
-56.8% 🟢
1.454s
-60.2% 🟢
1.040s
-51.2% 🟢
2.678s
-2.4% 🟢
24.1ms
-0.5% 🟢
26.8ms
-0.7% 🟢
1.617s
-2.4% 🟢
1.011s
-2.4% 🟢
2.984s
+2.3% 🔴
23.0ms
-4.3% 🟢
29.4ms
-1.5% 🟢
1.788s
+7.0% 🔴
1.144s
-3.9% 🟢
2.859s
+2.1% 🔴
23.0ms
-6.7% 🟢
28.4ms
+0.1% 🔴
1.682s
+1.6% 🔴
1.125s
+3.1% 🔴
3.521s
+3.0% 🔴
25.3ms
+4.1% 🔴
30.2ms
+0.7% 🔴
2.138s
+3.8% 🔴
1.328s
+1.8% 🔴
748.4ms
-74.1% 🟢
16.5ms
-15.4% 🟢
10.5ms
-56.7% 🟢
425.3ms
-76.5% 🟢
296.2ms
-71.4% 🟢
2.791s
-0.1% 🟢
23.3ms
+17.5% 🔴
24.0ms
-3.7% 🟢
1.733s
-0.7% 🟢
1.010s
+0.5% 🔴
3.089s
-0.5% 🟢
23.6ms
+12.9% 🔴
28.2ms
-3.7% 🟢
1.864s
-0.2% 🟢
1.173s
-1.2% 🟢
2.739s
-2.4% 🟢
23.4ms
+13.4% 🔴
25.2ms
-2.7% 🟢
1.709s
-1.6% 🟢
981.6ms
-4.1% 🟢
366.7ms
-80.5% 🟢
12.6ms
-22.7% 🟢
5.11ms
-74.4% 🟢
219.2ms
-80.9% 🟢
129.8ms
-81.3% 🟢
38.826s
-14.9% 🟢
572.3ms
+3.9% 🔴
351.7ms
-13.4% 🟢
23.326s
-15.4% 🟢
14.576s
-14.8% 🟢