Mercurial > projects > ldc
diff gen/classes.cpp @ 414:ac1fcc138e42
Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Cleaned up CallExp::toElem, moved implementation to tocall.cpp providing a single procedure to call arbitrary D functions fairly easily.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 28 Jul 2008 02:11:34 +0200 |
parents | 051ab876fe11 |
children | fa91b03d9cd7 |
line wrap: on
line diff
--- a/gen/classes.cpp Sun Jul 27 18:52:40 2008 +0200 +++ b/gen/classes.cpp Mon Jul 28 02:11:34 2008 +0200 @@ -791,20 +791,22 @@ LLValue* mem; if (newexp->onstack) { - mem = new llvm::AllocaInst(DtoType(tc)->getContainedType(0), "newclass_alloca", gIR->topallocapoint()); + mem = new llvm::AllocaInst(DtoType(tc)->getContainedType(0), ".newclass_alloca", gIR->topallocapoint()); } // custom allocator else if (newexp->allocator) { - DValue* res = DtoCallDFunc(newexp->allocator, newexp->newargs); - mem = DtoBitCast(res->getRVal(), DtoType(tc), "newclass_custom"); + DtoForceDeclareDsymbol(newexp->allocator); + DFuncValue dfn(newexp->allocator, newexp->allocator->ir.irFunc->func); + DValue* res = DtoCallFunction(NULL, &dfn, newexp->newargs); + mem = DtoBitCast(res->getRVal(), DtoType(tc), ".newclass_custom"); } // default allocator else { llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_newclass"); - mem = gIR->CreateCallOrInvoke(fn, tc->sym->ir.irStruct->classInfo, "newclass_gc_alloc")->get(); - mem = DtoBitCast(mem, DtoType(tc), "newclass_gc"); + mem = gIR->CreateCallOrInvoke(fn, tc->sym->ir.irStruct->classInfo, ".newclass_gc_alloc")->get(); + mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc"); } // init @@ -848,7 +850,9 @@ if (newexp->member) { assert(newexp->arguments != NULL); - return DtoCallDFunc(newexp->member, newexp->arguments, tc, mem); + DtoForceDeclareDsymbol(newexp->member); + DFuncValue dfn(newexp->member, newexp->member->ir.irFunc->func, mem); + return DtoCallFunction(tc, &dfn, newexp->arguments); } // return default constructed class