Skip to content

Commit a307608

Browse files
committed
auto merge of #5066 : catamorphism/rust/luqmana-derecording, r=catamorphism
Most work done by @luqmana and @pcwalton - I just rebased.
2 parents 1b04be6 + ad9c54c commit a307608

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1513
-1136
lines changed

src/librustc/back/arm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use session::sess_os_to_meta_os;
1414
use metadata::loader::meta_section_name;
1515

1616
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
17-
return {
17+
return target_strs::t {
1818
module_asm: ~"",
1919

2020
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),

src/librustc/back/link.rs

+36-21
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use lib::llvm::llvm;
1616
use lib::llvm::{ModuleRef, mk_pass_manager, mk_target_data, True, False};
1717
use lib::llvm::{PassManagerRef, FileType};
1818
use lib;
19-
use metadata::common::link_meta;
19+
use metadata::common::LinkMeta;
2020
use metadata::filesearch;
2121
use metadata::{encoder, cstore};
22-
use middle::trans::common::crate_ctxt;
22+
use middle::trans::common::CrateContext;
2323
use middle::ty;
2424
use session::Session;
2525
use session;
@@ -451,15 +451,16 @@ pub mod write {
451451
*/
452452

453453
pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
454-
symbol_hasher: &hash::State) -> link_meta {
454+
symbol_hasher: &hash::State) -> LinkMeta {
455455

456-
type provided_metas =
457-
{name: Option<@str>,
458-
vers: Option<@str>,
459-
cmh_items: ~[@ast::meta_item]};
456+
struct ProvidedMetas {
457+
name: Option<@str>,
458+
vers: Option<@str>,
459+
cmh_items: ~[@ast::meta_item]
460+
}
460461

461462
fn provided_link_metas(sess: Session, c: &ast::crate) ->
462-
provided_metas {
463+
ProvidedMetas {
463464
let mut name = None;
464465
let mut vers = None;
465466
let mut cmh_items = ~[];
@@ -480,7 +481,12 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
480481
}
481482
} else { cmh_items.push(*meta); }
482483
}
483-
return {name: name, vers: vers, cmh_items: cmh_items};
484+
485+
ProvidedMetas {
486+
name: name,
487+
vers: vers,
488+
cmh_items: cmh_items
489+
}
484490
}
485491

486492
// This calculates CMH as defined above
@@ -563,16 +569,23 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
563569
};
564570
}
565571

566-
let {name: opt_name, vers: opt_vers,
567-
cmh_items: cmh_items} = provided_link_metas(sess, c);
572+
let ProvidedMetas {
573+
name: opt_name,
574+
vers: opt_vers,
575+
cmh_items: cmh_items
576+
} = provided_link_metas(sess, c);
568577
let name = crate_meta_name(sess, output, opt_name);
569578
let vers = crate_meta_vers(sess, opt_vers);
570579
let dep_hashes = cstore::get_dep_hashes(sess.cstore);
571580
let extras_hash =
572581
crate_meta_extras_hash(symbol_hasher, cmh_items,
573582
dep_hashes);
574583

575-
return {name: name, vers: vers, extras_hash: extras_hash};
584+
LinkMeta {
585+
name: name,
586+
vers: vers,
587+
extras_hash: extras_hash
588+
}
576589
}
577590

578591
pub fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
@@ -584,7 +597,7 @@ pub fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
584597

585598
// This calculates STH for a symbol, as defined above
586599
pub fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
587-
link_meta: link_meta) -> @str {
600+
link_meta: LinkMeta) -> @str {
588601
// NB: do *not* use abbrevs here as we want the symbol names
589602
// to be independent of one another in the crate.
590603

@@ -601,7 +614,7 @@ pub fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
601614
hash.to_managed()
602615
}
603616
604-
pub fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
617+
pub fn get_symbol_hash(ccx: @CrateContext, t: ty::t) -> @str {
605618
match ccx.type_hashcodes.find(&t) {
606619
Some(h) => h,
607620
None => {
@@ -673,14 +686,16 @@ pub fn exported_name(sess: Session,
673686
path_name(sess.ident_of(vers.to_owned()))));
674687
}
675688

676-
pub fn mangle_exported_name(ccx: @crate_ctxt, +path: path, t: ty::t) -> ~str {
689+
pub fn mangle_exported_name(ccx: @CrateContext,
690+
+path: path,
691+
t: ty::t) -> ~str {
677692
let hash = get_symbol_hash(ccx, t);
678693
return exported_name(ccx.sess, path,
679694
hash,
680695
ccx.link_meta.vers);
681696
}
682697

683-
pub fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
698+
pub fn mangle_internal_name_by_type_only(ccx: @CrateContext,
684699
t: ty::t,
685700
name: &str) -> ~str {
686701
let s = ppaux::ty_to_short_str(ccx.tcx, t);
@@ -691,23 +706,23 @@ pub fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
691706
path_name(ccx.sess.ident_of(hash.to_owned()))]);
692707
}
693708

694-
pub fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt,
709+
pub fn mangle_internal_name_by_path_and_seq(ccx: @CrateContext,
695710
+path: path,
696711
+flav: ~str) -> ~str {
697712
return mangle(ccx.sess,
698713
vec::append_one(path, path_name((ccx.names)(flav))));
699714
}
700715

