Commit aad0172
authored
feat(nightly): execution
Uses the nightly `become` keyword to tell LLVM to `musttail`. This did
not work at first when the `Handler` type returned `Result` but after I
changed it to return nothing it does.
Ideas taken from
https://github.com/xacrimon/tcvm/blob/main/src/interp.rs
To remove code duplication, I created local declarative macros
`dispatch!` for any "enum dispatch" logic of function pointers we were
doing. The benefit is that this is now shared across four functions:
{e1,e2} x {pre_compute,handler}. I did not make a single general purpose
macro because Rust token parsing rules actually make this hard because
it doesn't let you reference ident's you don't declare, and the ident's
used actually vary based on the function.
Removed `pc_base` and just leave some empty space to avoid `pc -
pc_base` calculation. This is because `self.pc_base` is a runtime
variable, so we don't want to have to use a register (or worse
load/store) to access it.
To complete this:
- [x] For each crate, add "tco" feature, and then add
`#[create_tco_handler]` attribute above `execute_e1_impl` functions.
Then for each `Executor` implementation, copy the `pre_compute` function
implementation verbatim but switch to `handler` function signature and
return the tco handler fn pointer instead.
- [x] Do the same for metered execution.
- [x] ~~Switch to x86 global asm instead of relying on LLVM if we want
to be extra safe.~~ this seemed complicated and hard to do fully
properly so I prefer `become`.
Closes INT-4309becomes faster (#2013)1 parent 4852493 commit aad0172
File tree
75 files changed
+2576
-1033
lines changed- .github/workflows
- benchmarks
- execute
- prove
- ci/scripts
- crates
- cli
- src
- sdk
- src
- vm
- derive
- src
- src
- arch
- execution_mode
- system
- phantom
- public_values
- extensions
- algebra/circuit
- src
- modular_chip
- bigint/circuit
- src
- ecc
- circuit
- src
- weierstrass_chip
- add_ne
- double
- tests
- keccak256/circuit
- src
- native/circuit
- src
- branch_eq
- castf
- field_arithmetic
- field_extension
- fri
- jal_rangecheck
- loadstore
- poseidon2
- pairing/circuit
- src
- rv32im
- circuit
- src
- auipc
- base_alu
- branch_eq
- branch_lt
- divrem
- hintstore
- jal_lui
- jalr
- less_than
- load_sign_extend
- loadstore
- mulh
- mul
- shift
- tests
- sha256/circuit
- src
- sha256_chip
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
75 files changed
+2576
-1033
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | | - | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
82 | 93 | | |
83 | 94 | | |
84 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| |||
0 commit comments