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

avoid some invalidations from untyped dict code in TOML print #48908

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

KristofferC
Copy link
Member

No description provided.

@KristofferC KristofferC added compiler:latency Compiler latency backport 1.9 Change should be backported to release-1.9 labels Mar 6, 2023
@KristofferC KristofferC merged commit 015301a into master Mar 6, 2023
@KristofferC KristofferC deleted the kc/inval_toml_print branch March 6, 2023 19:21
@@ -171,7 +171,8 @@ function print_table(f::MbyFunc, io::IO, a::AbstractDict,
end
if is_table(value)
push!(ks, String(key))
header = isempty(value) || !all(is_tabular(v) for v in values(value))::Bool
_values = @invokelatest values(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels semantically wrong to me

Comment on lines +174 to +175
_values = @invokelatest values(value)
header = isempty(value) || !all(is_tabular(v) for v in _values)::Bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be:

header = isempty(value) || !(all(is_tabular(v) for v in @invokelatest values(value))::Bool)

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

::Bool seems to be applied to the result of all even as is, so nvm:

julia> code_typed((Any,); optimize=false) do value
           _values = @invokelatest values(value)
           header = isempty(value) || !all(is_tabular(v) for v in _values)::Bool
           header
       end
1-element Vector{Any}:
 CodeInfo(
1 ─       Core.NewvarNode(:(#52))::Any
│         Core.NewvarNode(:(header))::Any
│         (_values = Base.invokelatest(Main.values, value))::Any%4  = Main.isempty(value)::Any
└──       goto #3 if not %4
2 ─       (@_6 = %4)::Any
└──       goto #4
3 ─       (#52 = %new(Main.:(var"#52#54")))::Core.Const(var"#52#54"())%9  = #52::Core.Const(var"#52#54"())%10 = Base.Generator(%9, _values)::Base.Generator{_A, var"#52#54"} where _A
│   %11 = Main.all(%10)::Union{Missing, Bool}%12 = Core.typeassert(%11, Main.Bool)::Bool
└──       (@_6 = !%12)::Bool
4 ┄       (header = @_6)::Any
└──       return header
) => Any

KristofferC added a commit that referenced this pull request Mar 7, 2023
@KristofferC KristofferC mentioned this pull request Mar 7, 2023
52 tasks
KristofferC added a commit that referenced this pull request Mar 7, 2023
@KristofferC KristofferC removed the backport 1.9 Change should be backported to release-1.9 label Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants