julia
22f84e7d - Reorganize code to keep code as IRCode slightly longer (#39885)

Commit
4 years ago
Reorganize code to keep code as IRCode slightly longer (#39885) This moved the primary place where IRCode gets converted into CodeInfo into the transform_result_for_cache call, which is a sensible place for it to be since the primary reason we need to convert back to IRCode is to make it acceptable for storing in the global cache. The reason we might want to not perform the conversion, is that the conversion is slightly lossy, because it drops stmtinfo. However, in Cthulhu, I would like to keep the statement info around such that Cthulhu can present it to the user, even in optimized code (i.e. where inlining decided not to inline, I would still like Cthulhu to be able to introspect inference's original annotations). This change makes that possible. In an ideal world, we wouldn't have to do this at all for uncached code, but of course both code_typed and typeinf_ext do look at the code, even if it is uncached. Unfortunately, at the moment we don't really have a good way to indicate whether or not the code will be looked at, so there is a fallback path that always does the conversion if we decided not to do the caching. Some future refactoring can save some additional time here.
Author
Parents
Loading