about summary refs log tree commit diff
path: root/src/librustc/lib
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-01-07 14:16:52 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-01-07 14:17:36 -0800
commit53f41f07ce2811a975ea6362d6a07b070d4bdf77 (patch)
tree087407eba404f6fbe4baaed5b6feafd57f2adc1b /src/librustc/lib
parent09758f7072cee989c87bcfd88ac2aa737a26de4d (diff)
downloadrust-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.rs15
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);