@@ -16,37 +16,13 @@ function retrieve_code_info(sigtypes, world = Base.get_world_counter())
1616 ci
1717end
1818
19- # # We migth consider this from IRTools. Importantly, it has partially_inline to get
20- # # rid of static parameters
21- # function meta(T; types = T, world = worldcounter())
22- # F = T.parameters[1]
23- # F == typeof(invoke) && return invoke_meta(T; world = world)
24- # F isa DataType && (F.name.module === Core.Compiler ||
25- # F <: Core.Builtin ||
26- # F <: Core.Builtin) && return nothing
27- # _methods = Base._methods_by_ftype(T, -1, world)
28- # length(_methods) == 0 && return nothing
29- # type_signature, sps, method = last(_methods)
30- # sps = svec(map(untvar, sps)...)
31- # @static if VERSION >= v"1.2-"
32- # mi = Core.Compiler.specialize_method(method, types, sps)
33- # ci = Base.isgenerated(mi) ? Core.Compiler.get_staged(mi) : Base.uncompressed_ast(method)
34- # else
35- # mi = Core.Compiler.code_for_method(method, types, sps, world, false)
36- # ci = Base.isgenerated(mi) ? Core.Compiler.get_staged(mi) : Base.uncompressed_ast(mi)
37- # end
38- # Base.Meta.partially_inline!(ci.code, [], method.sig, Any[sps...], 0, 0, :propagate)
39- # Meta(method, mi, ci, method.nargs, sps)
40- # end
41-
42-
4319function overdubbable (ex:: Expr )
4420 ex. head != :call && return (false )
4521 length (ex. args) < 2 && return (false )
4622 return (overdubbable (ex. args[1 ]))
4723end
4824overdubbable (gr:: Core.GlobalRef ) = gr. name ∉ [:overdub , :record_start , :record_end , :promote , :convert , :tuple ]
49- overdubbable (gr:: Symbol ) =
25+ # overdubbable(gr::Symbol) =
5026overdubbable (ex) = false
5127timable (ex) = overdubbable (ex)
5228
8056
8157
8258overdub (f:: Core.IntrinsicFunction , args... ) = f (args... )
59+ overdub (f:: Core.Builtin , args... ) = f (args... )
8360
8461@generated function overdub (f:: F , args... ) where {F}
8562 ci = retrieve_code_info ((F, args... ))
@@ -121,9 +98,9 @@ overdub(f::Core.IntrinsicFunction, args...) = f(args...)
12198 push! (new_ci. codelocs, ci. codelocs[ci_no])
12299 newci_no += 1
123100 maps. goto[ci_no] = newci_no
124- if overdubbable (ex)
125- ex = Expr (:call , GlobalRef (Main, :overdub ), ex. args... )
126- end
101+ # if overdubbable(ex)
102+ # ex = Expr(:call, GlobalRef(Main, :overdub), ex.args...)
103+ # end
127104 push! (new_ci. code, ex)
128105 push! (new_ci. codelocs, ci. codelocs[ci_no])
129106 newci_no += 1
0 commit comments