Skip to content

Commit d60c06f

Browse files
committed
_register_kinds!: prevent unintentional closure capture, boxing
The variable `i` was unintentionally shared between the generator closure in `_register_kinds!` and another part of the body of `_register_kinds!`. Thus `i` was boxed, causing trouble for inference. Fix this by moving the part of `_register_kinds!` with `i` to a new function. Fixing this should make the sysimage more resistant to invalidation, once the change propagates to Julia itself. (cherry picked from commit 0f8266b)
1 parent dba9076 commit d60c06f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/kinds.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ function _register_kinds!(kind_modules, int_to_kindstr, kind_str_to_int, mod, mo
102102
error("Kind module ID $module_id already claimed by module $m")
103103
end
104104
end
105+
_register_kinds_names!(int_to_kindstr, kind_str_to_int, module_id, names)
106+
end
107+
108+
function _register_kinds_names!(int_to_kindstr, kind_str_to_int, module_id, names)
105109
# Process names to conflate category BEGIN/END markers with the first/last
106110
# in the category.
107111
i = 0

0 commit comments

Comments
 (0)