https://github.com/JuliaLang/julia
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
Tip revision: 7bba1757c575525403403994ac6408714067c5af authored by Yichao Yu on 07 November 2017, 04:38:14 UTC
Hide returns_twice function from LLVM passes
Tip revision: 7bba175
File Mode Size
.circleci
.github
base
contrib
deps
doc
etc
examples
src
stdlib
test
ui
.gitignore -rw-r--r-- 213 bytes
.mailmap -rw-r--r-- 9.5 KB
.travis.yml -rw-r--r-- 6.5 KB
CONTRIBUTING.md -rw-r--r-- 20.4 KB
DISTRIBUTING.md -rw-r--r-- 23.6 KB
HISTORY.md -rw-r--r-- 104.0 KB
LICENSE.md -rw-r--r-- 5.5 KB
Make.inc -rw-r--r-- 35.2 KB
Makefile -rw-r--r-- 26.4 KB
NEWS.md -rw-r--r-- 89.8 KB
README.arm.md -rw-r--r-- 5.7 KB
README.md -rw-r--r-- 27.9 KB
README.windows.md -rw-r--r-- 13.0 KB
VERSION -rw-r--r-- 10 bytes
Windows.inc -rw-r--r-- 1.5 KB
appveyor.yml -rw-r--r-- 2.2 KB

README.md

back to top