Revision 2299d5541b0022bb4e2b0671b8fd081277d7d183 authored by Yichao Yu on 07 November 2017, 04:38:14 UTC, committed by Yichao Yu on 12 November 2017, 02:07:36 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 da34a89
History
File Mode Size
.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.4 KB
CONTRIBUTING.md -rw-r--r-- 20.4 KB
DISTRIBUTING.md -rw-r--r-- 8.2 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.1 KB
NEWS.md -rw-r--r-- 82.1 KB
README.arm.md -rw-r--r-- 5.7 KB
README.md -rw-r--r-- 27.8 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
circle.yml -rw-r--r-- 3.1 KB

README.md

back to top