diff gen/toir.cpp @ 1633:5c0cebff9be8

Improve array append performance. Actually use the appropriate runtime function, instead of just growing the array by one!
author Christian Kamm <kamm incasoftware de>
date Sun, 14 Feb 2010 10:11:05 +0100
parents 628433c343b4
children 8f121883bce8
line wrap: on
line diff
--- a/gen/toir.cpp	Sun Sep 13 22:15:33 2009 +0300
+++ b/gen/toir.cpp	Sun Feb 14 10:11:05 2010 +0100
@@ -624,7 +624,7 @@
     // valid array ops would have been transformed by optimize
     if ((t1->ty == Tarray || t1->ty == Tsarray) &&
         (t2->ty == Tarray || t2->ty == Tsarray)
-       ) 
+       )
     {
         base->error("Array operation %s not recognized", base->toChars());
         fatal();
@@ -1013,7 +1013,7 @@
         return DtoBitCast(gep, DtoType(type));
     }
     else if (
-        e1->op == TOKstructliteral || 
+        e1->op == TOKstructliteral ||
         e1->op == TOKslice)
     {
         error("non-constant expression '%s'", toChars());
@@ -1138,7 +1138,7 @@
         // decide whether this function needs to be looked up in the vtable
         //
         bool vtbllookup = fdecl->isAbstract() || (!fdecl->isFinal() && fdecl->isVirtual());
-        
+
         // even virtual functions are looked up directly if super or DotTypeExp
         // are used, thus we need to walk through the this expression and check
         Expression* e = e1;
@@ -1150,7 +1150,7 @@
             else
                 break;
         }
-        
+
         //
         // look up function
         //
@@ -1237,12 +1237,12 @@
         arrptr = DtoGEP1(l->getRVal(),r->getRVal());
     }
     else if (e1type->ty == Tsarray) {
-        if(global.params.useArrayBounds) 
+        if(global.params.useArrayBounds)
             DtoArrayBoundsCheck(loc, l, r, false);
         arrptr = DtoGEP(l->getRVal(), zero, r->getRVal());
     }
     else if (e1type->ty == Tarray) {
-        if(global.params.useArrayBounds) 
+        if(global.params.useArrayBounds)
             DtoArrayBoundsCheck(loc, l, r, false);
         arrptr = DtoArrayPtr(l);
         arrptr = DtoGEP1(arrptr,r->getRVal());
@@ -1769,7 +1769,7 @@
 
     // class invariants
     if(
-        global.params.useInvariants && 
+        global.params.useInvariants &&
         condty->ty == Tclass &&
         !((TypeClass*)condty)->sym->isInterfaceDeclaration())
     {
@@ -1780,7 +1780,7 @@
     }
     // struct invariants
     else if(
-        global.params.useInvariants && 
+        global.params.useInvariants &&
         condty->ty == Tpointer && condty->nextOf()->ty == Tstruct &&
         (invdecl = ((TypeStruct*)condty->nextOf())->sym->inv) != NULL)
     {
@@ -2234,8 +2234,7 @@
     Type* e2type = e2->type->toBasetype();
 
     if (e2type == elemtype) {
-        DSliceValue* slice = DtoCatAssignElement(l,e2);
-        DtoAssign(loc, l, slice);
+        DtoCatAssignElement(e1type, l, e2);
     }
     else if (e1type == e2type) {
         DSliceValue* slice = DtoCatAssignArray(l,e2);