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
asan
bpftrace
mac
tsan
windows
README.md -rw-r--r-- 2.4 KB
add_license_to_files.jl -rw-r--r-- 7.0 KB
check-whitespace.jl -rwxr-xr-x 1.3 KB
codesign.sh -rwxr-xr-x 1018 bytes
commit-name.sh -rwxr-xr-x 1.2 KB
debug_bootstrap.gdb -rw-r--r-- 76 bytes
delete-all-rpaths.sh -rwxr-xr-x 925 bytes
download_cmake.sh -rwxr-xr-x 2.1 KB
fixup-libgfortran.sh -rwxr-xr-x 6.0 KB
fixup-libstdc++.sh -rwxr-xr-x 878 bytes
fixup-rpath.sh -rwxr-xr-x 1.0 KB
generate_precompile.jl -rw-r--r-- 19.6 KB
httpbin-prod-swagger-apigateway.yaml -rw-r--r-- 3.0 KB
install.sh -rwxr-xr-x 695 bytes
julia-config.jl -rwxr-xr-x 3.7 KB
julia.appdata.xml -rw-r--r-- 1.4 KB
julia.desktop -rw-r--r-- 286 bytes
new-stdlib.sh -rwxr-xr-x 1.8 KB
normalize_triplet.py -rwxr-xr-x 4.3 KB
prepare_release.sh -rwxr-xr-x 5.0 KB
print_sorted_stdlibs.jl -rw-r--r-- 2.7 KB
refresh_checksums.mk -rw-r--r-- 6.2 KB
relative_path.py -rwxr-xr-x 537 bytes
stringreplace.c -rw-r--r-- 942 bytes
updateSPDX.jl -rw-r--r-- 1.1 KB
valgrind-julia.supp -rw-r--r-- 156 bytes

README.md

back to top