@@ -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... ))
@@ -161,6 +171,10 @@ function to_code_info(ex, mod, funcname, slots)
161171 # TODO : Set based on Base.@assume_effects
162172 purity = 0x0000
163173
174+ # TODO : Should we set these?
175+ rettype = Any
176+ has_image_globalref = false
177+
164178 # The following CodeInfo fields always get their default values for
165179 # uninferred code.
166180 ssavaluetypes = length (stmts) # Why does the runtime code do this?
@@ -181,14 +195,16 @@ function to_code_info(ex, mod, funcname, slots)
181195 slotnames,
182196 slotflags,
183197 slottypes,
198+ rettype,
184199 parent,
185- method_for_inference_limit_heuristics,
186200 edges,
187201 min_world,
188202 max_world,
203+ method_for_inference_limit_heuristics,
189204 nargs,
190205 propagate_inbounds,
191206 has_fcall,
207+ has_image_globalref,
192208 nospecializeinfer,
193209 isva,
194210 inlining,
0 commit comments