about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-03-29 16:55:04 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-04-19 11:53:31 -0700
commitf903ae9e72ec02539373da22fd4d025422af7554 (patch)
treeccaf3a5daf113fc468c2e2a00ee10e6034a8ceb5
parent1a36b0f17ef0b59411981fdd25ac9ce4ba7e20e0 (diff)
downloadrust-f903ae9e72ec02539373da22fd4d025422af7554.tar.gz
rust-f903ae9e72ec02539373da22fd4d025422af7554.zip
librustc: Implement fast-ffi and use it in various places
-rw-r--r--src/libcore/libc.rs10
-rw-r--r--src/libcore/unstable/lang.rs12
-rw-r--r--src/libcore/vec.rs2
-rw-r--r--src/librustc/driver/driver.rs9
-rw-r--r--src/librustc/lib/llvm.rs440
-rw-r--r--src/librustc/middle/astencode.rs12
-rw-r--r--src/librustc/middle/trans/base.rs85
-rw-r--r--src/librustc/middle/trans/closure.rs13
-rw-r--r--src/librustc/middle/trans/foreign.rs50
-rw-r--r--src/librustc/middle/trans/inline.rs3
-rw-r--r--src/librustc/middle/trans/meth.rs3
-rw-r--r--src/librustc/middle/trans/monomorphize.rs11
-rw-r--r--src/rt/rust_task.cpp5
-rw-r--r--src/rt/rust_upcall.cpp15
-rw-r--r--src/rt/rustrt.def.in2
-rw-r--r--src/rustllvm/RustWrapper.cpp1
-rw-r--r--src/test/run-pass/auto-encode.rs14
17 files changed, 618 insertions, 69 deletions
diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs
index e5c5b2f9f2c..9d100d1d352 100644
--- a/src/libcore/libc.rs
+++ b/src/libcore/libc.rs
@@ -1109,8 +1109,10 @@ pub mod funcs {
                 // Omitted: putc, putchar (might be macros).
                 unsafe fn puts(s: *c_char) -> c_int;
                 unsafe fn ungetc(c: c_int, stream: *FILE) -> c_int;
+                #[fast_ffi]
                 unsafe fn fread(ptr: *mut c_void, size: size_t,
                          nobj: size_t, stream: *FILE) -> size_t;
+                #[fast_ffi]
                 unsafe fn fwrite(ptr: *c_void, size: size_t,
                           nobj: size_t, stream: *FILE) -> size_t;
                 unsafe fn fseek(stream: *FILE, offset: c_long,
@@ -1144,9 +1146,13 @@ pub mod funcs {
                               -> c_long;
                 unsafe fn strtoul(s: *c_char, endp: **c_char, base: c_int)
                                -> c_ulong;
+                #[fast_ffi]
                 unsafe fn calloc(nobj: size_t, size: size_t) -> *c_void;
+                #[fast_ffi]
                 unsafe fn malloc(size: size_t) -> *c_void;
+                #[fast_ffi]
                 unsafe fn realloc(p: *c_void, size: size_t) -> *c_void;
+                #[fast_ffi]
                 unsafe fn free(p: *c_void);
                 unsafe fn abort() -> !;
                 unsafe fn exit(status: c_int) -> !;
@@ -1340,6 +1346,7 @@ pub mod funcs {
                         textmode: c_int) -> c_int;
 
                 #[link_name = "_read"]
+                #[fast_ffi]
                 unsafe fn read(fd: c_int, buf: *mut c_void, count: c_uint)
                             -> c_int;
 
@@ -1350,6 +1357,7 @@ pub mod funcs {
                 unsafe fn unlink(c: *c_char) -> c_int;
 
                 #[link_name = "_write"]
+                #[fast_ffi]
                 unsafe fn write(fd: c_int, buf: *c_void, count: c_uint)
                              -> c_int;
             }
@@ -1502,6 +1510,7 @@ pub mod funcs {
                 unsafe fn pathconf(path: *c_char, name: c_int) -> c_long;
                 unsafe fn pause() -> c_int;
                 unsafe fn pipe(fds: *mut c_int) -> c_int;
+                #[fast_ffi]
                 unsafe fn read(fd: c_int, buf: *mut c_void,
                         count: size_t) -> ssize_t;
                 unsafe fn rmdir(path: *c_char) -> c_int;
@@ -1514,6 +1523,7 @@ pub mod funcs {
                 unsafe fn tcgetpgrp(fd: c_int) -> pid_t;
                 unsafe fn ttyname(fd: c_int) -> *c_char;
                 unsafe fn unlink(c: *c_char) -> c_int;
+                #[fast_ffi]
                 unsafe fn write(fd: c_int, buf: *c_void, count: size_t)
                              -> ssize_t;
             }
diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs
index be776a39742..611862a79e7 100644
--- a/src/libcore/unstable/lang.rs
+++ b/src/libcore/unstable/lang.rs
@@ -35,6 +35,14 @@ pub mod rustrt {
 
         #[rust_stack]
         unsafe fn rust_upcall_free(ptr: *c_char);
+
+        #[fast_ffi]
+        unsafe fn rust_upcall_malloc_noswitch(td: *c_char,
+                                              size: uintptr_t)
+                                           -> *c_char;
+
+        #[fast_ffi]
+        unsafe fn rust_upcall_free_noswitch(ptr: *c_char);
     }
 }
 
@@ -81,7 +89,7 @@ pub unsafe fn exchange_free(ptr: *c_char) {
 #[lang="malloc"]
 #[inline(always)]
 pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
-    return rustrt::rust_upcall_malloc(td, size);
+    return rustrt::rust_upcall_malloc_noswitch(td, size);
 }
 
 // NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
@@ -90,7 +98,7 @@ pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
 #[lang="free"]
 #[inline(always)]
 pub unsafe fn local_free(ptr: *c_char) {
-    rustrt::rust_upcall_free(ptr);
+    rustrt::rust_upcall_free_noswitch(ptr);
 }
 
 #[lang="borrow_as_imm"]
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 139fcedad27..f6492ede9f9 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -43,9 +43,11 @@ pub mod rustrt {
     pub extern {
         // These names are terrible. reserve_shared applies
         // to ~[] and reserve_shared_actual applies to @[].
+        #[fast_ffi]
         unsafe fn vec_reserve_shared(++t: *sys::TypeDesc,
                                      ++v: **raw::VecRepr,
                                      ++n: libc::size_t);
+        #[fast_ffi]
         unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
                                             ++v: **raw::VecRepr,
                                             ++n: libc::size_t);
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index 355bc137666..7ea1fe80158 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -172,10 +172,13 @@ pub enum compile_upto {
 
 // For continuing compilation after a parsed crate has been
 // modified
-pub fn compile_rest(sess: Session, cfg: ast::crate_cfg,
-                    upto: compile_upto, outputs: Option<@OutputFilenames>,
+#[fixed_stack_segment]
+pub fn compile_rest(sess: Session,
+                    cfg: ast::crate_cfg,
+                    upto: compile_upto,
+                    outputs: Option<@OutputFilenames>,
                     curr: Option<@ast::crate>)
-    -> (@ast::crate, Option<ty::ctxt>) {
+                 -> (@ast::crate, Option<ty::ctxt>) {
     let time_passes = sess.time_passes();
     let mut crate = curr.get();
 
diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs
index 06f7261040c..0ab883d330d 100644
--- a/src/librustc/lib/llvm.rs
+++ b/src/librustc/lib/llvm.rs
@@ -234,438 +234,624 @@ pub mod llvm {
     #[abi = "cdecl"]
     pub extern {
         /* Create and destroy contexts. */
+        #[fast_ffi]
         pub unsafe fn LLVMContextCreate() -> ContextRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetGlobalContext() -> ContextRef;
+        #[fast_ffi]
         pub unsafe fn LLVMContextDispose(C: ContextRef);
+        #[fast_ffi]
         pub unsafe fn LLVMGetMDKindIDInContext(C: ContextRef,
                                            Name: *c_char,
                                            SLen: c_uint)
                                         -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetMDKindID(Name: *c_char, SLen: c_uint) -> c_uint;
 
         /* Create and destroy modules. */
+        #[fast_ffi]
         pub unsafe fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char,
                                                     C: ContextRef)
                                                  -> ModuleRef;
+        #[fast_ffi]
         pub unsafe fn LLVMDisposeModule(M: ModuleRef);
 
         /** Data layout. See Module::getDataLayout. */
+        #[fast_ffi]
         pub unsafe fn LLVMGetDataLayout(M: ModuleRef) -> *c_char;
+        #[fast_ffi]
         pub unsafe fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char);
 
         /** Target triple. See Module::getTargetTriple. */
+        #[fast_ffi]
         pub unsafe fn LLVMGetTarget(M: ModuleRef) -> *c_char;
+        #[fast_ffi]
         pub unsafe fn LLVMSetTarget(M: ModuleRef, Triple: *c_char);
 
         /** See Module::dump. */
+        #[fast_ffi]
         pub unsafe fn LLVMDumpModule(M: ModuleRef);
 
         /** See Module::setModuleInlineAsm. */
+        #[fast_ffi]
         pub unsafe fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char);
 
         /** See llvm::LLVMTypeKind::getTypeID. */
         pub unsafe fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind;
 
         /** See llvm::LLVMType::getContext. */
+        #[fast_ffi]
         pub unsafe fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef;
 
         /* Operations on integer types */
+        #[fast_ffi]
         pub unsafe fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMIntTypeInContext(C: ContextRef,
                                            NumBits: c_uint) -> TypeRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMInt1Type() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInt8Type() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInt16Type() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInt32Type() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInt64Type() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMIntType(NumBits: c_uint) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
 
         /* Operations on real types */
+        #[fast_ffi]
         pub unsafe fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMFloatType() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMDoubleType() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMX86FP80Type() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMFP128Type() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMPPCFP128Type() -> TypeRef;
 
         /* Operations on function types */
+        #[fast_ffi]
         pub unsafe fn LLVMFunctionType(ReturnType: TypeRef,
                                        ParamTypes: *TypeRef,
                                        ParamCount: c_uint,
                                        IsVarArg: Bool)
                                     -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef);
 
         /* Operations on struct types */
+        #[fast_ffi]
         pub unsafe fn LLVMStructTypeInContext(C: ContextRef,
                                               ElementTypes: *TypeRef,
                                               ElementCount: c_uint,
                                               Packed: Bool) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMStructType(ElementTypes: *TypeRef,
                                      ElementCount: c_uint,
                                      Packed: Bool)
                                   -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMCountStructElementTypes(StructTy: TypeRef)
                                                -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetStructElementTypes(StructTy: TypeRef,
                                             Dest: *mut TypeRef);
+        #[fast_ffi]
         pub unsafe fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
 
         /* Operations on array, pointer, and vector types (sequence types) */
+        #[fast_ffi]
         pub unsafe fn LLVMArrayType(ElementType: TypeRef,
                          ElementCount: c_uint) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMPointerType(ElementType: TypeRef,
                            AddressSpace: c_uint) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMVectorType(ElementType: TypeRef,
                           ElementCount: c_uint) -> TypeRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetPointerAddressSpace(PointerTy: TypeRef)
                                               -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
 
         /* Operations on other types */
+        #[fast_ffi]
         pub unsafe fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMVoidType() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMLabelType() -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMMetadataType() -> TypeRef;
 
         /* Operations on all values */
+        #[fast_ffi]
         pub unsafe fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetValueName(Val: ValueRef) -> *c_char;
+        #[fast_ffi]
         pub unsafe fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
+        #[fast_ffi]
         pub unsafe fn LLVMDumpValue(Val: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMReplaceAllUsesWith(OldVal: ValueRef,
                                              NewVal: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMHasMetadata(Val: ValueRef) -> c_int;
+        #[fast_ffi]
         pub unsafe fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMSetMetadata(Val: ValueRef,
                                       KindID: c_uint,
                                       Node: ValueRef);
 
         /* Operations on Uses */
+        #[fast_ffi]
         pub unsafe fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetNextUse(U: UseRef) -> UseRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetUser(U: UseRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetUsedValue(U: UseRef) -> ValueRef;
 
         /* Operations on Users */
+        #[fast_ffi]
         pub unsafe fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
+        #[fast_ffi]
         pub unsafe fn LLVMGetOperand(Val: ValueRef, Index: c_uint)
                                   -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMSetOperand(Val: ValueRef,
                                      Index: c_uint,
                                      Op: ValueRef);
 
         /* Operations on constants of any type */
+        #[fast_ffi]
         pub unsafe fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
         /* all zeroes */
+        #[fast_ffi]
         pub unsafe fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
         /* only for int/vector */
+        #[fast_ffi]
         pub unsafe fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMIsConstant(Val: ValueRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMIsNull(Val: ValueRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMIsUndef(Val: ValueRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef;
 
         /* Operations on metadata */
+        #[fast_ffi]
         pub unsafe fn LLVMMDStringInContext(C: ContextRef,
                                         Str: *c_char,
                                         SLen: c_uint)
                                      -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMMDString(Str: *c_char, SLen: c_uint) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMMDNodeInContext(C: ContextRef,
                                       Vals: *ValueRef,
                                       Count: c_uint)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMMDNode(Vals: *ValueRef, Count: c_uint) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: *c_char,
                                        Val: ValueRef);
 
         /* Operations on scalar constants */
+        #[fast_ffi]
         pub unsafe fn LLVMConstInt(IntTy: TypeRef,
                                N: c_ulonglong,
                                SignExtend: Bool)
                             -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstIntOfString(IntTy: TypeRef,
                                        Text: *c_char,
                                        Radix: u8)
                                     -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
                                                   Text: *c_char,
                                                   SLen: c_uint,
                                                   Radix: u8)
                                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstRealOfString(RealTy: TypeRef,
                                         Text: *c_char)
                                      -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
                                                    Text: *c_char,
                                                    SLen: c_uint)
                                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef)
                                             -> c_ulonglong;
+        #[fast_ffi]
         pub unsafe fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef)
                                             -> c_longlong;
 
 
         /* Operations on composite constants */
+        #[fast_ffi]
         pub unsafe fn LLVMConstStringInContext(C: ContextRef,
                                            Str: *c_char,
                                            Length: c_uint,
                                            DontNullTerminate: Bool)
                                         -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstStructInContext(C: ContextRef,
                                                ConstantVals: *ValueRef,
                                                Count: c_uint,
                                                Packed: Bool) -> ValueRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMConstString(Str: *c_char,
                                       Length: c_uint,
                                       DontNullTerminate: Bool)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstArray(ElementTy: TypeRef,
                                      ConstantVals: *ValueRef,
                                      Length: c_uint)
                                   -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstStruct(ConstantVals: *ValueRef,
                                       Count: c_uint,
                                       Packed: Bool) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstVector(ScalarConstantVals: *ValueRef,
                                       Size: c_uint) -> ValueRef;
 
         /* Constant expressions */
+        #[fast_ffi]
         pub unsafe fn LLVMAlignOf(Ty: TypeRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstAdd(LHSConstant: ValueRef,
                                    RHSConstant: ValueRef)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNSWAdd(LHSConstant: ValueRef,
                                   RHSConstant: ValueRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNUWAdd(LHSConstant: ValueRef,
                                   RHSConstant: ValueRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFAdd(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstSub(LHSConstant: ValueRef,
                                    RHSConstant: ValueRef)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNSWSub(LHSConstant: ValueRef,
                                       RHSConstant: ValueRef)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNUWSub(LHSConstant: ValueRef,
                                       RHSConstant: ValueRef)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFSub(LHSConstant: ValueRef,
                                     RHSConstant: ValueRef)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstMul(LHSConstant: ValueRef,
                                RHSConstant: ValueRef)
                             -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNSWMul(LHSConstant: ValueRef,
                                   RHSConstant: ValueRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstNUWMul(LHSConstant: ValueRef,
                                   RHSConstant: ValueRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFMul(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstUDiv(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstSDiv(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstExactSDiv(LHSConstant: ValueRef,
                                      RHSConstant: ValueRef)
                                   -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFDiv(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstURem(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstSRem(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFRem(LHSConstant: ValueRef,
                                 RHSConstant: ValueRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstAnd(LHSConstant: ValueRef,
                                RHSConstant: ValueRef)
                             -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstOr(LHSConstant: ValueRef,
                               RHSConstant: ValueRef)
                            -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstXor(LHSConstant: ValueRef,
                                RHSConstant: ValueRef)
                             -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstShl(LHSConstant: ValueRef,
                                RHSConstant: ValueRef)
                             -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstLShr(LHSConstant: ValueRef,
                                     RHSConstant: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstAShr(LHSConstant: ValueRef,
                                     RHSConstant: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstGEP(ConstantVal: ValueRef,
                         ConstantIndices: *ValueRef,
                         NumIndices: c_uint) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
                                        ConstantIndices: *ValueRef,
                                        NumIndices: c_uint)
                                     -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstTrunc(ConstantVal: ValueRef,
                                  ToType: TypeRef)
                               -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstSExt(ConstantVal: ValueRef,
                                 ToType: TypeRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstZExt(ConstantVal: ValueRef,
                                 ToType: TypeRef)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFPTrunc(ConstantVal: ValueRef,
                                    ToType: TypeRef)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFPExt(ConstantVal: ValueRef,
                                  ToType: TypeRef)
                               -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstUIToFP(ConstantVal: ValueRef,
                                   ToType: TypeRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstSIToFP(ConstantVal: ValueRef,
                                   ToType: TypeRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFPToUI(ConstantVal: ValueRef,
                                   ToType: TypeRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFPToSI(ConstantVal: ValueRef,
                                   ToType: TypeRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstPtrToInt(ConstantVal: ValueRef,
                                     ToType: TypeRef)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstIntToPtr(ConstantVal: ValueRef,
                                     ToType: TypeRef)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstBitCast(ConstantVal: ValueRef,
                                    ToType: TypeRef)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef,
                                          ToType: TypeRef)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef,
                                          ToType: TypeRef)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef,
                                           ToType: TypeRef)
                                        -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstPointerCast(ConstantVal: ValueRef,
                                        ToType: TypeRef)
                                     -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstIntCast(ConstantVal: ValueRef,
                                        ToType: TypeRef,
                                        isSigned: Bool)
                                     -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstFPCast(ConstantVal: ValueRef,
                                   ToType: TypeRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstSelect(ConstantCondition: ValueRef,
                                       ConstantIfTrue: ValueRef,
                                       ConstantIfFalse: ValueRef)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstExtractElement(VectorConstant: ValueRef,
                                    IndexConstant: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstInsertElement(VectorConstant: ValueRef,
                                   ElementValueConstant: ValueRef,
                                   IndexConstant: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
                                   VectorBConstant: ValueRef,
                                   MaskConstant: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstExtractValue(AggConstant: ValueRef,
                                             IdxList: *c_uint,
                                             NumIdx: c_uint) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstInsertValue(AggConstant: ValueRef,
                                            ElementValueConstant: ValueRef,
                                            IdxList: *c_uint,
                                            NumIdx: c_uint)
                                         -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *c_char,
                               Constraints: *c_char, HasSideEffects: Bool,
                               IsAlignStack: Bool) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef)
                                     -> ValueRef;
 
 
 
         /* Operations on global variables, functions, and aliases (globals) */
+        #[fast_ffi]
         pub unsafe fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
+        #[fast_ffi]
         pub unsafe fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMGetLinkage(Global: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMSetLinkage(Global: ValueRef, Link: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMGetSection(Global: ValueRef) -> *c_char;
+        #[fast_ffi]
         pub unsafe fn LLVMSetSection(Global: ValueRef, Section: *c_char);
+        #[fast_ffi]
         pub unsafe fn LLVMGetVisibility(Global: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
 
 
         /* Operations on global variables */
+        #[fast_ffi]
         pub unsafe fn LLVMAddGlobal(M: ModuleRef,
                                 Ty: TypeRef,
                                 Name: *c_char)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMAddGlobalInAddressSpace(M: ModuleRef,
                                               Ty: TypeRef,
                                               Name: *c_char,
                                               AddressSpace: c_uint)
                                            -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMDeleteGlobal(GlobalVar: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMSetInitializer(GlobalVar: ValueRef,
                                          ConstantVal: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMSetThreadLocal(GlobalVar: ValueRef,
                                          IsThreadLocal: Bool);
+        #[fast_ffi]
         pub unsafe fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMSetGlobalConstant(GlobalVar: ValueRef,
                                             IsConstant: Bool);
 
         /* Operations on aliases */
+        #[fast_ffi]
         pub unsafe fn LLVMAddAlias(M: ModuleRef,
                                    Ty: TypeRef,
                                    Aliasee: ValueRef,
@@ -673,161 +859,242 @@ pub mod llvm {
                                 -> ValueRef;
 
         /* Operations on functions */
+        #[fast_ffi]
         pub unsafe fn LLVMAddFunction(M: ModuleRef,
                                   Name: *c_char,
                                   FunctionTy: TypeRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetNamedFunction(M: ModuleRef,
                                            Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMDeleteFunction(Fn: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMGetOrInsertFunction(M: ModuleRef, Name: *c_char,
                                    FunctionTy: TypeRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMGetGC(Fn: ValueRef) -> *c_char;
+        #[fast_ffi]
         pub unsafe fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
+        #[fast_ffi]
         pub unsafe fn LLVMAddFunctionAttr(Fn: ValueRef,
-                                          PA: c_ulonglong,
-                                          HighPA: c_ulonglong);
+                                          PA: c_uint,
+                                          HighPA: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
+        #[fast_ffi]
         pub unsafe fn LLVMRemoveFunctionAttr(Fn: ValueRef,
                                              PA: c_ulonglong,
                                              HighPA: c_ulonglong);
 
         /* Operations on parameters */
+        #[fast_ffi]
         pub unsafe fn LLVMCountParams(Fn: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMGetAttribute(Arg: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint);
 
         /* Operations on basic blocks */
+        #[fast_ffi]
         pub unsafe fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetBasicBlocks(Fn: ValueRef,
                                          BasicBlocks: *ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetNextBasicBlock(BB: BasicBlockRef)
                                          -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef)
                                              -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMAppendBasicBlockInContext(C: ContextRef,
                                                     Fn: ValueRef,
                                                     Name: *c_char)
                                                  -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInsertBasicBlockInContext(C: ContextRef,
                                                     BB: BasicBlockRef,
                                                     Name: *c_char)
                                                  -> BasicBlockRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMAppendBasicBlock(Fn: ValueRef,
                                        Name: *c_char)
                                     -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMInsertBasicBlock(InsertBeforeBB: BasicBlockRef,
                                        Name: *c_char)
                                     -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
 
         /* Operations on instructions */
+        #[fast_ffi]
         pub unsafe fn LLVMGetInstructionParent(Inst: ValueRef)
                                             -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef;
 
         /* Operations on call sites */
+        #[fast_ffi]
         pub unsafe fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMAddInstrAttribute(Instr: ValueRef,
                                             index: c_uint,
                                             IA: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMRemoveInstrAttribute(Instr: ValueRef,
                                                index: c_uint,
                                                IA: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMSetInstrParamAlignment(Instr: ValueRef,
                                                  index: c_uint,
                                                  align: c_uint);
 
         /* Operations on call instructions (only) */
+        #[fast_ffi]
         pub unsafe fn LLVMIsTailCall(CallInst: ValueRef) -> Bool;
+        #[fast_ffi]
         pub unsafe fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
 
         /* Operations on phi nodes */
+        #[fast_ffi]
         pub unsafe fn LLVMAddIncoming(PhiNode: ValueRef,
                                       IncomingValues: *ValueRef,
                                       IncomingBlocks: *BasicBlockRef,
                                       Count: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint;
+        #[fast_ffi]
         pub unsafe fn LLVMGetIncomingValue(PhiNode: ValueRef,
                                        Index: c_uint)
                                     -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMGetIncomingBlock(PhiNode: ValueRef,
                                 Index: c_uint) -> BasicBlockRef;
 
         /* Instruction builders */
+        #[fast_ffi]
         pub unsafe fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
+        #[fast_ffi]
         pub unsafe fn LLVMCreateBuilder() -> BuilderRef;
+        #[fast_ffi]
         pub unsafe fn LLVMPositionBuilder(Builder: BuilderRef,
                                           Block: BasicBlockRef,
                                           Instr: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMPositionBuilderBefore(Builder: BuilderRef,
                                                 Instr: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
                                                Block: BasicBlockRef);
+        #[fast_ffi]
         pub unsafe fn LLVMGetInsertBlock(Builder: BuilderRef)
                                       -> BasicBlockRef;
+        #[fast_ffi]
         pub unsafe fn LLVMClearInsertionPosition(Builder: BuilderRef);
+        #[fast_ffi]
         pub unsafe fn LLVMInsertIntoBuilder(Builder: BuilderRef,
                                             Instr: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
                                                 Instr: ValueRef,
                                                 Name: *c_char);
+        #[fast_ffi]
         pub unsafe fn LLVMDisposeBuilder(Builder: BuilderRef);
 
         /* Metadata */
+        #[fast_ffi]
         pub unsafe fn LLVMSetCurrentDebugLocation(Builder: BuilderRef,
                                                   L: ValueRef);
+        #[fast_ffi]
         pub unsafe fn LLVMGetCurrentDebugLocation(Builder: BuilderRef)
                                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMSetInstDebugLocation(Builder: BuilderRef,
                                                Inst: ValueRef);
 
         /* Terminators */
+        #[fast_ffi]
         pub unsafe fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef,
                                  N: c_uint) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildCondBr(B: BuilderRef,
                                   If: ValueRef,
                                   Then: BasicBlockRef,
                                   Else: BasicBlockRef)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildSwitch(B: BuilderRef, V: ValueRef,
                                       Else: BasicBlockRef, NumCases: c_uint)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef,
                                NumDests: c_uint) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildInvoke(B: BuilderRef,
                                       Fn: ValueRef,
                                       Args: *ValueRef,
@@ -835,367 +1102,447 @@ pub mod llvm {
                                       Then: BasicBlockRef,
                                       Catch: BasicBlockRef,
                                       Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildLandingPad(B: BuilderRef,
                                       Ty: TypeRef,
                                       PersFn: ValueRef,
                                       NumClauses: c_uint,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
 
         /* Add a case to the switch instruction */
+        #[fast_ffi]
         pub unsafe fn LLVMAddCase(Switch: ValueRef,
                               OnVal: ValueRef,
                               Dest: BasicBlockRef);
 
         /* Add a destination to the indirectbr instruction */
+        #[fast_ffi]
         pub unsafe fn LLVMAddDestination(IndirectBr: ValueRef,
                                          Dest: BasicBlockRef);
 
         /* Add a clause to the landing pad instruction */
+        #[fast_ffi]
         pub unsafe fn LLVMAddClause(LandingPad: ValueRef,
                                     ClauseVal: ValueRef);
 
         /* Set the cleanup on a landing pad instruction */
+        #[fast_ffi]
         pub unsafe fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
 
         /* Arithmetic */
+        #[fast_ffi]
         pub unsafe fn LLVMBuildAdd(B: BuilderRef,
                                    LHS: ValueRef,
                                    RHS: ValueRef,
                                    Name: *c_char)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNSWAdd(B: BuilderRef,
                                       LHS: ValueRef,
                                       RHS: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNUWAdd(B: BuilderRef,
                                       LHS: ValueRef,
                                       RHS: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFAdd(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildSub(B: BuilderRef,
                                    LHS: ValueRef,
                                    RHS: ValueRef,
                                    Name: *c_char)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNSWSub(B: BuilderRef,
                                       LHS: ValueRef,
                                       RHS: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNUWSub(B: BuilderRef,
                                       LHS: ValueRef,
                                       RHS: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFSub(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildMul(B: BuilderRef,
                                    LHS: ValueRef,
                                    RHS: ValueRef,
                                    Name: *c_char)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNSWMul(B: BuilderRef,
                                       LHS: ValueRef,
                                       RHS: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNUWMul(B: BuilderRef,
                                       LHS: ValueRef,
                                       RHS: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFMul(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildUDiv(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildSDiv(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildExactSDiv(B: BuilderRef,
                                          LHS: ValueRef,
                                          RHS: ValueRef,
                                          Name: *c_char)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFDiv(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildURem(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildSRem(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFRem(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildShl(B: BuilderRef,
                                    LHS: ValueRef,
                                    RHS: ValueRef,
                                    Name: *c_char)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildLShr(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildAShr(B: BuilderRef,
                                     LHS: ValueRef,
                                     RHS: ValueRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildAnd(B: BuilderRef,
                                    LHS: ValueRef,
                                    RHS: ValueRef,
                                    Name: *c_char)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildOr(B: BuilderRef,
                                   LHS: ValueRef,
                                   RHS: ValueRef,
                                   Name: *c_char)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildXor(B: BuilderRef,
                                    LHS: ValueRef,
                                    RHS: ValueRef,
                                    Name: *c_char)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildBinOp(B: BuilderRef,
                                  Op: Opcode,
                                  LHS: ValueRef,
                                  RHS: ValueRef,
                                  Name: *c_char)
                               -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNeg(B: BuilderRef,
                                V: ValueRef,
                                Name: *c_char)
                             -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNSWNeg(B: BuilderRef,
                                   V: ValueRef,
                                   Name: *c_char)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNUWNeg(B: BuilderRef,
                                   V: ValueRef,
                                   Name: *c_char)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFNeg(B: BuilderRef,
                                 V: ValueRef,
                                 Name: *c_char)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildNot(B: BuilderRef,
                                V: ValueRef,
                                Name: *c_char)
                             -> ValueRef;
 
         /* Memory */
+        #[fast_ffi]
         pub unsafe fn LLVMBuildMalloc(B: BuilderRef,
                                       Ty: TypeRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildArrayMalloc(B: BuilderRef,
                                            Ty: TypeRef,
                                            Val: ValueRef,
                                            Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildAlloca(B: BuilderRef,
                                   Ty: TypeRef,
                                   Name: *c_char)
                                -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildArrayAlloca(B: BuilderRef,
                                            Ty: TypeRef,
                                            Val: ValueRef,
                                            Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFree(B: BuilderRef,
                                     PointerVal: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildLoad(B: BuilderRef,
                                 PointerVal: ValueRef,
                                 Name: *c_char)
                              -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildStore(B: BuilderRef,
                                      Val: ValueRef,
                                      Ptr: ValueRef) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildGEP(B: BuilderRef,
                                Pointer: ValueRef,
                                Indices: *ValueRef,
                                NumIndices: c_uint,
                                Name: *c_char)
                             -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef,
                                 Indices: *ValueRef, NumIndices: c_uint,
                                 Name: *c_char)
            -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildStructGEP(B: BuilderRef,
                                      Pointer: ValueRef,
                                      Idx: c_uint,
                                      Name: *c_char)
                                   -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildGlobalString(B: BuilderRef,
                                         Str: *c_char,
                                         Name: *c_char)
                                      -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildGlobalStringPtr(B: BuilderRef,
                                            Str: *c_char,
                                            Name: *c_char)
                                         -> ValueRef;
 
         /* Casts */
+        #[fast_ffi]
         pub unsafe fn LLVMBuildTrunc(B: BuilderRef,
                                      Val: ValueRef,
                                      DestTy: TypeRef,
                                      Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildZExt(B: BuilderRef,
                                     Val: ValueRef,
                                     DestTy: TypeRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildSExt(B: BuilderRef,
                                     Val: ValueRef,
                                     DestTy: TypeRef,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFPToUI(B: BuilderRef,
                                       Val: ValueRef,
                                       DestTy: TypeRef,
                                       Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFPToSI(B: BuilderRef,
                                       Val: ValueRef,
                                       DestTy: TypeRef,
                                       Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildUIToFP(B: BuilderRef,
                                       Val: ValueRef,
                                       DestTy: TypeRef,
                                       Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildSIToFP(B: BuilderRef,
                                       Val: ValueRef,
                                       DestTy: TypeRef,
                                       Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFPTrunc(B: BuilderRef,
                                        Val: ValueRef,
                                        DestTy: TypeRef,
                                        Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFPExt(B: BuilderRef,
                                      Val: ValueRef,
                                      DestTy: TypeRef,
                                      Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildPtrToInt(B: BuilderRef,
                                         Val: ValueRef,
                                         DestTy: TypeRef,
                                         Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildIntToPtr(B: BuilderRef,
                                         Val: ValueRef,
                                         DestTy: TypeRef,
                                         Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildBitCast(B: BuilderRef,
                                        Val: ValueRef,
                                        DestTy: TypeRef,
                                        Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildZExtOrBitCast(B: BuilderRef,
                                          Val: ValueRef,
                                          DestTy: TypeRef,
                                          Name: *c_char)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildSExtOrBitCast(B: BuilderRef,
                                          Val: ValueRef,
                                          DestTy: TypeRef,
                                          Name: *c_char)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildTruncOrBitCast(B: BuilderRef,
                                           Val: ValueRef,
                                           DestTy: TypeRef,
                                           Name: *c_char)
                                        -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildCast(B: BuilderRef, Op: Opcode, Val: ValueRef,
                          DestTy: TypeRef, Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildPointerCast(B: BuilderRef,
                                        Val: ValueRef,
                                        DestTy: TypeRef,
                                        Name: *c_char)
                                     -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildIntCast(B: BuilderRef,
                                        Val: ValueRef,
                                        DestTy: TypeRef,
                                        Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFPCast(B: BuilderRef,
                                       Val: ValueRef,
                                       DestTy: TypeRef,
                                       Name: *c_char) -> ValueRef;
 
         /* Comparisons */
+        #[fast_ffi]
         pub unsafe fn LLVMBuildICmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
                          RHS: ValueRef, Name: *c_char) -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildFCmp(B: BuilderRef, Op: c_uint, LHS: ValueRef,
                          RHS: ValueRef, Name: *c_char) -> ValueRef;
 
         /* Miscellaneous instructions */
+        #[fast_ffi]
         pub unsafe fn LLVMBuildPhi(B: BuilderRef,
                                    Ty: TypeRef,
                                    Name: *c_char)
                                 -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildCall(B: BuilderRef,
                                     Fn: ValueRef,
                                     Args: *ValueRef,
                                     NumArgs: c_uint,
                                     Name: *c_char)
                                  -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildSelect(B: BuilderRef,
                                       If: ValueRef,
                                       Then: ValueRef,
                                       Else: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildVAArg(B: BuilderRef,
                                      list: ValueRef,
                                      Ty: TypeRef,
                                      Name: *c_char)
                                   -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildExtractElement(B: BuilderRef,
                                           VecVal: ValueRef,
                                           Index: ValueRef,
                                           Name: *c_char)
                                        -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildInsertElement(B: BuilderRef,
                                          VecVal: ValueRef,
                                          EltVal: ValueRef,
                                          Index: ValueRef,
                                          Name: *c_char)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildShuffleVector(B: BuilderRef,
                                          V1: ValueRef,
                                          V2: ValueRef,
                                          Mask: ValueRef,
                                          Name: *c_char)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildExtractValue(B: BuilderRef,
                                         AggVal: ValueRef,
                                         Index: c_uint,
                                         Name: *c_char)
                                      -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildInsertValue(B: BuilderRef,
                                        AggVal: ValueRef,
                                        EltVal: ValueRef,
@@ -1203,14 +1550,17 @@ pub mod llvm {
                                        Name: *c_char)
                                     -> ValueRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMBuildIsNull(B: BuilderRef,
                                       Val: ValueRef,
                                       Name: *c_char)
                                    -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildIsNotNull(B: BuilderRef,
                                          Val: ValueRef,
                                          Name: *c_char)
                                       -> ValueRef;
+        #[fast_ffi]
         pub unsafe fn LLVMBuildPtrDiff(B: BuilderRef,
                                        LHS: ValueRef,
                                        RHS: ValueRef,
@@ -1225,155 +1575,227 @@ pub mod llvm {
                               ++Order: AtomicOrdering) -> ValueRef;
 
         /* Selected entries from the downcasts. */
+        #[fast_ffi]
         pub unsafe fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
 
         /** Writes a module to the specified path. Returns 0 on success. */
+        #[fast_ffi]
         pub unsafe fn LLVMWriteBitcodeToFile(M: ModuleRef,
                                              Path: *c_char) -> c_int;
 
         /** Creates target data from a target layout string. */
+        #[fast_ffi]
         pub unsafe fn LLVMCreateTargetData(StringRep: *c_char)
                                         -> TargetDataRef;
         /** Adds the target data to the given pass manager. The pass manager
             references the target data only weakly. */
+        #[fast_ffi]
         pub unsafe fn LLVMAddTargetData(TD: TargetDataRef,
                                         PM: PassManagerRef);
         /** Number of bytes clobbered when doing a Store to *T. */
+        #[fast_ffi]
         pub unsafe fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
             -> c_ulonglong;
 
         /** Number of bytes clobbered when doing a Store to *T. */
+        #[fast_ffi]
         pub unsafe fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef)
             -> c_ulonglong;
 
         /** Distance between successive elements in an array of T.
         Includes ABI padding. */
+        #[fast_ffi]
         pub unsafe fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef)
                                      -> c_uint;
 
         /** Returns the preferred alignment of a type. */
+        #[fast_ffi]
         pub unsafe fn LLVMPreferredAlignmentOfType(TD: TargetDataRef,
                                         Ty: TypeRef) -> c_uint;
         /** Returns the minimum alignment of a type. */
+        #[fast_ffi]
         pub unsafe fn LLVMABIAlignmentOfType(TD: TargetDataRef,
                                   Ty: TypeRef) -> c_uint;
         /**
          * Returns the minimum alignment of a type when part of a call frame.
          */
+        #[fast_ffi]
         pub unsafe fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef,
                                                    Ty: TypeRef)
                                                 -> c_uint;
 
         /** Disposes target data. */
+        #[fast_ffi]
         pub unsafe fn LLVMDisposeTargetData(TD: TargetDataRef);
 
         /** Creates a pass manager. */
+        #[fast_ffi]
         pub unsafe fn LLVMCreatePassManager() -> PassManagerRef;
         /** Disposes a pass manager. */
+        #[fast_ffi]
         pub unsafe fn LLVMDisposePassManager(PM: PassManagerRef);
         /** Runs a pass manager on a module. */
+        #[fast_ffi]
         pub unsafe fn LLVMRunPassManager(PM: PassManagerRef,
                                          M: ModuleRef) -> Bool;
 
         /** Adds a verification pass. */
+        #[fast_ffi]
         pub unsafe fn LLVMAddVerifierPass(PM: PassManagerRef);
 
+        #[fast_ffi]
         pub unsafe fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddIPSCCPPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddInstructionCombiningPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddCFGSimplificationPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddFunctionInliningPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddFunctionAttrsPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddJumpThreadingPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddConstantPropagationPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddReassociatePass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddLoopRotatePass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddLICMPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddLoopUnswitchPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddLoopDeletionPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddLoopUnrollPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddGVNPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddMemCpyOptPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddSCCPPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddConstantMergePass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddArgumentPromotionPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddTailCallEliminationPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddCorrelatedValuePropagationPass(PM:
                                                             PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddPruneEHPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddEarlyCSEPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef);
+        #[fast_ffi]
         pub unsafe fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
 
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderDispose(PMB:
                                                     PassManagerBuilderRef);
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderSetOptLevel(
             PMB: PassManagerBuilderRef, OptimizationLevel: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderSetSizeLevel(
             PMB: PassManagerBuilderRef, Value: Bool);
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderSetDisableUnitAtATime(
             PMB: PassManagerBuilderRef, Value: Bool);
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderSetDisableUnrollLoops(
             PMB: PassManagerBuilderRef, Value: Bool);
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls
             (PMB: PassManagerBuilderRef, Value: Bool);
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderUseInlinerWithThreshold
             (PMB: PassManagerBuilderRef, threshold: c_uint);
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderPopulateModulePassManager
             (PMB: PassManagerBuilderRef, PM: PassManagerRef);
 
+        #[fast_ffi]
         pub unsafe fn LLVMPassManagerBuilderPopulateFunctionPassManager
             (PMB: PassManagerBuilderRef, PM: PassManagerRef);
 
         /** Destroys a memory buffer. */
+        #[fast_ffi]
         pub unsafe fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
 
 
         /* Stuff that's in rustllvm/ because it's not upstream yet. */
 
         /** Opens an object file. */
+        #[fast_ffi]
         pub unsafe fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef)
                                         -> ObjectFileRef;
         /** Closes an object file. */
+        #[fast_ffi]
         pub unsafe fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
 
         /** Enumerates the sections in an object file. */
+        #[fast_ffi]
         pub unsafe fn LLVMGetSections(ObjFile: ObjectFileRef)
                                    -> SectionIteratorRef;
         /** Destroys a section iterator. */
+        #[fast_ffi]
         pub unsafe fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
         /** Returns true if the section iterator is at the end of the section
             list: */
+        #[fast_ffi]
         pub unsafe fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef,
                                       SI: SectionIteratorRef) -> Bool;
         /** Moves the section iterator to point to the next section. */
+        #[fast_ffi]
         pub unsafe fn LLVMMoveToNextSection(SI: SectionIteratorRef);
         /** Returns the current section name. */
+        #[fast_ffi]
         pub unsafe fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char;
         /** Returns the current section size. */
+        #[fast_ffi]
         pub unsafe fn LLVMGetSectionSize(SI: SectionIteratorRef)
                                       -> c_ulonglong;
         /** Returns the current section contents as a string buffer. */
+        #[fast_ffi]
         pub unsafe fn LLVMGetSectionContents(SI: SectionIteratorRef)
                                           -> *c_char;
 
         /** Reads the given file and returns it as a memory buffer. Use
             LLVMDisposeMemoryBuffer() to get rid of it. */
+        #[fast_ffi]
         pub unsafe fn LLVMRustCreateMemoryBufferWithContentsOfFile(
                 Path: *c_char)
              -> MemoryBufferRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef,
                                               M: ModuleRef,
                                               Triple: *c_char,
@@ -1387,17 +1809,21 @@ pub mod llvm {
 
         /** Returns a string describing the last error caused by an LLVMRust*
             call. */
+        #[fast_ffi]
         pub unsafe fn LLVMRustGetLastError() -> *c_char;
 
         /** Prepare the JIT. Returns a memory manager that can load crates. */
+        #[fast_ffi]
         pub unsafe fn LLVMRustPrepareJIT(__morestack: *()) -> *();
 
         /** Load a crate into the memory manager. */
+        #[fast_ffi]
         pub unsafe fn LLVMRustLoadCrate(MM: *(),
                                         Filename: *c_char)
                                      -> bool;
 
         /** Execute the JIT engine. */
+        #[fast_ffi]
         pub unsafe fn LLVMRustExecuteJIT(MM: *(),
                               PM: PassManagerRef,
                               M: ModuleRef,
@@ -1405,40 +1831,50 @@ pub mod llvm {
                               EnableSegmentedStacks: bool) -> *();
 
         /** Parses the bitcode in the given memory buffer. */
+        #[fast_ffi]
         pub unsafe fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef)
                                         -> ModuleRef;
 
         /** Parses LLVM asm in the given file */
+        #[fast_ffi]
         pub unsafe fn LLVMRustParseAssemblyFile(Filename: *c_char)
                                              -> ModuleRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMRustAddPrintModulePass(PM: PassManagerRef,
                                                  M: ModuleRef,
                                                  Output: *c_char);
 
         /** Turn on LLVM pass-timing. */
+        #[fast_ffi]
         pub unsafe fn LLVMRustEnableTimePasses();
 
         /// Print the pass timings since static dtors aren't picking them up.
+        #[fast_ffi]
         pub unsafe fn LLVMRustPrintPassTimings();
 
+        #[fast_ffi]
         pub unsafe fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char)
                                          -> TypeRef;
 
+        #[fast_ffi]
         pub unsafe fn LLVMStructSetBody(StructTy: TypeRef,
                                         ElementTypes: *TypeRef,
                                         ElementCount: c_uint,
                                         Packed: Bool);
 
+        #[fast_ffi]
         pub unsafe fn LLVMConstNamedStruct(S: TypeRef,
                                            ConstantVals: *ValueRef,
                                            Count: c_uint)
                                         -> ValueRef;
 
         /** Enables LLVM debug output. */
+        #[fast_ffi]
         pub unsafe fn LLVMSetDebug(Enabled: c_int);
 
         /** Prepares inline assembly. */
+        #[fast_ffi]
         pub unsafe fn LLVMInlineAsm(Ty: TypeRef, AsmString: *c_char,
                                     Constraints: *c_char, SideEffects: Bool,
                                     AlignStack: Bool, Dialect: c_uint)
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index f9a3c0fab72..a67be995171 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -1336,17 +1336,7 @@ fn roundtrip(in_item: Option<@ast::item>) {
     let ebml_doc = reader::Doc(@bytes);
     let out_item = decode_item_ast(ebml_doc);
 
-    let exp_str = do io::with_str_writer |w| {
-        in_item.encode(&prettyprint::Serializer(w))
-    };
-    let out_str = do io::with_str_writer |w| {
-        out_item.encode(&prettyprint::Serializer(w))
-    };
-
-    debug!("expected string: %s", exp_str);
-    debug!("actual string  : %s", out_str);
-
-    assert!(exp_str == out_str);
+    assert_eq!(in_item, out_item);
 }
 
 #[test]
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index cd6b23aadad..46813974af1 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -399,24 +399,24 @@ pub fn set_optimize_for_size(f: ValueRef) {
     unsafe {
         llvm::LLVMAddFunctionAttr(f,
                                   lib::llvm::OptimizeForSizeAttribute
-                                  as c_ulonglong,
-                                  0u as c_ulonglong);
+                                    as c_uint,
+                                  0);
     }
 }
 
 pub fn set_no_inline(f: ValueRef) {
     unsafe {
         llvm::LLVMAddFunctionAttr(f,
-                                  lib::llvm::NoInlineAttribute as c_ulonglong,
-                                  0u as c_ulonglong);
+                                  lib::llvm::NoInlineAttribute as c_uint,
+                                  0);
     }
 }
 
 pub fn set_no_unwind(f: ValueRef) {
     unsafe {
         llvm::LLVMAddFunctionAttr(f,
-                                  lib::llvm::NoUnwindAttribute as c_ulonglong,
-                                  0u as c_ulonglong);
+                                  lib::llvm::NoUnwindAttribute as c_uint,
+                                  0);
     }
 }
 
@@ -425,15 +425,16 @@ pub fn set_no_unwind(f: ValueRef) {
 pub fn set_uwtable(f: ValueRef) {
     unsafe {
         llvm::LLVMAddFunctionAttr(f,
-                                  lib::llvm::UWTableAttribute as c_ulonglong,
-                                  0u as c_ulonglong);
+                                  lib::llvm::UWTableAttribute as c_uint,
+                                  0);
     }
 }
 
 pub fn set_inline_hint(f: ValueRef) {
     unsafe {
-        llvm::LLVMAddFunctionAttr(f, lib::llvm::InlineHintAttribute
-                                  as c_ulonglong, 0u as c_ulonglong);
+        llvm::LLVMAddFunctionAttr(f,
+                                  lib::llvm::InlineHintAttribute as c_uint,
+                                  0);
     }
 }
 
@@ -449,14 +450,15 @@ pub fn set_inline_hint_if_appr(attrs: &[ast::attribute],
 
 pub fn set_always_inline(f: ValueRef) {
     unsafe {
-        llvm::LLVMAddFunctionAttr(f, lib::llvm::AlwaysInlineAttribute
-                                  as c_ulonglong, 0u as c_ulonglong);
+        llvm::LLVMAddFunctionAttr(f,
+                                  lib::llvm::AlwaysInlineAttribute as c_uint,
+                                  0);
     }
 }
 
-pub fn set_custom_stack_growth_fn(f: ValueRef) {
+pub fn set_fixed_stack_segment(f: ValueRef) {
     unsafe {
-        llvm::LLVMAddFunctionAttr(f, 0u as c_ulonglong, 1u as c_ulonglong);
+        llvm::LLVMAddFunctionAttr(f, 0, 1 << (39 - 32));
     }
 }
 
@@ -1774,6 +1776,7 @@ pub fn trans_closure(ccx: @CrateContext,
                      param_substs: Option<@param_substs>,
                      id: ast::node_id,
                      impl_id: Option<ast::def_id>,
+                     attributes: &[ast::attribute],
                      maybe_load_env: &fn(fn_ctxt),
                      finish: &fn(block)) {
     ccx.stats.n_closures += 1;
@@ -1784,10 +1787,20 @@ pub fn trans_closure(ccx: @CrateContext,
            param_substs.repr(ccx.tcx));
 
     // Set up arguments to the function.
-    let fcx = new_fn_ctxt_w_id(ccx, path, llfndecl, id, impl_id, param_substs,
-                                  Some(body.span));
-    let raw_llargs = create_llargs_for_fn_args(fcx, ty_self,
-                                               decl.inputs);
+    let fcx = new_fn_ctxt_w_id(ccx,
+                               path,
+                               llfndecl,
+                               id,
+                               impl_id,
+                               param_substs,
+                               Some(body.span));
+    let raw_llargs = create_llargs_for_fn_args(fcx, ty_self, decl.inputs);
+
+    // Set the fixed stack segment flag if necessary.
+    if attr::attrs_contains_name(attributes, "fixed_stack_segment") {
+        set_no_inline(fcx.llfn);
+        set_fixed_stack_segment(fcx.llfn);
+    }
 
     // Set GC for function.
     if ccx.sess.opts.gc {
@@ -1840,7 +1853,8 @@ pub fn trans_fn(ccx: @CrateContext,
                 ty_self: self_arg,
                 param_substs: Option<@param_substs>,
                 id: ast::node_id,
-                impl_id: Option<ast::def_id>) {
+                impl_id: Option<ast::def_id>,
+                attrs: &[ast::attribute]) {
     let do_time = ccx.sess.trans_stats();
     let start = if do_time { time::get_time() }
                 else { time::Timespec::new(0, 0) };
@@ -1850,8 +1864,16 @@ pub fn trans_fn(ccx: @CrateContext,
     let _icx = ccx.insn_ctxt("trans_fn");
     ccx.stats.n_fns += 1;
     let the_path_str = path_str(ccx.sess, path);
-    trans_closure(ccx, path, decl, body, llfndecl, ty_self,
-                  param_substs, id, impl_id,
+    trans_closure(ccx,
+                  path,
+                  decl,
+                  body,
+                  llfndecl,
+                  ty_self,
+                  param_substs,
+                  id,
+                  impl_id,
+                  attrs,
                   |fcx| {
                       if ccx.sess.opts.extra_debuginfo {
                           debuginfo::create_function(fcx);
@@ -2023,8 +2045,16 @@ pub fn trans_struct_dtor(ccx: @CrateContext,
   }
   /* Translate the dtor body */
   let decl = ast_util::dtor_dec();
-  trans_fn(ccx, path, &decl, body, lldecl,
-           impl_self(class_ty), psubsts, dtor_id, None);
+  trans_fn(ccx,
+           path,
+           &decl,
+           body,
+           lldecl,
+           impl_self(class_ty),
+           psubsts,
+           dtor_id,
+           None,
+           []);
   lldecl
 }
 
@@ -2073,7 +2103,14 @@ pub fn trans_item(ccx: @CrateContext, item: ast::item) {
             let llfndecl = get_item_val(ccx, item.id);
             trans_fn(ccx,
                      vec::append(/*bad*/copy *path, ~[path_name(item.ident)]),
-                     decl, body, llfndecl, no_self, None, item.id, None);
+                     decl,
+                     body,
+                     llfndecl,
+                     no_self,
+                     None,
+                     item.id,
+                     None,
+                     item.attrs);
         } else {
             for body.node.stmts.each |stmt| {
                 match stmt.node {
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index 0ef9d4af604..380a512d17b 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -416,9 +416,16 @@ pub fn trans_expr_fn(bcx: block,
                                                  None => None};
             let ClosureResult {llbox, cdata_ty, bcx}
                 = build_closure(bcx, cap_vars, sigil, ret_handle);
-            trans_closure(ccx, sub_path, decl,
-                          body, llfn, no_self,
-                          /*bad*/ copy bcx.fcx.param_substs, user_id, None,
+            trans_closure(ccx,
+                          sub_path,
+                          decl,
+                          body,
+                          llfn,
+                          no_self,
+                          /*bad*/ copy bcx.fcx.param_substs,
+                          user_id,
+                          None,
+                          [],
                           |fcx| load_environment(fcx, cdata_ty, cap_vars,
                                                  ret_handle.is_some(), sigil),
                           |bcx| {
diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs
index 1037a4c0710..8c308bfa889 100644
--- a/src/librustc/middle/trans/foreign.rs
+++ b/src/librustc/middle/trans/foreign.rs
@@ -316,11 +316,11 @@ pub fn trans_foreign_mod(ccx: @CrateContext,
     {
         let llwrapfn = get_item_val(ccx, id);
         let tys = shim_types(ccx, id);
-        if attr::attrs_contains_name(
-            foreign_item.attrs, "rust_stack")
-        {
+        if attr::attrs_contains_name(foreign_item.attrs, "rust_stack") {
             build_direct_fn(ccx, llwrapfn, foreign_item,
                             &tys, cc);
+        } else if attr::attrs_contains_name(foreign_item.attrs, "fast_ffi") {
+            build_fast_ffi_fn(ccx, llwrapfn, foreign_item, &tys, cc);
         } else {
             let llshimfn = build_shim_fn(ccx, foreign_item,
                                          &tys, cc);
@@ -380,16 +380,47 @@ pub fn trans_foreign_mod(ccx: @CrateContext,
     fn build_direct_fn(ccx: @CrateContext, decl: ValueRef,
                        item: @ast::foreign_item, tys: &ShimTypes,
                        cc: lib::llvm::CallConv) {
+        debug!("build_direct_fn(%s)", *link_name(ccx, item));
+
+        let fcx = new_fn_ctxt(ccx, ~[], decl, None);
+        let bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
+        let llbasefn = base_fn(ccx, *link_name(ccx, item), tys, cc);
+        let ty = ty::lookup_item_type(ccx.tcx,
+                                      ast_util::local_def(item.id)).ty;
+        let args = vec::from_fn(ty::ty_fn_args(ty).len(), |i| {
+            get_param(decl, i + first_real_arg)
+        });
+        let retval = Call(bcx, llbasefn, args);
+        let ret_ty = ty::ty_fn_ret(ty);
+        if !ty::type_is_nil(ret_ty) && !ty::type_is_bot(ret_ty) {
+            Store(bcx, retval, fcx.llretptr);
+        }
+        build_return(bcx);
+        finish_fn(fcx, lltop);
+    }
+
+    // FIXME (#2535): this is very shaky and probably gets ABIs wrong all
+    // over the place
+    fn build_fast_ffi_fn(ccx: @CrateContext,
+                         decl: ValueRef,
+                         item: @ast::foreign_item,
+                         tys: &ShimTypes,
+                         cc: lib::llvm::CallConv) {
+        debug!("build_fast_ffi_fn(%s)", *link_name(ccx, item));
+
         let fcx = new_fn_ctxt(ccx, ~[], decl, None);
         let bcx = top_scope_block(fcx, None), lltop = bcx.llbb;
         let llbasefn = base_fn(ccx, *link_name(ccx, item), tys, cc);
+        set_no_inline(fcx.llfn);
+        set_fixed_stack_segment(fcx.llfn);
         let ty = ty::lookup_item_type(ccx.tcx,
                                       ast_util::local_def(item.id)).ty;
         let args = vec::from_fn(ty::ty_fn_args(ty).len(), |i| {
             get_param(decl, i + first_real_arg)
         });
         let retval = Call(bcx, llbasefn, args);
-        if !ty::type_is_nil(ty::ty_fn_ret(ty)) {
+        let ret_ty = ty::ty_fn_ret(ty);
+        if !ty::type_is_nil(ret_ty) && !ty::type_is_bot(ret_ty) {
             Store(bcx, retval, fcx.llretptr);
         }
         build_return(bcx);
@@ -1006,7 +1037,16 @@ pub fn trans_foreign_fn(ccx: @CrateContext,
             )));
         let llty = type_of_fn_from_ty(ccx, t);
         let llfndecl = decl_internal_cdecl_fn(ccx.llmod, ps, llty);
-        trans_fn(ccx, path, decl, body, llfndecl, no_self, None, id, None);
+        trans_fn(ccx,
+                 path,
+                 decl,
+                 body,
+                 llfndecl,
+                 no_self,
+                 None,
+                 id,
+                 None,
+                 []);
         return llfndecl;
     }
 
diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs
index 15c2e8e3d93..3f2fb95513a 100644
--- a/src/librustc/middle/trans/inline.rs
+++ b/src/librustc/middle/trans/inline.rs
@@ -116,7 +116,8 @@ pub fn maybe_instantiate_inline(ccx: @CrateContext, fn_id: ast::def_id,
                          self_kind,
                          None,
                          mth.id,
-                         Some(impl_did));
+                         Some(impl_did),
+                         []);
             }
             local_def(mth.id)
           }
diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs
index c518605faf1..d3a15cbbfe1 100644
--- a/src/librustc/middle/trans/meth.rs
+++ b/src/librustc/middle/trans/meth.rs
@@ -137,7 +137,8 @@ pub fn trans_method(ccx: @CrateContext,
              self_arg,
              param_substs,
              method.id,
-             Some(impl_id));
+             Some(impl_id),
+             []);
 }
 
 pub fn trans_self_arg(bcx: block,
diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs
index c6ade350e0b..a6930b339ae 100644
--- a/src/librustc/middle/trans/monomorphize.rs
+++ b/src/librustc/middle/trans/monomorphize.rs
@@ -195,7 +195,16 @@ pub fn monomorphic_fn(ccx: @CrateContext,
             }, _) => {
         let d = mk_lldecl();
         set_inline_hint_if_appr(/*bad*/copy i.attrs, d);
-        trans_fn(ccx, pt, decl, body, d, no_self, psubsts, fn_id.node, None);
+        trans_fn(ccx,
+                 pt,
+                 decl,
+                 body,
+                 d,
+                 no_self,
+                 psubsts,
+                 fn_id.node,
+                 None,
+                 []);
         d
       }
       ast_map::node_item(*) => {
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index 63dc1c9833e..021811ffa76 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -457,8 +457,9 @@ rust_task::get_next_stack_size(size_t min, size_t current, size_t requested) {
         "min: %" PRIdPTR " current: %" PRIdPTR " requested: %" PRIdPTR,
         min, current, requested);
 
-    // Allocate at least enough to accomodate the next frame
-    size_t sz = std::max(min, requested);
+    // Allocate at least enough to accomodate the next frame, plus a little
+    // slack to avoid thrashing
+    size_t sz = std::max(min, requested + (requested / 2));
 
     // And double the stack size each allocation
     const size_t max = 1024 * 1024;
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 9f39e1433fc..e524e6de859 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -191,6 +191,14 @@ rust_upcall_malloc(type_desc *td, uintptr_t size) {
     return upcall_malloc(td, size);
 }
 
+extern "C" CDECL uintptr_t
+rust_upcall_malloc_noswitch(type_desc *td, uintptr_t size) {
+    rust_task *task = rust_get_current_task();
+    s_malloc_args args = {task, 0, td, size};
+    upcall_s_malloc(&args);
+    return args.retval;
+}
+
 /**********************************************************************
  * Called whenever an object in the task-local heap is freed.
  */
@@ -231,6 +239,13 @@ rust_upcall_free(void* ptr) {
     upcall_free(ptr);
 }
 
+extern "C" CDECL void
+rust_upcall_free_noswitch(void* ptr) {
+    rust_task *task = rust_get_current_task();
+    s_free_args args = {task,ptr};
+    upcall_s_free(&args);
+}
+
 /**********************************************************************/
 
 extern "C" _Unwind_Reason_Code
diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in
index f63e3f53a7c..4a79b2e4ae6 100644
--- a/src/rt/rustrt.def.in
+++ b/src/rt/rustrt.def.in
@@ -66,7 +66,9 @@ upcall_del_stack
 upcall_reset_stack_limit
 rust_upcall_fail
 rust_upcall_free
+rust_upcall_free_noswitch
 rust_upcall_malloc
+rust_upcall_malloc_noswitch
 rust_uv_loop_new
 rust_uv_loop_delete
 rust_uv_walk
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 5d422b2d2ed..1612fec4029 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -451,6 +451,7 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
   TargetOptions Options;
   Options.NoFramePointerElim = true;
   Options.EnableSegmentedStacks = EnableSegmentedStacks;
+  Options.FixedStackSegmentSize = 2 * 1024 * 1024;  // XXX: This is too big.
 
   PassManager *PM = unwrap<PassManager>(PMR);
 
diff --git a/src/test/run-pass/auto-encode.rs b/src/test/run-pass/auto-encode.rs
index 372f8ab4bc8..bfc15acaa76 100644
--- a/src/test/run-pass/auto-encode.rs
+++ b/src/test/run-pass/auto-encode.rs
@@ -25,20 +25,6 @@ use std::ebml;
 use std::serialize::{Decodable, Encodable};
 use std::time;
 
-<<<<<<< HEAD
-=======
-fn test_prettyprint<A:Encodable<prettyprint::Serializer>>(
-    a: &A,
-    expected: &~str
-) {
-    let s = do io::with_str_writer |w| {
-        a.encode(&prettyprint::Serializer(w))
-    };
-    debug!("s == %?", s);
-    assert!(s == *expected);
-}
-
->>>>>>> librustc: Remove `fail_unless!`
 fn test_ebml<A:
     Eq +
     Encodable<EBWriter::Encoder> +