Revision 7bba1757c575525403403994ac6408714067c5af authored by Yichao Yu on 07 November 2017, 04:38:14 UTC, committed by Yichao Yu on 13 December 2017, 19:13:16 UTC
LLVM has really bad support for returns_twice functions and can incorrectly move memory operations
(both at IR and machine code level) due to missing control flow edge.
By outlining the exception body, we can hide these functions from LLVM completely
(they only exist in C code) and prevent all miscompilation.
This also makes it much easier to check the correctness of heap to stack allocation optimization
especially since not all memory operation intrinsics in LLVM has a volatile counterpart.

This will obviously inhibit some valid optimizations too.
These are mainly forwarding of memory operations from the caller to the exception body
(since the other way around is almost always invalid) and can be improved with some simple IPO.

This also makes it unnecessary to mark any memory operations on the stack with `volatile`
this should also improve optimization in certain cases.

Since we are scanning all the instructions in the outlined code anyway this also includes
a simple optimization to delete exception frame that can't trigger.

This implements a tweaked version of https://discourse.julialang.org/t/avoid-llvm-setjmp-bug/1140

Fix #17288
1 parent 87c1d4f
History
File Mode Size
mac
vagrant
windows
README.ackrc.txt -rw-r--r-- 95 bytes
README.md -rw-r--r-- 3.9 KB
ackrc -rw-r--r-- 68 bytes
add_license_to_files.jl -rw-r--r-- 6.8 KB
build_sysimg.jl -rw-r--r-- 8.9 KB
check-whitespace.sh -rwxr-xr-x 791 bytes
commit-name.sh -rwxr-xr-x 1.2 KB
debug_bootstrap.gdb -rw-r--r-- 76 bytes
download_cmake.sh -rwxr-xr-x 1.7 KB
filterArgs.sh -rwxr-xr-x 271 bytes
fixup-libgfortran.sh -rwxr-xr-x 4.9 KB
fixup-libstdc++.sh -rwxr-xr-x 824 bytes
install.sh -rwxr-xr-x 653 bytes
julia-config.jl -rwxr-xr-x 2.1 KB
julia.appdata.xml -rw-r--r-- 1.2 KB
julia.desktop -rw-r--r-- 286 bytes
julia.svg -rw-r--r-- 4.5 KB
prepare_release.sh -rwxr-xr-x 5.0 KB
relative_path.sh -rwxr-xr-x 950 bytes
repackage_system_suitesparse4.make -rwxr-xr-x 2.4 KB
stringreplace.c -rw-r--r-- 942 bytes
travis_fastfail.sh -rwxr-xr-x 1.0 KB
valgrind-julia.supp -rw-r--r-- 166 bytes

README.md

back to top