Skip to content

Commit ec797ee

Browse files
committed
---
yaml --- r: 126392 b: refs/heads/try c: cd2003f h: refs/heads/master v: v3
1 parent 61a286b commit ec797ee

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 2a47fa708cfbf6b90a8ffacbaf00b8250bfa72cd
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
5-
refs/heads/try: cb55279f2378c8f3e8528c8c4c8a0f67d6955cb1
5+
refs/heads/try: cd2003ffd8dd976342f9e8fc1429ae93d6780e81
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustrt/unwind.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,19 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
220220
//
221221
// This is pretty close to Rust's exception handling approach, except that Rust
222222
// does have a single "catch-all" handler at the bottom of each task's stack.
223-
// So we have two versions:
223+
// So we have two versions of the personality routine:
224224
// - rust_eh_personality, used by all cleanup landing pads, which never catches,
225225
// so the behavior of __gcc_personality_v0 is perfectly adequate there, and
226226
// - rust_eh_personality_catch, used only by rust_try(), which always catches.
227-
// This is achieved by overriding the return value in search phase to always
228-
// say "catch!".
227+
//
228+
// Note, however, that for implementation simplicity, rust_eh_personality_catch
229+
// lacks code to install a landing pad, so in order to obtain exception object
230+
// pointer (which it needs to return upstream), rust_try() employs another trick:
231+
// it calls into the nested rust_try_inner(), whose landing pad does not resume
232+
// unwinds. Instead, it extracts the exception pointer and performs a "normal"
233+
// return.
234+
//
235+
// See also: rt/rust_try.ll
229236

230237
#[cfg(not(target_arch = "arm"), not(windows, target_arch = "x86_64"), not(test))]
231238
#[doc(hidden)]
@@ -334,7 +341,8 @@ pub mod eabi {
334341

335342
// ARM EHABI uses a slightly different personality routine signature,
336343
// but otherwise works the same.
337-
#[cfg(target_arch = "arm", not(target_os = "ios", not(test)))]
344+
#[cfg(target_arch = "arm", not(target_os = "ios"), not(test))]
345+
#[doc(hidden)]
338346
#[allow(visible_private_types)]
339347
pub mod eabi {
340348
use uw = libunwind;
@@ -384,10 +392,9 @@ pub mod eabi {
384392
// with an "API translator" layer (_GCC_specific_handler).
385393

386394
#[cfg(windows, target_arch = "x86_64", not(test))]
395+
#[doc(hidden)]
387396
#[allow(visible_private_types)]
388397
#[allow(non_camel_case_types)]
389-
#[allow(unused_variable)]
390-
#[allow(uppercase_variables)]
391398
pub mod eabi {
392399
use uw = libunwind;
393400
use libc::{c_void, c_int};

branches/try/src/rt/rust_try.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
; Rust's try-catch
1212
; When f(...) returns normally, the return value is null.
1313
; When f(...) throws, the return value is a pointer to the caught exception object.
14+
1415
; See also: librustrt/unwind.rs
1516

1617
define i8* @rust_try(void (i8*,i8*)* %f, i8* %fptr, i8* %env) {
@@ -25,7 +26,7 @@ normal:
2526
catch:
2627
landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @rust_eh_personality_catch to i8*)
2728
catch i8* null
28-
; execution will never reach here because rust_try_inner's landing pad does not resume unwinds
29+
; rust_try_inner's landing pad does not resume unwinds, so execution will never reach here
2930
ret i8* null
3031
}
3132

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
22
# The actual contents of this file do not matter, but to trigger a change on the
33
# build bots then the contents should be changed so git updates the mtime.
4-
2014-08-24
4+
2014-08-05

0 commit comments

Comments
 (0)