Skip to content
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

Base: PCRE: exec: type assert String after construction #57868

Merged

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Mar 23, 2025

Should prevent some invalidation in the sysimage.

Should prevent some invalidation in the sysimage.
@nsajko
Copy link
Contributor Author

nsajko commented Mar 23, 2025

Reduces the invalidation count on running struct I <: Integer end; Base.UInt(::I) = 0x7 from 71 to 65. Reproduce with:

./julia -E 'using SnoopCompileCore; i = (@snoop_invalidations (struct I <: Integer end; Base.UInt(::I) = 0x7)); using SnoopCompile; length(uinvalidated(i))'

Prevents these specific invalidations:

{   
    "method_instance": {
        "method": "_exec(re, subject, offset, options, match_data) @ Base.PCRE pcre.jl:204",
        "method_instance": "MethodInstance for Base.PCRE._exec(::Ptr{Nothing}, ::Any, ::Int64, ::UInt32, ::Ptr{Nothing})"
    },
    "children": [
        {   
            "method_instance": {
                "method": "exec(re, subject, offset, options, match_data) @ Base.PCRE pcre.jl:201",
                "method_instance": "MethodInstance for Base.PCRE.exec(::Ptr{Nothing}, ::Any, ::Int64, ::UInt32, ::Ptr{Nothing})"
            },
            "children": [
                {   
                    "method_instance": {
                        "method": "exec_r(re, subject, offset, options) @ Base.PCRE pcre.jl:213",
                        "method_instance": "MethodInstance for Base.PCRE.exec_r(::Ptr{Nothing}, ::Any, ::Int64, ::UInt32)"
                    },
                    "children": [
                        {   
                            "method_instance": {
                                "method": "var\"#occursin#463\"(offset::Integer, ::typeof(occursin), r::Regex, s::AbstractString) @ Base regex.jl:306",
                                "method_instance": "MethodInstance for Base.var\"#occursin#463\"(::Int64, ::typeof(occursin), ::Regex, ::AbstractString)"
                            },
                            "children": [
                                {   
                                    "method_instance": {
                                        "method": "occursin(r::Regex, s::AbstractString; offset) @ Base regex.jl:306",
                                        "method_instance": "MethodInstance for occursin(::Regex, ::AbstractString)"
                                    },
                                    "children": [
                                        {
                                            "method_instance": {
                                                "method": "url(m::Method) @ Base methodshow.jl:378",
                                                "method_instance": "MethodInstance for Base.url(::Method)"
                                            },
                                            "children": [                       
                                            ]           
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

@nsajko nsajko added backport 1.11 Change should be backported to release-1.11 backport 1.12 Change should be backported to release-1.12 labels Mar 24, 2025
@KristofferC KristofferC mentioned this pull request Mar 24, 2025
27 tasks
@KristofferC KristofferC merged commit f49f46d into JuliaLang:master Mar 25, 2025
11 checks passed
@nsajko nsajko deleted the Base_PCRE_exec_typeassert_String branch March 25, 2025 13:03
KristofferC pushed a commit that referenced this pull request Mar 26, 2025
Should prevent some invalidation in the sysimage.

(cherry picked from commit f49f46d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.11 Change should be backported to release-1.11 backport 1.12 Change should be backported to release-1.12 invalidations strings "Strings!"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants