Skip to content

Commit

Permalink
remove special-casing in inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed Sep 21, 2024
1 parent 726c4c9 commit fe224ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ cconvert(::Type{T}, x) where {T} = convert(T, x)
unsafe_convert(::Type{T}, x::T) where {T} = x

# will be inserted by the frontend for closures
_typeof_captured_variable(@nospecialize t) = has_free_typevars(t) ? typeof(t) : Typeof(t)
_typeof_captured_variable(@nospecialize t) = (@_total_meta; has_free_typevars(t) ? typeof(t) : Typeof(t))

has_free_typevars(@nospecialize t) = (@_total_meta; ccall(:jl_has_free_typevars, Int32, (Any,), t) === Int32(1))

Expand Down
13 changes: 3 additions & 10 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1763,18 +1763,11 @@ function late_inline_special_case!(ir::IRCode, idx::Int, stmt::Expr, flag::UInt3
unionall_call = Expr(:foreigncall, QuoteNode(:jl_type_unionall), Any, svec(Any, Any),
0, QuoteNode(:ccall), stmt.args[2], stmt.args[3])
return SomeCase(unionall_call)
elseif f === _typeof_captured_variable
if isa(type, Const)
return SomeCase(quoted(type.val))
elseif isconstType(type)
return SomeCase(quoted(type.parameters[1]))
end
# TODO we may still want to inline the body of `_typeof_captured_variable` here
elseif is_return_type(f)
if isa(type, Const)
return SomeCase(quoted(type.val))
elseif isconstType(type)
if isconstType(type)
return SomeCase(quoted(type.parameters[1]))
elseif isa(type, Const)
return SomeCase(quoted(type.val))
end
end
return nothing
Expand Down

0 comments on commit fe224ab

Please sign in to comment.