Commit 4e64079
Avoid corrupted compiler env in ana/parse-ns
parse-ns allows for running the parse in two ways: updating the global
compiler env or not updating it. This is controlled via the :restore
option. To implement this, it isolates the parsing process by binding the
compiler env to a snapshot of the compiler env when it starts. When the
parsing is done, it checks the :restore option and if it's false it
merges back parts of the resulting compiler env (the ::namespaces and
::constants keys) into the global compiler env.
The problem is that during the parsing, other compiler processes could
have legitimately updated those same keys in the global compiler env, so
this merge can occasionally result in compiler data loss.
The race condition can avoided by using a different approach: only when
:restore is true the compiler runs isolated from the global compiler
env, by taking a snapshot of the env at the beginning. When :restore is
false, no snapshot is taken: env/*compiler* binding is not modified, so
the global compiler env is mutated in-place1 parent 4d44548 commit 4e64079
1 file changed
+21
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2707 | 2707 | | |
2708 | 2708 | | |
2709 | 2709 | | |
2710 | | - | |
2711 | | - | |
2712 | | - | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
2713 | 2714 | | |
2714 | 2715 | | |
2715 | 2716 | | |
| |||
2739 | 2740 | | |
2740 | 2741 | | |
2741 | 2742 | | |
2742 | | - | |
2743 | | - | |
2744 | | - | |
2745 | | - | |
2746 | | - | |
2747 | | - | |
2748 | | - | |
2749 | | - | |
2750 | | - | |
2751 | | - | |
2752 | | - | |
2753 | | - | |
2754 | | - | |
2755 | | - | |
2756 | | - | |
2757 | | - | |
2758 | | - | |
2759 | | - | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
2760 | 2760 | | |
2761 | 2761 | | |
2762 | 2762 | | |
2763 | 2763 | | |
2764 | 2764 | | |
2765 | | - | |
2766 | | - | |
2767 | | - | |
2768 | | - | |
2769 | | - | |
2770 | | - | |
2771 | 2765 | | |
2772 | 2766 | | |
2773 | 2767 | | |
| |||
0 commit comments