Revision 2efe155f939a34fcf646f3745197d2384404b02c authored by Shuhei Kadowaki on 31 January 2022, 06:52:03 UTC, committed by Shuhei Kadowaki on 30 May 2022, 03:10:33 UTC
This commit limits the lifetimes of `OptimizationState` and `IRCode`
for a more dataflow clarity. It also avoids duplicated calls of `ir_to_codeinf!`.

Note that external `AbstractInterpreter`s can still extend their
lifetimes to cache additional information, as described by this
newly added documentation of `finish!`:

>     finish!(interp::AbstractInterpreter,
>         opt::OptimizationState, ir::IRCode, caller::InferenceResult)
>
> Runs post-Julia-level optimization process and caches information for later uses:
> - computes "purity" (i.e. side-effect-freeness) of the optimized frame
> - computes inlining cost and cache the inlineability in `opt.src.inlineable`
> - stores the result of optimization in `caller.src`
> * by default, `caller.src` will be an optimized `CodeInfo` object transformed from `ir`
> * in a case when this frame has been proven pure, `ConstAPI` object wrapping the constant
> value will be kept in `caller.src` instead, so that the runtime system will use
> the constant calling convention
>
> !!! note
>     The lifetimes of `opt` and `ir` end by the end of this process.
>     Still external `AbstractInterpreter` can override this method as necessary to cache them.
>     Note that `transform_result_for_cache` should be overloaded also in such cases,
>     otherwise the default `transform_result_for_cache` implmentation will discard any information
>     other than `CodeInfo`, `Vector{UInt8}` or `ConstAPI`.

This commit also adds a new overload `infresult_iterator` so that external
interpreters can tweak the behavior of post processings of `_typeinf`.
Especially, this change is motivated by the need for JET, whose post-optimization
processing needs references of `InferenceState`.
1 parent 18bdbbf
History
File Mode Size
checksums
patches
tools
valgrind
.gitignore -rw-r--r-- 26 bytes
Makefile -rw-r--r-- 5.5 KB
Versions.make -rw-r--r-- 2.7 KB
blastrampoline.mk -rw-r--r-- 1.4 KB
blastrampoline.version -rw-r--r-- 90 bytes
csl.mk -rw-r--r-- 4.6 KB
curl.mk -rw-r--r-- 3.1 KB
dsfmt.mk -rw-r--r-- 2.1 KB
gfortblas.alias -rw-r--r-- 706 bytes
gfortblas.c -rw-r--r-- 4.4 KB
gmp.mk -rw-r--r-- 3.4 KB
libdSFMT.def -rw-r--r-- 778 bytes
libgit2.mk -rw-r--r-- 4.0 KB
libgit2.version -rw-r--r-- 76 bytes
libssh2.mk -rw-r--r-- 2.5 KB
libssh2.version -rw-r--r-- 84 bytes
libsuitesparse.mk -rw-r--r-- 4.9 KB
libuv.mk -rw-r--r-- 1.8 KB
libuv.version -rw-r--r-- 82 bytes
libwhich.mk -rw-r--r-- 1.2 KB
libwhich.version -rw-r--r-- 78 bytes
llvm-options.mk -rw-r--r-- 564 bytes
llvm-ver.make -rw-r--r-- 359 bytes
llvm.mk -rw-r--r-- 10.1 KB
llvm.version -rw-r--r-- 52 bytes
mbedtls.mk -rw-r--r-- 3.3 KB
mpfr.mk -rw-r--r-- 2.6 KB
nghttp2.mk -rw-r--r-- 2.0 KB
objconv.mk -rw-r--r-- 1.0 KB
openblas.mk -rw-r--r-- 8.2 KB
openblas.version -rw-r--r-- 79 bytes
openlibm.mk -rw-r--r-- 1.3 KB
openlibm.version -rw-r--r-- 78 bytes
p7zip.mk -rw-r--r-- 1.6 KB
patchelf.mk -rw-r--r-- 2.1 KB
pcre.mk -rw-r--r-- 2.1 KB
unwind.mk -rw-r--r-- 6.9 KB
utf8proc.mk -rw-r--r-- 1.5 KB
utf8proc.version -rw-r--r-- 78 bytes
zlib.mk -rw-r--r-- 1.3 KB
zlib.version -rw-r--r-- 71 bytes

back to top