@@ -20,19 +20,29 @@ if VERSION < _CodeInfo_need_ver
2020else
2121 # debuginfo changed completely as of https://github.com/JuliaLang/julia/pull/52415
2222 # nargs / isva was added as of https://github.com/JuliaLang/julia/pull/54341
23+ # field rettype added in https://github.com/JuliaLang/julia/pull/54655
24+ # field has_image_globalref added in https://github.com/JuliaLang/julia/pull/57433
2325 # CodeInfo constructor. TODO : Should be in Core
2426 let
2527 fns = fieldnames (Core. CodeInfo)
2628 fts = fieldtypes (Core. CodeInfo)
2729 conversions = [:(convert ($ t, $ n)) for (t,n) in zip (fts, fns)]
2830
29- expected_fns = (:code , :debuginfo , :ssavaluetypes , :ssaflags , :slotnames , :slotflags , :slottypes , :parent , :method_for_inference_limit_heuristics , :edges , :min_world , :max_world , :nargs , :propagate_inbounds , :has_fcall , :nospecializeinfer , :isva , :inlining , :constprop , :purity , :inlining_cost )
30- expected_fts = (Vector{Any}, Core. DebugInfo, Any, Vector{UInt32}, Vector{Symbol}, Vector{UInt8}, Any, Any, Any, Any, UInt64, UInt64, UInt64, Bool, Bool, Bool, Bool, UInt8, UInt8, UInt16, UInt16)
31+ expected_fns = (:code , :debuginfo , :ssavaluetypes , :ssaflags , :slotnames , :slotflags , :slottypes , :rettype , :parent , :edges , :min_world , :max_world , :method_for_inference_limit_heuristics , : nargs , :propagate_inbounds , :has_fcall , :has_image_globalref , :nospecializeinfer , :isva , :inlining , :constprop , :purity , :inlining_cost )
32+ expected_fts = (Vector{Any}, Core. DebugInfo, Any, Vector{UInt32}, Vector{Symbol}, Vector{UInt8}, Any, Any, Any, Any, UInt64, UInt64, Any, UInt64, Bool , Bool, Bool, Bool, Bool, UInt8, UInt8, UInt16, UInt16)
3133
32- code = if fns != expected_fns || fts != expected_fts
34+ code = if fns != expected_fns
35+ unexpected_fns = collect (setdiff (Set (fns), Set (expected_fns)))
36+ missing_fns = collect (setdiff (Set (expected_fns), Set (fns)))
3337 :(function _CodeInfo (args... )
34- error (" Unrecognized CodeInfo layout: Maybe version $VERSION is to new for this version of JuliaLowering?" )
35- end )
38+ error (" Unrecognized CodeInfo fields: Maybe version $VERSION is too new for this version of JuliaLowering?"
39+ * isempty (unexpected_fns) ? " " : " \n Unexpected fields found: $($ unexpected_fns) "
40+ * isempty (missing_fns) ? " " : " \n Missing fields: $($ missing_fns) " )
41+ end )
42+ elseif fts != expected_fts
43+ :(function _CodeInfo (args... )
44+ error (" Unrecognized CodeInfo field types: Maybe version $VERSION is too new for this version of JuliaLowering?" )
45+ end )
3646 else
3747 :(function _CodeInfo ($ (fns... ))
3848 $ (Expr (:new , :(Core. CodeInfo), conversions... ))
@@ -142,6 +152,8 @@ function to_code_info(ex, mod, funcname, slots)
142152
143153 debuginfo = finish_ir_debug_info! (current_codelocs_stack)
144154
155+ has_image_globalref = false
156+
145157 # TODO : Set ssaflags based on call site annotations:
146158 # - @inbounds annotations
147159 # - call site @inline / @noinline
@@ -172,6 +184,7 @@ function to_code_info(ex, mod, funcname, slots)
172184 max_world = typemax (Csize_t)
173185 isva = false
174186 inlining_cost = 0xffff
187+ rettype = Any
175188
176189 _CodeInfo (
177190 stmts,
@@ -181,14 +194,16 @@ function to_code_info(ex, mod, funcname, slots)
181194 slotnames,
182195 slotflags,
183196 slottypes,
197+ rettype,
184198 parent,
185- method_for_inference_limit_heuristics,
186199 edges,
187200 min_world,
188201 max_world,
202+ method_for_inference_limit_heuristics,
189203 nargs,
190204 propagate_inbounds,
191205 has_fcall,
206+ has_image_globalref,
192207 nospecializeinfer,
193208 isva,
194209 inlining,
0 commit comments