50
50
"""
51
51
52
52
" $_rgf_docs "
53
- struct RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id} <: Function
54
- body:: Expr
53
+ struct RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id, B } <: Function
54
+ body:: B
55
55
function RuntimeGeneratedFunction (cache_tag, context_tag, ex; opaque_closures = true )
56
56
def = splitdef (ex)
57
57
args, body = normalize_args (def[:args ]), def[:body ]
@@ -61,20 +61,22 @@ struct RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id} <: Functio
61
61
end
62
62
id = expr_to_id (body)
63
63
cached_body = _cache_body (cache_tag, id, body)
64
- new {Tuple(args), cache_tag, context_tag, id} (cached_body)
64
+ new {Tuple(args), cache_tag, context_tag, id, typeof(cached_body) } (cached_body)
65
65
end
66
66
67
67
# For internal use in deserialize() - doesen't check whether the body is in the cache!
68
- function RuntimeGeneratedFunction {argnames, cache_tag, context_tag, id} (body:: Expr ) where {
68
+ function RuntimeGeneratedFunction {argnames, cache_tag, context_tag, id} (body) where {
69
69
argnames,
70
70
cache_tag,
71
71
context_tag,
72
- id
72
+ id,
73
73
}
74
- new {argnames, cache_tag, context_tag, id} (body)
74
+ new {argnames, cache_tag, context_tag, id, typeof(body) } (body)
75
75
end
76
76
end
77
77
78
+ drop_expr (:: RuntimeGeneratedFunction{A, C1, C2, ID} ) where {A, C1, C2, ID} = RuntimeGeneratedFunction {A, C1, C2, ID} (nothing )
79
+
78
80
function _check_rgf_initialized (mods... )
79
81
for mod in mods
80
82
if ! isdefined (mod, _tagname)
298
300
# We write an explicit deserialize() here to trigger caching of the body on a
299
301
# remote node when using Serialialization.jl (in Distributed.jl and elsewhere)
300
302
function Serialization. deserialize (s:: AbstractSerializer ,
301
- :: Type {
302
- RuntimeGeneratedFunction{argnames, cache_tag,
303
+ :: Type {<: RuntimeGeneratedFunction {argnames, cache_tag,
303
304
context_tag, id}}) where {
304
305
argnames,
305
306
cache_tag,
0 commit comments