Fixed signature of _d_delarray()

This commit is contained in:
Alexey Prokhin 2010-11-02 20:30:06 +03:00
parent fd73072371
commit 0cc3dc369a
2 changed files with 11 additions and 1 deletions

View file

@ -86,10 +86,15 @@ void DtoDeleteArray(DValue* arr)
{ {
// get runtime function // get runtime function
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_delarray"); llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_delarray");
// build args // build args
LLSmallVector<LLValue*,2> arg; LLSmallVector<LLValue*,2> arg;
#if DMDV2
arg.push_back(DtoBitCast(arr->getLVal(), fn->getFunctionType()->getParamType(0)));
#else
arg.push_back(DtoArrayLen(arr)); arg.push_back(DtoArrayLen(arr));
arg.push_back(DtoBitCast(DtoArrayPtr(arr), getVoidPtrType(), ".tmp")); arg.push_back(DtoBitCast(DtoArrayPtr(arr), getVoidPtrType(), ".tmp"));
#endif
// call // call
gIR->CreateCallOrInvoke(fn, arg.begin(), arg.end()); gIR->CreateCallOrInvoke(fn, arg.begin(), arg.end());
} }

View file

@ -431,12 +431,17 @@ static void LLVM_D_BuildRuntimeModule()
->setAttributes(Attr_NoAlias); ->setAttributes(Attr_NoAlias);
} }
// void _d_delarray(size_t plength, void* pdata) // D1: void _d_delarray(size_t plength, void* pdata)
// D2: void _d_delarray(void[]* array)
{ {
llvm::StringRef fname("_d_delarray"); llvm::StringRef fname("_d_delarray");
std::vector<const LLType*> types; std::vector<const LLType*> types;
#if DMDV2
types.push_back(voidArrayPtrTy);
#else
types.push_back(sizeTy); types.push_back(sizeTy);
types.push_back(voidPtrTy); types.push_back(voidPtrTy);
#endif
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
} }