@@ -67,27 +67,27 @@ struct RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id, B} <: Func
67
67
68
68
# For internal use in deserialize() - doesen't check whether the body is in the cache!
69
69
function RuntimeGeneratedFunction{
70
- argnames,
71
- cache_tag,
72
- context_tag,
73
- id,
70
+ argnames,
71
+ cache_tag,
72
+ context_tag,
73
+ id
74
74
}(body) where {
75
- argnames,
76
- cache_tag,
77
- context_tag,
78
- id,
75
+ argnames,
76
+ cache_tag,
77
+ context_tag,
78
+ id
79
79
}
80
80
new {argnames, cache_tag, context_tag, id, typeof(body)} (body)
81
81
end
82
82
end
83
83
84
84
function drop_expr (:: RuntimeGeneratedFunction {
85
- a,
86
- cache_tag,
87
- c,
88
- id,
85
+ a,
86
+ cache_tag,
87
+ c,
88
+ id
89
89
}) where {a, cache_tag, c,
90
- id}
90
+ id}
91
91
# When dropping the reference to the body from an RGF, we need to upgrade
92
92
# from a weak to a strong reference in the cache to prevent the body being
93
93
# GC'd.
@@ -111,7 +111,7 @@ function _check_rgf_initialized(mods...)
111
111
end
112
112
113
113
function RuntimeGeneratedFunction (cache_module:: Module , context_module:: Module , code;
114
- opaque_closures = true )
114
+ opaque_closures = true )
115
115
_check_rgf_initialized (cache_module, context_module)
116
116
RuntimeGeneratedFunction (getfield (cache_module, _tagname),
117
117
getfield (context_module, _tagname),
@@ -133,11 +133,11 @@ macro RuntimeGeneratedFunction(context_module, code, opaque_closures = true)
133
133
end
134
134
135
135
function Base. show (io:: IO , :: MIME"text/plain" ,
136
- f:: RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id} ) where {
137
- argnames,
138
- cache_tag,
139
- context_tag,
140
- id,
136
+ f:: RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id} ) where {
137
+ argnames,
138
+ cache_tag,
139
+ context_tag,
140
+ id
141
141
}
142
142
cache_mod = parentmodule (cache_tag)
143
143
context_mod = parentmodule (context_tag)
@@ -250,16 +250,17 @@ function init(mod)
250
250
# or so. See:
251
251
# https://github.com/JuliaLang/julia/pull/32902
252
252
# https://github.com/NHDaly/StagedFunctions.jl/blob/master/src/StagedFunctions.jl#L30
253
- @inline @generated function $RuntimeGeneratedFunctions. generated_callfunc (f:: $RuntimeGeneratedFunctions.RuntimeGeneratedFunction {
253
+ @inline @generated function $RuntimeGeneratedFunctions. generated_callfunc (
254
+ f:: $RuntimeGeneratedFunctions.RuntimeGeneratedFunction {
255
+ argnames,
256
+ cache_tag,
257
+ $ _tagname,
258
+ id
259
+ },
260
+ __args... ) where {
254
261
argnames,
255
262
cache_tag,
256
- $ _tagname,
257
- id,
258
- },
259
- __args... ) where {
260
- argnames,
261
- cache_tag,
262
- id,
263
+ id
263
264
}
264
265
$ RuntimeGeneratedFunctions. generated_callfunc_body (argnames,
265
266
cache_tag,
@@ -334,13 +335,13 @@ end
334
335
# the body on a remote node when using Serialization.jl (in Distributed.jl
335
336
# and elsewhere)
336
337
function Serialization. serialize (s:: AbstractSerializer ,
337
- rgf:: RuntimeGeneratedFunction {argnames, cache_tag,
338
- context_tag, id, B}) where {
339
- argnames,
340
- cache_tag,
341
- context_tag,
342
- id,
343
- B,
338
+ rgf:: RuntimeGeneratedFunction {argnames, cache_tag,
339
+ context_tag, id, B}) where {
340
+ argnames,
341
+ cache_tag,
342
+ context_tag,
343
+ id,
344
+ B
344
345
}
345
346
body = _lookup_body (cache_tag, id)
346
347
Serialization. serialize_type (s,
@@ -350,14 +351,14 @@ function Serialization.serialize(s::AbstractSerializer,
350
351
end
351
352
352
353
function Serialization. deserialize (s:: AbstractSerializer ,
353
- :: Type {
354
- <: RuntimeGeneratedFunction {argnames, cache_tag,
354
+ :: Type {
355
+ <: RuntimeGeneratedFunction {argnames, cache_tag,
355
356
context_tag, id, B}}) where {
356
- argnames,
357
- cache_tag,
358
- context_tag,
359
- id,
360
- B,
357
+ argnames,
358
+ cache_tag,
359
+ context_tag,
360
+ id,
361
+ B
361
362
}
362
363
body = deserialize (s)
363
364
cached_body = _cache_body (cache_tag, id, body)
0 commit comments