-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add --trace-dispatch
#183
Add --trace-dispatch
#183
Conversation
Similar to `--trace-compile`, emit the `precompile` statement for a method once, but only when it is dynamically dispatched. For this, we rename the `precompiled` field in `jl_method_instance_t` to `flags` and use bit 0 as `precompiled` and bit 1 as `dispatched`. When the method is dispatched, the `dispatched` bit is set to 1 and the precompile statement is emitted. This check is done in `jl_gf_invoke_by_method` and in the slow path (cache miss) of `jl_apply_generic`.
64aaab7
to
9d4f6b5
Compare
if (!jl_has_free_typevars(mi->specTypes)) { | ||
jl_printf(s_dispatch, "precompile("); | ||
jl_static_show(s_dispatch, mi->specTypes); | ||
jl_printf(s_dispatch, ")\n"); | ||
if (s_dispatch != JL_STDERR) | ||
ios_flush(&f_dispatch); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so that we only write out concrete signatures, not ones compiled by inference?
Can you add a comment indicating so? (Also in the upstream PR 🙏 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is just a direct copy from record_precompile_statement
. I think jl_static_show
will barf if there are free type variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Great stuff here. I'd love to wait for the upstream PR, but if you need it now, you need it.
❤️ ❤️ ❤️
Thanks... hoping I get the okay from Jeff today. |
c89c448
to
9d4f6b5
Compare
PR Description
Add a
--trace-dispatch
command line argument similar to--trace-compile
; the output will similarly containprecompile
statements, but for methods that are dynamically dispatched to, i.e. generically called.Checklist
Requirements for merging:
--trace-dispatch
JuliaLang/julia#55848port-to-*
labels that don't apply.