summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorElliott Slaughter <eslaughter@mozilla.com>2012-07-23 16:00:19 -0700
committerElliott Slaughter <eslaughter@mozilla.com>2012-07-24 12:20:39 -0700
commitc341eb90522294dda6dbce646d1c0a7170a48bfc (patch)
tree05e85d095128d595c14ae8c49ea666e2a1e68704 /src/libcore
parent0930b953958232022727b83cf9e08a2397656f62 (diff)
downloadrust-c341eb90522294dda6dbce646d1c0a7170a48bfc.tar.gz
rust-c341eb90522294dda6dbce646d1c0a7170a48bfc.zip
Don't emit invoke instructions inside landing pads.
We can't throw an exception from inside a landing pad without
corrupting the exception handler, so we have no hope of dealing with
these exceptions anyway. See:

http://llvm.org/docs/ExceptionHandling.html#cleanups

Part of #2861.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/rt.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/rt.rs b/src/libcore/rt.rs
index 356e81689f0..8990891112d 100644
--- a/src/libcore/rt.rs
+++ b/src/libcore/rt.rs
@@ -37,6 +37,9 @@ fn rt_exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
     ret rustrt::rust_upcall_exchange_malloc(td, size);
 }
 
+// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
+// inside a landing pad may corrupt the state of the exception handler. If a
+// problem occurs, call exit instead.
 #[rt(exchange_free)]
 fn rt_exchange_free(ptr: *c_char) {
     rustrt::rust_upcall_exchange_free(ptr);
@@ -47,6 +50,9 @@ fn rt_malloc(td: *c_char, size: uintptr_t) -> *c_char {
     ret rustrt::rust_upcall_malloc(td, size);
 }
 
+// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
+// inside a landing pad may corrupt the state of the exception handler. If a
+// problem occurs, call exit instead.
 #[rt(free)]
 fn rt_free(ptr: *c_char) {
     rustrt::rust_upcall_free(ptr);