@@ -1018,11 +1018,6 @@ pub fn get_landing_pad(bcx: @mut Block) -> BasicBlockRef {
10181018 // The landing pad block is a cleanup
10191019 SetCleanup ( pad_bcx, llretval) ;
10201020
1021- // Because we may have unwound across a stack boundary, we must call into
1022- // the runtime to figure out which stack segment we are on and place the
1023- // stack limit back into the TLS.
1024- Call ( pad_bcx, bcx. ccx ( ) . upcalls . reset_stack_limit , [ ] , [ ] ) ;
1025-
10261021 // We store the retval in a function-central alloca, so that calls to
10271022 // Resume can find it.
10281023 match bcx. fcx . personality {
@@ -1097,28 +1092,6 @@ pub fn load_if_immediate(cx: @mut Block, v: ValueRef, t: ty::t) -> ValueRef {
10971092 return v;
10981093}
10991094
1100- pub fn trans_trace( bcx : @mut Block , sp_opt : Option < Span > , trace_str : @str ) {
1101- if !bcx. sess ( ) . trace ( ) { return ; }
1102- let _icx = push_ctxt ( "trans_trace" ) ;
1103- add_comment ( bcx, trace_str) ;
1104- let V_trace_str = C_cstr ( bcx. ccx ( ) , trace_str) ;
1105- let ( V_filename , V_line ) = match sp_opt {
1106- Some ( sp) => {
1107- let sess = bcx. sess ( ) ;
1108- let loc = sess. parse_sess . cm . lookup_char_pos ( sp. lo ) ;
1109- ( C_cstr ( bcx. ccx ( ) , loc. file . name ) , loc. line as int )
1110- }
1111- None => {
1112- ( C_cstr ( bcx. ccx ( ) , @"<runtime>"), 0)
1113- }
1114- };
1115- let ccx = bcx.ccx();
1116- let V_trace_str = PointerCast(bcx, V_trace_str, Type::i8p());
1117- let V_filename = PointerCast(bcx, V_filename, Type::i8p());
1118- let args = ~[V_trace_str, V_filename, C_int(ccx, V_line)];
1119- Call(bcx, ccx.upcalls.trace, args, []);
1120- }
1121-
11221095pub fn ignore_lhs ( _bcx : @mut Block , local : & ast:: Local ) -> bool {
11231096 match local. pat . node {
11241097 ast:: PatWild => true , _ => false
@@ -1313,12 +1286,6 @@ pub fn cleanup_and_leave(bcx: @mut Block,
13131286 loop {
13141287 debug ! ( "cleanup_and_leave: leaving {}" , cur. to_str( ) ) ;
13151288
1316- if bcx. sess ( ) . trace ( ) {
1317- trans_trace (
1318- bcx, None ,
1319- ( format ! ( "cleanup_and_leave({})" , cur. to_str( ) ) ) . to_managed ( ) ) ;
1320- }
1321-
13221289 let mut cur_scope = cur. scope ;
13231290 loop {
13241291 cur_scope = match cur_scope {
@@ -1387,12 +1354,6 @@ pub fn cleanup_block(bcx: @mut Block, upto: Option<BasicBlockRef>) -> @mut Block
13871354 loop {
13881355 debug ! ( "cleanup_block: {}" , cur. to_str( ) ) ;
13891356
1390- if bcx. sess ( ) . trace ( ) {
1391- trans_trace (
1392- bcx, None ,
1393- ( format ! ( "cleanup_block({})" , cur. to_str( ) ) ) . to_managed ( ) ) ;
1394- }
1395-
13961357 let mut cur_scope = cur. scope ;
13971358 loop {
13981359 cur_scope = match cur_scope {
@@ -2961,6 +2922,11 @@ pub fn create_module_map(ccx: &mut CrateContext) -> (ValueRef, uint) {
29612922 return ( map, keys. len ( ) )
29622923}
29632924
2925+ pub fn symname ( sess : session:: Session , name : & str ,
2926+ hash : & str , vers : & str ) -> ~str {
2927+ let elt = path_name ( sess. ident_of ( name) ) ;
2928+ link:: exported_name ( sess, ~[ elt] , hash, vers)
2929+ }
29642930
29652931pub fn decl_crate_map ( sess : session:: Session , mapmeta : LinkMeta ,
29662932 llmod : ModuleRef ) -> ValueRef {
@@ -2969,13 +2935,14 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
29692935 let mut n_subcrates = 1 ;
29702936 let cstore = sess. cstore ;
29712937 while cstore:: have_crate_data ( cstore, n_subcrates) { n_subcrates += 1 ; }
2972- let mapname = if * sess. building_library && !sess. gen_crate_map ( ) {
2973- format ! ( "{}_{}_{}" , mapmeta. name, mapmeta. vers, mapmeta. extras_hash)
2938+ let is_top = !* sess. building_library || sess. gen_crate_map ( ) ;
2939+ let sym_name = if is_top {
2940+ ~"_rust_crate_map_toplevel"
29742941 } else {
2975- ~"toplevel"
2942+ symname ( sess, "_rust_crate_map_" + mapmeta. name , mapmeta. extras_hash ,
2943+ mapmeta. vers )
29762944 } ;
29772945
2978- let sym_name = ~"_rust_crate_map_" + mapname;
29792946 let slicetype = Type :: struct_ ( [ int_type, int_type] , false ) ;
29802947 let maptype = Type :: struct_ ( [
29812948 Type :: i32 ( ) , // version
@@ -2990,7 +2957,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
29902957 } ) ;
29912958 // On windows we'd like to export the toplevel cratemap
29922959 // such that we can find it from libstd.
2993- if targ_cfg. os == OsWin32 && "toplevel" == mapname {
2960+ if targ_cfg. os == OsWin32 && is_top {
29942961 lib:: llvm:: SetLinkage ( map, lib:: llvm:: DLLExportLinkage ) ;
29952962 } else {
29962963 lib:: llvm:: SetLinkage ( map, lib:: llvm:: ExternalLinkage ) ;
@@ -3005,10 +2972,9 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
30052972 let cstore = ccx. sess . cstore ;
30062973 while cstore:: have_crate_data ( cstore, i) {
30072974 let cdata = cstore:: get_crate_data ( cstore, i) ;
3008- let nm = format ! ( "_rust_crate_map_{}_{}_{}" ,
3009- cdata. name,
3010- cstore:: get_crate_vers( cstore, i) ,
3011- cstore:: get_crate_hash( cstore, i) ) ;
2975+ let nm = symname ( ccx. sess , format ! ( "_rust_crate_map_{}" , cdata. name) ,
2976+ cstore:: get_crate_hash ( cstore, i) ,
2977+ cstore:: get_crate_vers ( cstore, i) ) ;
30122978 let cr = nm. with_c_str ( |buf| {
30132979 unsafe {
30142980 llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
0 commit comments