Skip to content

Conversation

@maleadt
Copy link
Member

@maleadt maleadt commented Jan 22, 2026

This PR back-ports a fix that was part of #59413 by @vtjnash to unbreak Compiler.inflate_ir! with const-return IR:

julia> _const_return_func(@nospecialize(x)) = 42
_const_return_func (generic function with 1 method)

julia> mi = Compiler.specialize_method(only(methods(_const_return_func)), Tuple{typeof(_const_return_func), Int}, Core.svec())

MethodInstance for _const_return_func(::Int64)

julia> worlds = Compiler.WorldRange(Base.get_world_counter(), Base.get_world_counter())
Compiler.WorldRange(0x000000000000987a, 0x000000000000987a)

julia> ci = Compiler.codeinfo_for_const(Compiler.NativeInterpreter(), mi, worlds, Core.svec(), 42)
CodeInfo(
1return 42
)

julia> ir = Compiler.inflate_ir!(ci, mi)
ERROR: AssertionError: invalid `given_argtypes` for `mi`

AFAIU this is because of codeinfo_for_const not setting nargs and isva fields on the returned CodeInfo object:

julia> ci.nargs = 2
2

julia> ir = Compiler.inflate_ir!(ci, mi)
 1return 42

@maleadt
Copy link
Member Author

maleadt commented Jan 24, 2026

CI failure (Distributed hang on i686-linux) already present on backports branch, e.g., https://buildkite.com/julialang/julia-release-1-dot-12/builds/525#019bdca2-f16c-42da-9a45-e7dbb0375727.

@maleadt maleadt merged commit b8e84ae into backports-release-1.12 Jan 24, 2026
6 of 8 checks passed
@maleadt maleadt deleted the tb/const_return_nargs_1.12 branch January 24, 2026 10:15
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