Commit 122030f
authored
Add span information (#1088)
This PR propagates the span through the semantics, to help with
inspection/debugging either the programs or the semantics.
We do this by using a new `<currentSpan>` cell, that contains the span
of the instruction currently executing and is updated as needed in
statements and in terminators (in each terminator rule, so as not to
affect the step count - commit #2). The span is also added as part of
the information maintained for a stack frame, saved in calls and
restored on returns. So, we are able to get a location trace using the
`<currentSpan>` plus the stack.
The updated expected outputs show the new behavior, where each
configuration now contains the `<currentSpan>` cell and each
`StackFrame` contains the span.
Running this small example and stopping mid-execution:
```
fn add(a: i32, b: i32) -> i32 {
let c = a + b; // line 2
c
}
fn main() {
let x = 3;
let y = 4;
let z = add(x, y); // line 9
assert!(z == 7);
}
```
, stopping inside add while evaluating a + b gives:
- `<currentSpan>` : the a + b line (line 2, inside add)
- `<stack>` : the suspended main frame has the add(x, y) call-site span
(line 9), below it the entry frame
The trace shows add:2 -> main:9 -> entry (represented by span(0))
showing where execution is and how it got there.1 parent 7bce18b commit 122030f
88 files changed
Lines changed: 422 additions & 98 deletions
File tree
- kmir/src
- kmir
- kdist/mir-semantics
- rt
- tests/integration/data
- exec-smir
- allocs
- arithmetic
- arrays
- assign-cast
- call-with-args
- enum
- intrinsic
- main-a-b-c
- newtype-pubkey
- niche-enum
- pointers
- references
- struct-multi
- structs-tuples
- modules
- prove-rs/show
- run-smir-random
- complex-types
- simple-types
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| |||
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
315 | 319 | | |
316 | 320 | | |
317 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
161 | | - | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
176 | | - | |
| 178 | + | |
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
| 182 | + | |
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
| |||
233 | 236 | | |
234 | 237 | | |
235 | 238 | | |
| 239 | + | |
236 | 240 | | |
237 | 241 | | |
238 | | - | |
| 242 | + | |
239 | 243 | | |
240 | 244 | | |
241 | 245 | | |
| |||
251 | 255 | | |
252 | 256 | | |
253 | 257 | | |
| 258 | + | |
254 | 259 | | |
255 | 260 | | |
256 | | - | |
| 261 | + | |
257 | 262 | | |
258 | 263 | | |
259 | 264 | | |
| |||
329 | 334 | | |
330 | 335 | | |
331 | 336 | | |
| 337 | + | |
332 | 338 | | |
333 | 339 | | |
334 | 340 | | |
335 | 341 | | |
336 | 342 | | |
337 | 343 | | |
338 | 344 | | |
| 345 | + | |
339 | 346 | | |
340 | 347 | | |
341 | 348 | | |
| |||
385 | 392 | | |
386 | 393 | | |
387 | 394 | | |
| 395 | + | |
388 | 396 | | |
389 | | - | |
| 397 | + | |
390 | 398 | | |
391 | 399 | | |
392 | 400 | | |
| |||
511 | 519 | | |
512 | 520 | | |
513 | 521 | | |
514 | | - | |
| 522 | + | |
515 | 523 | | |
516 | 524 | | |
517 | 525 | | |
| |||
523 | 531 | | |
524 | 532 | | |
525 | 533 | | |
526 | | - | |
| 534 | + | |
527 | 535 | | |
528 | 536 | | |
529 | 537 | | |
| |||
657 | 665 | | |
658 | 666 | | |
659 | 667 | | |
660 | | - | |
| 668 | + | |
661 | 669 | | |
662 | 670 | | |
663 | 671 | | |
| 672 | + | |
664 | 673 | | |
665 | 674 | | |
666 | 675 | | |
| |||
684 | 693 | | |
685 | 694 | | |
686 | 695 | | |
687 | | - | |
| 696 | + | |
688 | 697 | | |
689 | 698 | | |
690 | 699 | | |
691 | 700 | | |
| 701 | + | |
692 | 702 | | |
693 | 703 | | |
694 | 704 | | |
695 | | - | |
| 705 | + | |
696 | 706 | | |
697 | 707 | | |
698 | 708 | | |
699 | 709 | | |
| 710 | + | |
700 | 711 | | |
701 | 712 | | |
702 | 713 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
369 | | - | |
| 368 | + | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | | - | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | | - | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
75 | | - | |
76 | | - | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
111 | 114 | | |
112 | 115 | | |
113 | | - | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | | - | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | | - | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
0 commit comments