Cthulhu.jl icon indicating copy to clipboard operation
Cthulhu.jl copied to clipboard

`AssertionError: isdefined(cache[mi], :inferred)` on julia nightly for some functions

Open KristofferC opened this issue 1 week ago • 1 comments

Tried to "ascend" from SnoopCompile into

   _precompilepkgs(::Vector{Base.PkgId}, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Vector{Pair{Cmd, Base.CacheFlags}}, ::IOContext{IO}, ::Bool, ::Bool, ::Bool)

and got:

ERROR: AssertionError: isdefined(cache[mi], :inferred)
Stacktrace:
  [1] is_already_cached(interp::Cthulhu.CthulhuInterpreter, result::Compiler.InferenceResult)
    @ Compiler ./../usr/share/julia/Compiler/src/typeinfer.jl:728
  [2] promotecache!(interp::Cthulhu.CthulhuInterpreter, caller::Compiler.InferenceState)
    @ Compiler ./../usr/share/julia/Compiler/src/typeinfer.jl:205
  [3] finish_nocycle(interp::Cthulhu.CthulhuInterpreter, frame::Compiler.InferenceState, time_before::UInt64)
    @ Compiler ./../usr/share/julia/Compiler/src/typeinfer.jl:286
  [4] typeinf(interp::Cthulhu.CthulhuInterpreter, frame::Compiler.InferenceState)
    @ Compiler ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4508
  [5] typeinf_ext(interp::Cthulhu.CthulhuInterpreter, mi::Core.MethodInstance, source_mode::UInt8)
    @ Compiler ./../usr/share/julia/Compiler/src/typeinfer.jl:1527
  [6] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/compiler/lookup.jl:167
  [7] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/compiler/interface.jl:20
  [8] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/compiler/interface.jl:48
  [9] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/interface.jl:219
 [10] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/interface.jl:217
 [11] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/ascend.jl:21
 [12] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/ascend.jl:1
 [13] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/ascend.jl:56
 [14] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/ascend.jl:56
 [15] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/Cthulhu.jl:252
 [16] top-level scope
    @ ~/.julia/packages/Cthulhu/y9dW9/src/Cthulhu.jl:252
 [17] top-level scope
    @ REPL[7]:1

KristofferC avatar Dec 11 '25 13:12 KristofferC

Maybe better MWE:

julia> @descend Main.Precompilation._precompilepkgs(::Vector{Base.PkgId}, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Vector{Pair{Cmd, Base.CacheFlags}}, ::IOContext{IO}, ::Bool, ::Bool, ::Bool)
ERROR: AssertionError: isdefined(cache[mi], :inferred)
Stacktrace:
  [1] is_already_cached(interp::Cthulhu.CthulhuInterpreter, result::Compiler.InferenceResult)
    @ Compiler ./../usr/share/julia/Compiler/src/typeinfer.jl:728
  [2] promotecache!(interp::Cthulhu.CthulhuInterpreter, caller::Compiler.InferenceState)
    @ Compiler ./../usr/share/julia/Compiler/src/typeinfer.jl:205
  [3] finish_nocycle(interp::Cthulhu.CthulhuInterpreter, frame::Compiler.InferenceState, time_before::UInt64)
    @ Compiler ./../usr/share/julia/Compiler/src/typeinfer.jl:286
  [4] typeinf(interp::Cthulhu.CthulhuInterpreter, frame::Compiler.InferenceState)
    @ Compiler ./../usr/share/julia/Compiler/src/abstractinterpretation.jl:4508
  [5] typeinf_ext(interp::Cthulhu.CthulhuInterpreter, mi::Core.MethodInstance, source_mode::UInt8)
    @ Compiler ./../usr/share/julia/Compiler/src/typeinfer.jl:1527
  [6] run_type_inference

KristofferC avatar Dec 11 '25 14:12 KristofferC