diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-07 14:16:52 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-07 14:17:36 -0800 |
| commit | 53f41f07ce2811a975ea6362d6a07b070d4bdf77 (patch) | |
| tree | 087407eba404f6fbe4baaed5b6feafd57f2adc1b /src/librustc/lib | |
| parent | 09758f7072cee989c87bcfd88ac2aa737a26de4d (diff) | |
| download | rust-53f41f07ce2811a975ea6362d6a07b070d4bdf77.tar.gz rust-53f41f07ce2811a975ea6362d6a07b070d4bdf77.zip | |
librustc: Make vectors no longer implicitly copyable in rustc. r=graydon
~20% perf win for trans on -O0, with other minor improvements across the board. No effect on -O2.
Diffstat (limited to 'src/librustc/lib')
| -rw-r--r-- | src/librustc/lib/llvm.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index dbfe3122388..62956341189 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. + use core::cast; use core::cmp; use core::int; @@ -1070,8 +1071,9 @@ fn SetLinkage(Global: ValueRef, Link: Linkage) { type type_names = @{type_names: HashMap<TypeRef, ~str>, named_types: HashMap<~str, TypeRef>}; -fn associate_type(tn: type_names, s: ~str, t: TypeRef) { - assert tn.type_names.insert(t, s); +fn associate_type(tn: type_names, +s: ~str, t: TypeRef) { + // XXX: Bad copy, use @str instead? + assert tn.type_names.insert(t, copy s); assert tn.named_types.insert(s, t); } @@ -1079,7 +1081,7 @@ fn type_has_name(tn: type_names, t: TypeRef) -> Option<~str> { return tn.type_names.find(t); } -fn name_has_type(tn: type_names, s: ~str) -> Option<TypeRef> { +fn name_has_type(tn: type_names, +s: ~str) -> Option<TypeRef> { return tn.named_types.find(s); } @@ -1092,14 +1094,15 @@ fn type_to_str(names: type_names, ty: TypeRef) -> ~str { return type_to_str_inner(names, ~[], ty); } -fn type_to_str_inner(names: type_names, outer0: ~[TypeRef], ty: TypeRef) -> +fn type_to_str_inner(names: type_names, +outer0: ~[TypeRef], ty: TypeRef) -> ~str { match type_has_name(names, ty) { - option::Some(ref n) => return (*n), + option::Some(ref n) => return (/*bad*/copy *n), _ => {} } - let outer = vec::append_one(outer0, ty); + // XXX: Bad copy. + let outer = vec::append_one(copy outer0, ty); let kind = llvm::LLVMGetTypeKind(ty); |
