Commit 915075f
work around some closure capture boxing inference issues in loading (#59367)
The only method of the `__require_prelocked` function in `Base` gets
compiled with bad inference for two variables, `path` and `reasons`,
which get pessimistically boxed (and inferred as `Any`), even though
both of them are only assigned to once across both the method and the
closure within (neither is assigned to within the closure).
My guess for what causes this would be either of these, or the
combination:
* (mis)use of GOTO
* `try`-`catch`
The least demanding way to work around the issue is adding a `let`
around the closure, as advised in the Performance tips. That is what
this change does.
This change should fix several bad inference results within method
instances such as `__require_prelocked(::PkgId, ::Nothing)` and
`__require_prelocked(::PkgId, ::String)`. Consequently, the sysimage
should become less vulnerable to invalidation happening when loading
certain packages.
(cherry picked from commit 547f858)1 parent 2ad6627 commit 915075f
1 file changed
+14
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2634 | 2634 | | |
2635 | 2635 | | |
2636 | 2636 | | |
2637 | | - | |
2638 | | - | |
2639 | | - | |
2640 | | - | |
2641 | | - | |
2642 | | - | |
2643 | | - | |
2644 | | - | |
2645 | | - | |
2646 | | - | |
2647 | | - | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
2648 | 2650 | | |
2649 | 2651 | | |
| 2652 | + | |
2650 | 2653 | | |
2651 | | - | |
2652 | 2654 | | |
2653 | 2655 | | |
2654 | 2656 | | |
| |||
0 commit comments