comparison dmd/statement.c @ 715:30b42a283c8e

Removed TypeOpaque from DMD. Changed runtime functions taking opaque[] to void[]. Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[]. Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86. Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing. Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way... Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8. Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 22 Oct 2008 14:55:33 +0200
parents eef8ac26c66c
children 7261ff0f95ff
comparison
equal deleted inserted replaced
714:1e98c99a87cb 715:30b42a283c8e
1600 */ 1600 */
1601 //LDC: Build arguments. 1601 //LDC: Build arguments.
1602 static FuncDeclaration *aaApply2_fd = NULL; 1602 static FuncDeclaration *aaApply2_fd = NULL;
1603 if(!aaApply2_fd) { 1603 if(!aaApply2_fd) {
1604 Arguments* args = new Arguments; 1604 Arguments* args = new Arguments;
1605 args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL)); 1605 args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL));
1606 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); 1606 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
1607 Arguments* dgargs = new Arguments; 1607 Arguments* dgargs = new Arguments;
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 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
1610 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); 1610 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
1612 aaApply2_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply2"); 1612 aaApply2_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply2");
1613 } 1613 }
1614 static FuncDeclaration *aaApply_fd = NULL; 1614 static FuncDeclaration *aaApply_fd = NULL;
1615 if(!aaApply_fd) { 1615 if(!aaApply_fd) {
1616 Arguments* args = new Arguments; 1616 Arguments* args = new Arguments;
1617 args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL)); 1617 args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL));
1618 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); 1618 args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
1619 Arguments* dgargs = new Arguments; 1619 Arguments* dgargs = new Arguments;
1620 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); 1620 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
1621 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); 1621 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
1622 args->push(new Argument(STCin, dgty, NULL, NULL)); 1622 args->push(new Argument(STCin, dgty, NULL, NULL));
1667 const char *r = (op == TOKforeach_reverse) ? "R" : ""; 1667 const char *r = (op == TOKforeach_reverse) ? "R" : "";
1668 int j = sprintf(fdname, "_aApply%s%.*s%d", r, 2, fntab[flag], dim); 1668 int j = sprintf(fdname, "_aApply%s%.*s%d", r, 2, fntab[flag], dim);
1669 assert(j < sizeof(fdname)); 1669 assert(j < sizeof(fdname));
1670 //LDC: Build arguments. 1670 //LDC: Build arguments.
1671 Arguments* args = new Arguments; 1671 Arguments* args = new Arguments;
1672 args->push(new Argument(STCin, Type::topaque->arrayOf(), NULL, NULL)); 1672 args->push(new Argument(STCin, tn->arrayOf(), NULL, NULL));
1673 if (dim == 2) { 1673 if (dim == 2) {
1674 Arguments* dgargs = new Arguments; 1674 Arguments* dgargs = new Arguments;
1675 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); 1675 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
1676 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL)); 1676 dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
1677 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd)); 1677 TypeDelegate* dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
1687 1687
1688 ec = new VarExp(0, fdapply); 1688 ec = new VarExp(0, fdapply);
1689 Expressions *exps = new Expressions(); 1689 Expressions *exps = new Expressions();
1690 if (tab->ty == Tsarray) 1690 if (tab->ty == Tsarray)
1691 aggr = aggr->castTo(sc, tn->arrayOf()); 1691 aggr = aggr->castTo(sc, tn->arrayOf());
1692 exps->push(aggr); 1692 exps->push(aggr);
1693 exps->push(flde); 1693 exps->push(flde);
1694 e = new CallExp(loc, ec, exps); 1694 e = new CallExp(loc, ec, exps);
1695 e->type = Type::tindex; // don't run semantic() on e 1695 e->type = Type::tindex; // don't run semantic() on e
1696 } 1696 }
1697 else if (tab->ty == Tdelegate) 1697 else if (tab->ty == Tdelegate)