Skip to content

Conversation

@serenity4
Copy link
Collaborator

The change in JuliaLang/julia#57248 caused the CC.finish!(::CthulhuInterpreter, ...) override to be ignored, skipping the creation of the OptimizedSource.

The following testset fails:

@testset "ReturnTypeCallInfo" begin
only_ints(::Integer) = 1
callsites = find_callsites_by_ftt(; optimize=false) do
t1 = Base._return_type(only_ints, Tuple{Int}) # successful `return_type`
t2 = Base._return_type(only_ints, Tuple{Float64}) # failed `return_type`
t1, t2
end
@test length(callsites) == 2
callinfo1 = callsites[1].info
@test callinfo1 isa Cthulhu.ReturnTypeCallInfo
@test callinfo1.vmi isa Cthulhu.MICallInfo
io = IOBuffer()
Cthulhu.show_callinfo(io, callinfo1)
@test String(take!(io)) == "only_ints(::$Int)::$Int"
io = IOBuffer()
print(io, callsites[1])
@test occursin("return_type < only_ints(::$Int)::$Int >", String(take!(io)))
callinfo2 = callsites[2].info
@test callinfo2 isa Cthulhu.ReturnTypeCallInfo
@test callinfo2.vmi isa Cthulhu.FailedCallInfo
io = IOBuffer()
Cthulhu.show_callinfo(io, callinfo2)
@test String(take!(io)) == "only_ints(::Float64)::Union{}"
io = IOBuffer()
print(io, callsites[2])
@test occursin("return_type < only_ints(::Float64)::Union{} >", String(take!(io)))
@test Cthulhu.get_effects(callinfo1) |> CC.is_foldable_nothrow
@test Cthulhu.get_effects(callinfo2) |> CC.is_foldable_nothrow
end

because the code now contains calls to getproperty:

julia> callsites = find_callsites_by_ftt(; optimize=false) do
                   t1 = CC._return_type(only_ints, Tuple{Int})     # successful `return_type`
                   t2 = CC._return_type(only_ints, Tuple{Float64}) # failed `return_type`
                   t1, t2
               end
4-element Vector{Cthulhu.Callsite}:
 %2 = runtime < getproperty(::Any,::Core.Const(:_return_type))::Any >
 %7 = runtime < Any(::Core.Const(Main.only_ints),::Core.Const(Tuple{Int64})):: 
 %9 = runtime < getproperty(::Any,::Core.Const(:_return_type))::Any >
 %14 = runtime < Any(::Core.Const(Main.only_ints),::Core.Const(Tuple{Float64})) 

Not sure if we want to update the testset or have a rule to ignore getproperty calls, but in any case this can be merged to have nightly working.

@aviatesk
Copy link
Member

Oops, I totally missed that PR #621 and created a new one.

@aviatesk
Copy link
Member

Let me replace this with #621.

@aviatesk aviatesk closed this Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants