Skip to content

Base: shell escaping: inference improvement to prevent invalidation #57915

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

Merged

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Mar 28, 2025

Should make the sysimage more resistant to invalidation.

@nsajko
Copy link
Contributor Author

nsajko commented Mar 28, 2025

Prevents this tree of invalidations resulting from the definition of struct S <: Integer; function Base.Int(::S) end:

{
    "type": "Tuple{Type{Int64}, Integer}",
    "tree": {
        "method_instance": {
            "method": "var\"#IOBuffer#391\"(read::Union{Nothing, Bool}, write::Union{Nothing, Bool}, append::Union{Nothing, Bool}, truncate::Union{Nothing, Bool}, maxsize::Integer, sizehint::Union{Nothing, Integer}, ::Type{IOBuffer}) @ Base iobuffer.jl:128",
            "method_instance": "MethodInstance for Base.var\"#IOBuffer#391\"(::Bool, ::Bool, ::Nothing, ::Bool, ::Int64, ::Integer, ::Type{IOBuffer})"
        },
        "children": [
            {
                "method_instance": {
                    "method": "kwcall(::NamedTuple, ::Type{IOBuffer}) @ Base iobuffer.jl:128",
                    "method_instance": "MethodInstance for Core.kwcall(::NamedTuple{(:sizehint,), <:Tuple{Integer}}, ::Type{IOBuffer})"
                },
                "children": [
                    {
                        "method_instance": {
                            "method": "var\"#sprint#446\"(context, sizehint::Integer, ::typeof(sprint), f::Function, args...) @ Base strings/io.jl:106",
                            "method_instance": "MethodInstance for Base.var\"#sprint#446\"(::Nothing, ::Integer, ::typeof(sprint), ::typeof(Base.escape_microsoft_c_args), ::Vararg{String})"
                        },
                        "children": [
                            {
                                "method_instance": {
                                    "method": "kwcall(::NamedTuple, ::typeof(sprint), f::Function, args...) @ Base strings/io.jl:106",
                                    "method_instance": "MethodInstance for Core.kwcall(::NamedTuple{(:sizehint,), <:Tuple{Any}}, ::typeof(sprint), ::typeof(Base.escape_microsoft_c_args), ::Vararg{String})"
                                },
                                "children": [
                                    {
                                        "method_instance": {
                                            "method": "escape_microsoft_c_args(args::AbstractString...) @ Base shell.jl:495",
                                            "method_instance": "MethodInstance for Base.escape_microsoft_c_args(::Vararg{String})"
                                        },
                                        "children": [
                                            {
                                                "method_instance": {
                                                    "method": "escape_microsoft_c_args(cmd::Cmd) @ Base cmd.jl:120",
                                                    "method_instance": "MethodInstance for Base.escape_microsoft_c_args(::Cmd)"
                                                },
                                                "children": [
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "method_instance": {
                            "method": "var\"#sprint#446\"(context, sizehint::Integer, ::typeof(sprint), f::Function, args...) @ Base strings/io.jl:106",
                            "method_instance": "MethodInstance for Base.var\"#sprint#446\"(::Nothing, ::Integer, ::typeof(sprint), ::typeof(Base.shell_escape_csh), ::Vararg{String})"
                        },
                        "children": [
                            {
                                "method_instance": {
                                    "method": "kwcall(::NamedTuple, ::typeof(sprint), f::Function, args...) @ Base strings/io.jl:106",
                                    "method_instance": "MethodInstance for Core.kwcall(::NamedTuple{(:sizehint,), <:Tuple{Any}}, ::typeof(sprint), ::typeof(Base.shell_escape_csh), ::Vararg{String})"
                                },
                                "children": [
                                    {
                                        "method_instance": {
                                            "method": "shell_escape_csh(args::AbstractString...) @ Base shell.jl:345",
                                            "method_instance": "MethodInstance for Base.shell_escape_csh(::Vararg{String})"
                                        },
                                        "children": [
                                            {
                                                "method_instance": {
                                                    "method": "shell_escape_csh(cmd::Cmd) @ Base cmd.jl:118",
                                                    "method_instance": "MethodInstance for Base.shell_escape_csh(::Cmd)"
                                                },
                                                "children": [
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

nsajko and others added 3 commits March 28, 2025 15:48
Should make the sysimage more resistant to invalidation.
Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
@nsajko nsajko force-pushed the shell_escape_inference_mapreduce_sum branch from b89cf32 to 2873cdd Compare March 28, 2025 14:48
@topolarity topolarity added the merge me PR is reviewed. Merge when all tests are passing label Mar 28, 2025
@nsajko nsajko added backport 1.10 Change should be backported to the 1.10 release backport 1.11 Change should be backported to release-1.11 backport 1.12 Change should be backported to release-1.12 labels Mar 28, 2025
@nsajko
Copy link
Contributor Author

nsajko commented Mar 30, 2025

merge me bump

@IanButterworth IanButterworth merged commit 4d2a350 into JuliaLang:master Mar 30, 2025
11 checks passed
@nsajko nsajko deleted the shell_escape_inference_mapreduce_sum branch March 30, 2025 06:56
@nsajko nsajko removed the merge me PR is reviewed. Merge when all tests are passing label Mar 30, 2025
KristofferC pushed a commit that referenced this pull request Mar 31, 2025
@KristofferC KristofferC mentioned this pull request Mar 31, 2025
36 tasks
KristofferC pushed a commit that referenced this pull request Mar 31, 2025
@KristofferC KristofferC mentioned this pull request Mar 31, 2025
71 tasks
KristofferC pushed a commit that referenced this pull request Mar 31, 2025
KristofferC pushed a commit that referenced this pull request Mar 31, 2025
KristofferC pushed a commit that referenced this pull request Mar 31, 2025
@KristofferC KristofferC mentioned this pull request Apr 4, 2025
51 tasks
@KristofferC KristofferC removed backport 1.12 Change should be backported to release-1.12 backport 1.11 Change should be backported to release-1.11 labels Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.10 Change should be backported to the 1.10 release invalidations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants