Skip to content

Compiler: abstract_eval_invoke_inst: type assert Expr #57860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Mar 22, 2025

Should make the code less vulnerable to invalidation.

@nsajko nsajko added invalidations backport 1.12 Change should be backported to release-1.12 labels Mar 22, 2025
@nsajko
Copy link
Contributor Author

nsajko commented Mar 22, 2025

Prevents these invalidations (the method instance signatures seem identical, but that's what SnoopCompile gives me):

{   
    "method_instance": {
        "method": "abstract_eval_invoke_inst(interp::Compiler.AbstractInterpreter, inst::Compiler.Instruction, irsv::Compiler.IRInterpretationState) @ Compiler ../usr/share/julia/Compiler/src/ssair/irinterp.jl:34",      
        "method_instance": "MethodInstance for Compiler.abstract_eval_invoke_inst(::Compiler.AbstractInterpreter, ::Compiler.Instruction, ::Compiler.IRInterpretationState)"
    },
    "children": [
    ]
},
{
    "method_instance": {
        "method": "abstract_eval_invoke_inst(interp::Compiler.AbstractInterpreter, inst::Compiler.Instruction, irsv::Compiler.IRInterpretationState) @ Compiler ../usr/share/julia/Compiler/src/ssair/irinterp.jl:34",
        "method_instance": "MethodInstance for Compiler.abstract_eval_invoke_inst(::Compiler.NativeInterpreter, ::Compiler.Instruction, ::Compiler.IRInterpretationState)"
    },
    "children": [
    ]
}

The total invalidation count somehow doesn't change, staying at 739.

@KristofferC KristofferC mentioned this pull request Mar 24, 2025
27 tasks
@nsajko nsajko changed the title Compiler: abstract_eval_invoke_inst: type assert Int Compiler: abstract_eval_invoke_inst: type assert Expr Mar 27, 2025
nsajko added 2 commits March 27, 2025 08:23
Should make the code less vulnerable to invalidation.
@nsajko nsajko force-pushed the Compiler_ssair_irinterp_typeassert_Int_before_Colon branch from 40dc34f to 1040d0c Compare March 27, 2025 07:24
@nsajko
Copy link
Contributor Author

nsajko commented Mar 27, 2025

The latest version of this PR additionally prevents these invalidations 🚀

{
    "method_instance": {
        "method": "isempty(r::StepRange) @ Base range.jl:685",
        "method_instance": "MethodInstance for isempty(::StepRange{Tuple{LineNumberNode, Expr}})"
    },
    "children": [
        {
            "method_instance": {
                "method": "iterate(r::OrdinalRange) @ Base range.jl:917",
                "method_instance": "MethodInstance for iterate(::OrdinalRange{Tuple{LineNumberNode, Expr}})"
            },
            "children": [
                {
                    "method_instance": {
                        "method": "Vector{T}(r::AbstractRange{T}) where T @ Base range.jl:1395",
                        "method_instance": "MethodInstance for Vector{Tuple{LineNumberNode, Expr}}(::AbstractRange{Tuple{LineNumberNode, Expr}})"
                    },
                    "children": [
                    ]
                }
            ]
        }
    ]
}

@topolarity topolarity merged commit ed3fccc into JuliaLang:master Mar 27, 2025
5 of 7 checks passed
@topolarity
Copy link
Member

Thanks @nsajko !

@nsajko nsajko deleted the Compiler_ssair_irinterp_typeassert_Int_before_Colon branch March 27, 2025 14:28
KristofferC pushed a commit that referenced this pull request Mar 31, 2025
Should make the code less vulnerable to invalidation.

(cherry picked from commit ed3fccc)
@KristofferC KristofferC mentioned this pull request Mar 31, 2025
36 tasks
KristofferC pushed a commit that referenced this pull request Mar 31, 2025
Should make the code less vulnerable to invalidation.

(cherry picked from commit ed3fccc)
@KristofferC KristofferC mentioned this pull request Apr 4, 2025
51 tasks
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants