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

IRShow: label builtin / intrinsic / dynamic calls in code_typed #56036

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

topolarity
Copy link
Member

@topolarity topolarity commented Oct 7, 2024

This makes it much easier to spot dynamic dispatches:
image

is now:
image

@ararslan ararslan added the display and printing Aesthetics and correctness of printed representations of objects. label Oct 8, 2024
base/compiler/ssair/show.jl Outdated Show resolved Hide resolved
base/compiler/ssair/show.jl Outdated Show resolved Hide resolved
@topolarity topolarity force-pushed the ct/print-builtin-intrinsic branch 8 times, most recently from 664e5fb to 6b8ba52 Compare October 9, 2024 03:39
Copy link
Sponsor Member

@aviatesk aviatesk left a comment

Choose a reason for hiding this comment

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

Looks good to me

base/compiler/optimize.jl Outdated Show resolved Hide resolved
base/compiler/abstractinterpretation.jl Outdated Show resolved Hide resolved
@topolarity
Copy link
Member Author

topolarity commented Oct 9, 2024

This needs a change to LoweredCodeUtils.jl before it won't break Revise

edit: JuliaDebug/LoweredCodeUtils.jl#118

@topolarity topolarity marked this pull request as draft October 9, 2024 14:24
Copy link
Sponsor Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

👍

topolarity added a commit to topolarity/LoweredCodeUtils.jl that referenced this pull request Oct 10, 2024
aviatesk pushed a commit to JuliaDebug/LoweredCodeUtils.jl that referenced this pull request Oct 11, 2024
This makes it much easier to spot dynamic dispatches:
```julia
3 ── %9  = (isa)(%4, @NamedTuple{x::Int64, y})::Bool
└───       goto JuliaLang#5 if not %9
4 ── %11 = π (%4, @NamedTuple{x::Int64, y})
└───       goto JuliaLang#6
5 ── %13 = (Tuple{Int64, Any})(%4)::Tuple{Int64, Any}
│    %14 = (getfield)(%13, 1)::Int64
│    %15 = (getfield)(%13, 2)::Any
│    %16 = %new(@NamedTuple{x::Int64, y}, %14, %15)::@NamedTuple{x::Int64, y}
```

is now:
```julia
3 ── %9  = builtin (isa)(%4, @NamedTuple{x::Int64, y})::Bool
└───       goto JuliaLang#5 if not %9
4 ── %11 = π (%4, @NamedTuple{x::Int64, y})
└───       goto JuliaLang#6
5 ── %13 = dynamic (Tuple{Int64, Any})(%4)::Tuple{Int64, Any}
│    %14 = builtin (getfield)(%13, 1)::Int64
│    %15 = builtin (getfield)(%13, 2)::Any
│    %16 = %new(@NamedTuple{x::Int64, y}, %14, %15)::@NamedTuple{x::Int64, y}
```

This is on by default when displaying a CodeInfo, and  off by default
for `code_warntype`, unless optimize=true. Can be enabled / disabled
via IRShowConfig.label_dynamic_calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display and printing Aesthetics and correctness of printed representations of objects.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants