Skip to content

Commit 77e4654

Browse files
committed
Disable fieldtypes cache on Julia 1.12 on macOS
This addresses the segfault issue reported in JuliaLang/julia#60721. The future of this feature is still undecided (#992), but this change prioritizes preventing segfaults over performance for now.
1 parent 16d9513 commit 77e4654

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/packagedef.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,13 +1654,17 @@ function __init__()
16541654
end
16551655

16561656
# Populate field types map cache (only on main process, not on workers)
1657-
if __bpart__ && (isnothing(distributed_module) || distributed_module.myid() == 1)
1658-
Threads.@spawn :default foreach_subtype(Any) do @nospecialize type
1659-
# Populating this cache can be time consuming (eg, 30s on an
1660-
# i7-7700HQ) so do this incrementally and yield() to the scheduler
1661-
# regularly so this thread gets a chance to exit if the user quits early
1662-
yield()
1663-
fieldtypes_cached(type)
1657+
# This feature needs to be disabled on Apple Silicon for Julia v1.12 and earlier
1658+
# due to the Julia runtime side issue (https://github.com/JuliaLang/julia/issues/60721)
1659+
@static if !(VERSION < v"1.13-" && Sys.isapple())
1660+
if __bpart__ && (isnothing(distributed_module) || distributed_module.myid() == 1)
1661+
Threads.@spawn :default foreach_subtype(Any) do @nospecialize type
1662+
# Populating this cache can be time consuming (eg, 30s on an
1663+
# i7-7700HQ) so do this incrementally and yield() to the scheduler
1664+
# regularly so this thread gets a chance to exit if the user quits early
1665+
yield()
1666+
fieldtypes_cached(type)
1667+
end
16641668
end
16651669
end
16661670
return nothing

0 commit comments

Comments
 (0)