comparison dmd/statement.c @ 389:722f5e90c39c

Made setup for runtime calls in dmd frontend allocate less.
author Christian Kamm <kamm incasoftware de>
date Thu, 24 Jul 2008 18:51:36 +0200
parents 2bf65352fb28
children 6aee82889553
comparison
equal deleted inserted replaced
388:eb110c4730c0 389:722f5e90c39c
1597 1597
1598 /* Call: 1598 /* Call:
1599 * _aaApply(aggr, keysize, flde) 1599 * _aaApply(aggr, keysize, flde)
1600 */ 1600 */
1601 //LLVMDC: Build arguments. 1601 //LLVMDC: Build arguments.
1602 Arguments* args = new Arguments; 1602 static FuncDeclaration *aaApply2_fd = NULL;
1603 args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL)); 1603 if(!aaApply2_fd) {
1604 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); 1604 Arguments* args = new Arguments;
1605 if (dim == 2) { 1605 args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL));
1606 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
1606 Arguments* dgargs = new Arguments; 1607 Arguments* dgargs = new Arguments;
1607 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); 1608 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
1608 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); 1609 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
1609 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); 1610 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
1610 args->push(new Argument(STCin, dgty, NULL, NULL)); 1611 args->push(new Argument(STCin, dgty, NULL, NULL));
1611 fdapply = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply2"); 1612 aaApply2_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply2");
1612 } else { 1613 }
1614 static FuncDeclaration *aaApply_fd = NULL;
1615 if(!aaApply_fd) {
1616 Arguments* args = new Arguments;
1617 args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL));
1618 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
1613 Arguments* dgargs = new Arguments; 1619 Arguments* dgargs = new Arguments;
1614 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); 1620 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
1615 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); 1621 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
1616 args->push(new Argument(STCin, dgty, NULL, NULL)); 1622 args->push(new Argument(STCin, dgty, NULL, NULL));
1617 fdapply = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply"); 1623 aaApply_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply");
1624 }
1625 if (dim == 2) {
1626 fdapply = aaApply2_fd;
1627 } else {
1628 fdapply = aaApply_fd;
1618 } 1629 }
1619 ec = new VarExp(0, fdapply); 1630 ec = new VarExp(0, fdapply);
1620 Expressions *exps = new Expressions(); 1631 Expressions *exps = new Expressions();
1621 exps->push(aggr); 1632 exps->push(aggr);
1622 size_t keysize = taa->key->size(); 1633 size_t keysize = taa->key->size();