Fixes for closures

This commit is contained in:
Alexey Prokhin
2010-12-15 17:05:16 +03:00
parent 73c851762b
commit 71f653f19b
7 changed files with 62 additions and 12 deletions

View File

@@ -130,6 +130,17 @@ llvm::AllocaInst* DtoRawAlloca(const llvm::Type* lltype, size_t alignment, const
return ai;
}
LLValue* DtoGcMalloc(const llvm::Type* lltype, const char* name)
{
// get runtime function
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_allocmemory");
// parameters
LLValue *size = DtoConstSize_t(getTypeAllocSize(lltype));
// call runtime allocator
LLValue* mem = gIR->CreateCallOrInvoke(fn, size, name).getInstruction();
// cast
return DtoBitCast(mem, getPtrToType(lltype), name);
}
/****************************************************************************************/
/*////////////////////////////////////////////////////////////////////////////////////////