|
56 | 56 |
|
57 | 57 | # timer sections are controlled by the `timeit_debug_enabled` switch of the module using `@cached` |
58 | 58 | _timeit_expr(label, ex) = |
59 | | - Expr(:macrocall, GlobalRef(TimerOutputs, Symbol("@timeit_debug")), LineNumberNode(@__LINE__, @__FILE__), GLOBAL_TIMER, label, ex) |
| 59 | + Expr(:macrocall, GlobalRef(TimerOutputs, Symbol("@timeit_debug")), LineNumberNode(@__LINE__, @__FILE__), GlobalRef(@__MODULE__, :GLOBAL_TIMER), label, ex) |
60 | 60 |
|
61 | 61 | macro cached(ex) |
62 | 62 | return _cached(__module__, ex) |
@@ -221,11 +221,12 @@ function _cached(mod::Module, ex) |
221 | 221 | :const, |
222 | 222 | Expr(:(=), globalcachename, :($LRU{Any, Any}(; maxsize = $DEFAULT_GLOBALCACHE_SIZE[]))) |
223 | 223 | ) |
224 | | - # caches of other modules (e.g. extensions adding methods) are registered with their module |
225 | | - registername = mod === (@__MODULE__) ? globalcachename : Symbol(nameof(mod), ".", globalcachename) |
226 | | - fglobalcacheregister = Expr( |
227 | | - :call, :push!, GLOBAL_CACHES, :($(QuoteNode(registername)) => $globalcachename) |
228 | | - ) |
| 224 | + # Other modules register their caches explicitly from `__init__`, since |
| 225 | + # mutations of this registry during their precompilation do not survive loading. |
| 226 | + fglobalcacheregister = mod === (@__MODULE__) ? Expr( |
| 227 | + :call, :push!, GlobalRef(@__MODULE__, :GLOBAL_CACHES), |
| 228 | + :($(QuoteNode(globalcachename)) => $globalcachename) |
| 229 | + ) : nothing |
229 | 230 |
|
230 | 231 | # # total expression |
231 | 232 | return esc( |
|
0 commit comments