-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Sink CodeInfo transformation into transform_result_for_cache
#56897
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
Conversation
Several downstream consumers want to cache IRCode rather than CodeInfo. Right now they need to override both `finish!` and `transform_result_for_cache`. With this change, only overriding the latter should be sufficient. As a nice bonus, we can avoid doing the work of converting to CodeInfo for interpreters that don't cache at all such as the REPL interpreter.
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 change removes the assignments to caller.src
and result.src
, but opt.src
should already be identical to their CodeInfo
. My understanding is that it is destructively updated by ir_to_codeinf!
.
Yes, the code path that goes through finish! twice (although I'm not sure why that happens - possibly a bug?) takes the |
Somewhat of an implementation defect, though one needed to ensure the soundness of the caller mode currently. This is the reason for #56880 which deletes that call, so we could likely just merge that PR first. I think it will have some superficial conflicts with this PR, but nothing significant and VSCode merge tool might be able to figure it out. (the tests on that PR are hitting a different bug in Windows, apparently by changing the probability of encountering it on that particular test for the specific issue, so that PR is almost ready to merge, but I need some time to fix the other bug) |
After taking a look, it seems that Lines 590 to 600 in 99fd5d9
which, if it passes, solves most (all?) other tests. The failure is that on the second Adding the following to ...
if !isdefined(result, :ci)
if isa(opt, OptimizationState)
result.src = ir_to_codeinf!(opt)
end
else
...
if inferred_result isa CodeInfo
result.src = inferred_result
...
end
end Any ideas on how to address this? |
We can close this in favor of #57375 |
Several downstream consumers want to cache IRCode rather than CodeInfo. Right now they need to override both
finish!
andtransform_result_for_cache
. With this change, only overriding the latter should be sufficient. As a nice bonus, we can avoid doing the work of converting to CodeInfo for interpreters that don't cache at all such as the REPL interpreter.