Commit f01029c
committed
incremental: new
This commit reworks how values like the panic handler function are
memoized during a compiler invocation. Previously, the value was
resolved by whichever analysis requested it first, and cached on `Zcu`.
This is problematic for incremental compilation, as after the initial
resolution, no dependencies are marked by users of this memoized state.
This is arguably acceptable for `std.builtin`, but it's definitely not
acceptable for the panic handler/messages, because those can be set by
the user (`std.builtin.Panic` checks `@import("root").Panic`).
So, here we introduce a new kind of `AnalUnit`, called `memoized_state`.
There are 3 such units:
* `.{ .memoized_state = .va_list }` resolves the type `std.builtin.VaList`
* `.{ .memoized_state = .panic }` resolves `std.Panic`
* `.{ .memoized_state = .main }` resolves everything else we want
These units essentially "bundle" the resolution of their corresponding
declarations, storing the results into fields on `Zcu`. This way, when,
for instance, a function wants to call the panic handler, it simply runs
`ensureMemoizedStateResolved`, registering one dependency, and pulls the
values from the `Zcu`. This "bundling" minimizes dependency edges. The 3
units are separated to allow them to act independently: for instance,
the panic handler can use `std.builtin.Type` without triggering a
dependency loop.AnalUnit to group dependencies on std.builtin decls1 parent fd62912 commit f01029c
File tree
6 files changed
+639
-254
lines changed- src
- Zcu
- codegen
6 files changed
+639
-254
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3158 | 3158 | | |
3159 | 3159 | | |
3160 | 3160 | | |
3161 | | - | |
3162 | | - | |
3163 | | - | |
3164 | | - | |
3165 | | - | |
3166 | | - | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
3167 | 3169 | | |
3168 | | - | |
3169 | | - | |
3170 | | - | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
3171 | 3174 | | |
3172 | 3175 | | |
3173 | 3176 | | |
| |||
3391 | 3394 | | |
3392 | 3395 | | |
3393 | 3396 | | |
3394 | | - | |
| 3397 | + | |
3395 | 3398 | | |
3396 | 3399 | | |
3397 | 3400 | | |
| |||
3403 | 3406 | | |
3404 | 3407 | | |
3405 | 3408 | | |
| 3409 | + | |
3406 | 3410 | | |
3407 | 3411 | | |
3408 | 3412 | | |
| |||
3670 | 3674 | | |
3671 | 3675 | | |
3672 | 3676 | | |
| 3677 | + | |
3673 | 3678 | | |
3674 | 3679 | | |
3675 | 3680 | | |
| |||
3737 | 3742 | | |
3738 | 3743 | | |
3739 | 3744 | | |
| 3745 | + | |
3740 | 3746 | | |
3741 | 3747 | | |
3742 | 3748 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
| |||
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
90 | 98 | | |
91 | 99 | | |
92 | 100 | | |
| |||
385 | 393 | | |
386 | 394 | | |
387 | 395 | | |
| 396 | + | |
388 | 397 | | |
389 | 398 | | |
390 | 399 | | |
| |||
399 | 408 | | |
400 | 409 | | |
401 | 410 | | |
| 411 | + | |
| 412 | + | |
402 | 413 | | |
403 | 414 | | |
404 | 415 | | |
| |||
434 | 445 | | |
435 | 446 | | |
436 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
437 | 458 | | |
438 | 459 | | |
439 | 460 | | |
| |||
769 | 790 | | |
770 | 791 | | |
771 | 792 | | |
| 793 | + | |
772 | 794 | | |
773 | 795 | | |
774 | 796 | | |
| |||
819 | 841 | | |
820 | 842 | | |
821 | 843 | | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
822 | 849 | | |
823 | 850 | | |
824 | 851 | | |
| |||
848 | 875 | | |
849 | 876 | | |
850 | 877 | | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
851 | 905 | | |
852 | 906 | | |
853 | 907 | | |
| |||
857 | 911 | | |
858 | 912 | | |
859 | 913 | | |
| 914 | + | |
860 | 915 | | |
861 | 916 | | |
862 | 917 | | |
| |||
0 commit comments