@@ -1018,11 +1018,6 @@ pub fn get_landing_pad(bcx: @mut Block) -> BasicBlockRef {
1018
1018
// The landing pad block is a cleanup
1019
1019
SetCleanup ( pad_bcx, llretval) ;
1020
1020
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
-
1026
1021
// We store the retval in a function-central alloca, so that calls to
1027
1022
// Resume can find it.
1028
1023
match bcx. fcx . personality {
@@ -1097,28 +1092,6 @@ pub fn load_if_immediate(cx: @mut Block, v: ValueRef, t: ty::t) -> ValueRef {
1097
1092
return v;
1098
1093
}
1099
1094
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
-
1122
1095
pub fn ignore_lhs ( _bcx : @mut Block , local : & ast:: Local ) -> bool {
1123
1096
match local. pat . node {
1124
1097
ast:: PatWild => true , _ => false
@@ -1313,12 +1286,6 @@ pub fn cleanup_and_leave(bcx: @mut Block,
1313
1286
loop {
1314
1287
debug ! ( "cleanup_and_leave: leaving {}" , cur. to_str( ) ) ;
1315
1288
1316
- if bcx. sess ( ) . trace ( ) {
1317
- trans_trace (
1318
- bcx, None ,
1319
- ( format ! ( "cleanup_and_leave({})" , cur. to_str( ) ) ) . to_managed ( ) ) ;
1320
- }
1321
-
1322
1289
let mut cur_scope = cur. scope ;
1323
1290
loop {
1324
1291
cur_scope = match cur_scope {
@@ -1387,12 +1354,6 @@ pub fn cleanup_block(bcx: @mut Block, upto: Option<BasicBlockRef>) -> @mut Block
1387
1354
loop {
1388
1355
debug ! ( "cleanup_block: {}" , cur. to_str( ) ) ;
1389
1356
1390
- if bcx. sess ( ) . trace ( ) {
1391
- trans_trace (
1392
- bcx, None ,
1393
- ( format ! ( "cleanup_block({})" , cur. to_str( ) ) ) . to_managed ( ) ) ;
1394
- }
1395
-
1396
1357
let mut cur_scope = cur. scope ;
1397
1358
loop {
1398
1359
cur_scope = match cur_scope {
@@ -2961,6 +2922,11 @@ pub fn create_module_map(ccx: &mut CrateContext) -> (ValueRef, uint) {
2961
2922
return ( map, keys. len ( ) )
2962
2923
}
2963
2924
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
+ }
2964
2930
2965
2931
pub fn decl_crate_map ( sess : session:: Session , mapmeta : LinkMeta ,
2966
2932
llmod : ModuleRef ) -> ValueRef {
@@ -2969,13 +2935,14 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
2969
2935
let mut n_subcrates = 1 ;
2970
2936
let cstore = sess. cstore ;
2971
2937
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"
2974
2941
} else {
2975
- ~"toplevel"
2942
+ symname ( sess, "_rust_crate_map_" + mapmeta. name , mapmeta. extras_hash ,
2943
+ mapmeta. vers )
2976
2944
} ;
2977
2945
2978
- let sym_name = ~"_rust_crate_map_" + mapname;
2979
2946
let slicetype = Type :: struct_ ( [ int_type, int_type] , false ) ;
2980
2947
let maptype = Type :: struct_ ( [
2981
2948
Type :: i32 ( ) , // version
@@ -2990,7 +2957,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
2990
2957
} ) ;
2991
2958
// On windows we'd like to export the toplevel cratemap
2992
2959
// such that we can find it from libstd.
2993
- if targ_cfg. os == OsWin32 && "toplevel" == mapname {
2960
+ if targ_cfg. os == OsWin32 && is_top {
2994
2961
lib:: llvm:: SetLinkage ( map, lib:: llvm:: DLLExportLinkage ) ;
2995
2962
} else {
2996
2963
lib:: llvm:: SetLinkage ( map, lib:: llvm:: ExternalLinkage ) ;
@@ -3005,10 +2972,9 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
3005
2972
let cstore = ccx. sess . cstore ;
3006
2973
while cstore:: have_crate_data ( cstore, i) {
3007
2974
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) ) ;
3012
2978
let cr = nm. with_c_str ( |buf| {
3013
2979
unsafe {
3014
2980
llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
0 commit comments