701-
pub fn mangle_internal_name_by_path(ccx: @crate_ctxt, +path: path) -> ~str {
716+
pub fn mangle_internal_name_by_path(ccx: @CrateContext, +path: path) -> ~str {
702717
return mangle(ccx.sess, path);
703718
}
704719

705-
pub fn mangle_internal_name_by_seq(ccx: @crate_ctxt, +flav: ~str) -> ~str {
720+
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, +flav: ~str) -> ~str {
706721
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
707722
}
708723

709724

710-
pub fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
725+
pub fn output_dll_filename(os: session::os, lm: LinkMeta) -> ~str {
711726
let libname = fmt!("%s-%s-%s", lm.name, lm.extras_hash, lm.vers);
712727
let (dll_prefix, dll_suffix) = match os {
713728
session::os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
@@ -725,7 +740,7 @@ pub fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
725740
pub fn link_binary(sess: Session,
726741
obj_filename: &Path,
727742
out_filename: &Path,
728-
lm: link_meta) {
743+
lm: LinkMeta) {
729744
// Converts a library file-stem into a cc -l argument
730745
fn unlib(config: @session::config, +stem: ~str) -> ~str {
731746
if stem.starts_with("lib") &&

src/librustc/back/target_strs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// except according to those terms.
1010

1111

12-
pub type t = {
12+
pub struct t {
1313
module_asm: ~str,
1414
meta_sect_name: ~str,
1515
data_layout: ~str,
1616
target_triple: ~str,
1717
cc_args: ~[~str]
18-
};
18+
}

src/librustc/back/upcall.rs

+24-22
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@ use middle::trans::common::{T_fn, T_i1, T_i8, T_i32,
1515
T_int, T_nil,
1616
T_opaque_vec, T_ptr, T_unique_ptr,
1717
T_size_t, T_void, T_vec2};
18-
use lib::llvm::{type_names, ModuleRef, ValueRef, TypeRef};
18+
use lib::llvm::{TypeNames, ModuleRef, ValueRef, TypeRef};
1919

20-
pub type upcalls =
21-
{trace: ValueRef,
22-
call_shim_on_c_stack: ValueRef,
23-
call_shim_on_rust_stack: ValueRef,
24-
rust_personality: ValueRef,
25-
reset_stack_limit: ValueRef};
20+
pub struct Upcalls {
21+
trace: ValueRef,
22+
call_shim_on_c_stack: ValueRef,
23+
call_shim_on_rust_stack: ValueRef,
24+
rust_personality: ValueRef,
25+
reset_stack_limit: ValueRef
26+
}
2627

2728
pub fn declare_upcalls(targ_cfg: @session::config,
28-
llmod: ModuleRef) -> @upcalls {
29+
llmod: ModuleRef) -> @Upcalls {
2930
fn decl(llmod: ModuleRef, prefix: ~str, name: ~str,
3031
tys: ~[TypeRef], rv: TypeRef) ->
3132
ValueRef {
@@ -43,22 +44,23 @@ pub fn declare_upcalls(targ_cfg: @session::config,
4344

4445
let int_t = T_int(targ_cfg);
4546

46-
return @{trace: dv(~"trace", ~[T_ptr(T_i8()),
47+
@Upcalls {
48+
trace: dv(~"trace", ~[T_ptr(T_i8()),
4749
T_ptr(T_i8()),
4850
int_t]),
49-
call_shim_on_c_stack:
50-
d(~"call_shim_on_c_stack",
51-
// arguments: void *args, void *fn_ptr
52-
~[T_ptr(T_i8()), T_ptr(T_i8())],
53-
int_t),
54-
call_shim_on_rust_stack:
55-
d(~"call_shim_on_rust_stack",
56-
~[T_ptr(T_i8()), T_ptr(T_i8())], int_t),
57-
rust_personality:
58-
nothrow(d(~"rust_personality", ~[], T_i32())),
59-
reset_stack_limit:
60-
nothrow(dv(~"reset_stack_limit", ~[]))
61-
};
51+
call_shim_on_c_stack:
52+
d(~"call_shim_on_c_stack",
53+
// arguments: void *args, void *fn_ptr
54+
~[T_ptr(T_i8()), T_ptr(T_i8())],
55+
int_t),
56+
call_shim_on_rust_stack:
57+
d(~"call_shim_on_rust_stack",
58+
~[T_ptr(T_i8()), T_ptr(T_i8())], int_t),
59+
rust_personality:
60+
nothrow(d(~"rust_personality", ~[], T_i32())),
61+
reset_stack_limit:
62+
nothrow(dv(~"reset_stack_limit", ~[]))
63+
}
6264
}
6365
//
6466
// Local Variables:

src/librustc/back/x86.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use metadata::loader::meta_section_name;
1515
use session::sess_os_to_meta_os;
1616

1717
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
18-
return {
18+
return target_strs::t {
1919
module_asm: ~"",
2020

2121
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),

src/librustc/back/x86_64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use metadata::loader::meta_section_name;
1515
use session::sess_os_to_meta_os;
1616

1717
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
18-
return {
18+
return target_strs::t {
1919
module_asm: ~"",
2020

2121
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),

0 commit comments

Comments
 (0)