Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- a/dmd/statement.c Thu Jul 24 18:21:48 2008 +0200 +++ b/dmd/statement.c Thu Jul 24 18:51:36 2008 +0200 @@ -1599,22 +1599,33 @@ * _aaApply(aggr, keysize, flde) */ //LLVMDC: Build arguments. - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); - if (dim == 2) { + static FuncDeclaration *aaApply2_fd = NULL; + if(!aaApply2_fd) { + Arguments* args = new Arguments; + args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL)); + args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); Arguments* dgargs = new Arguments; dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); args->push(new Argument(STCin, dgty, NULL, NULL)); - fdapply = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply2"); - } else { + aaApply2_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply2"); + } + static FuncDeclaration *aaApply_fd = NULL; + if(!aaApply_fd) { + Arguments* args = new Arguments; + args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL)); + args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); Arguments* dgargs = new Arguments; dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); args->push(new Argument(STCin, dgty, NULL, NULL)); - fdapply = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply"); + aaApply_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply"); + } + if (dim == 2) { + fdapply = aaApply2_fd; + } else { + fdapply = aaApply_fd; } ec = new VarExp(0, fdapply); Expressions *exps = new Expressions();