Skip to content

Commit 23f54c5

Browse files
Improve diagram
1 parent 36f513e commit 23f54c5

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

vm/src/vm/runners/cairo_runner_2.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,14 @@ impl CairoRunner2 {
101101
// The stack is arranged as if we are at the start of a function call.
102102
// Input arguments are set as input arguments to the the function.
103103
//
104-
// --- ARGUMENTS --- RETURN FP RETURN PC
105-
// ┌────┬────┬────┬────┬───────────┬───────────┬ ─ ─ ─ ─ ┐
106-
// │ │ │ │ │ │ │ START FP
107-
// └────┴────┴────┴────┴───────────┴───────────┴ ─ ─ ─ ─ ┘
104+
// <-------- ARGUMENTS ----
105+
// ┌────┬────┬────┬────┬────────┬────────┬ ─ ─ ─ ─ ┐
106+
// ... │ │ │ │ │ RET FP │ RET PC │
107+
// └────┴────┴────┴────┴────────┴────────┴ ─ ─ ─ ─ ┘
108+
// INIT FP
108109
// Note: The size of the cells is not relevant
110+
//
111+
// The initial fp variable points to the cell after the return pc.
109112

110113
extend_stack_with_builtins(&mut stack, &builtins, &vm.builtin_runners);
111114

@@ -122,12 +125,15 @@ impl CairoRunner2 {
122125
// On standalone, we execute until a fixed address.
123126
// Input arguments are set as local variables to the current frame.
124127
//
125-
// ZERO ------ ARGUMENTS ------
126-
// ┌──────┬──────────┬────┬────┬────┐
127-
// │ │ START FP │ │ │ │
128-
// └──────┴──────────┴────┴────┴────┘
128+
// -------------- ARGUMENTS ------------------>
129+
// ┌──────┬─────────┬────┬────┬────┬────┬────┬────┐
130+
// │ ZERO │ │ │ │ │ │ │ │ ...
131+
// └──────┴─────────┴────┴────┴────┴────┴────┴────┘
132+
// INIT FP
129133
// Note: The size of the cells is not relevant
130134
//
135+
// The initial fp variable points to the cell after the zero element.
136+
//
131137
// The zero element is necessary because the compiler asumes that `fp`
132138
// is not pointing to the start of a segment - it fails otherwise.
133139

0 commit comments

Comments
 (0)