Merge pull request #526 from klickverbot/newclass-signature

Correct signature of _d_newclass runtime call.
This commit is contained in:
Kai Nacke 2013-10-23 21:43:11 -07:00
commit e5fe110280
5 changed files with 8 additions and 8 deletions

View file

@ -106,7 +106,7 @@ DValue* DtoNewClass(Loc loc, TypeClass* tc, NewExp* newexp)
// default allocator // default allocator
else else
{ {
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, _d_allocclass); llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_newclass");
LLConstant* ci = DtoBitCast(tc->sym->ir.irAggr->getClassInfoSymbol(), DtoType(ClassDeclaration::classinfo->type)); LLConstant* ci = DtoBitCast(tc->sym->ir.irAggr->getClassInfoSymbol(), DtoType(ClassDeclaration::classinfo->type));
mem = gIR->CreateCallOrInvoke(fn, ci, ".newclass_gc_alloc").getInstruction(); mem = gIR->CreateCallOrInvoke(fn, ci, ".newclass_gc_alloc").getInstruction();
mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc"); mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc");

View file

@ -146,6 +146,7 @@ namespace {
: TypeInfoArgNr(typeInfoArgNr), : TypeInfoArgNr(typeInfoArgNr),
SafeToDelete(safeToDelete), SafeToDelete(safeToDelete),
ReturnsArray(returnsArray) {} ReturnsArray(returnsArray) {}
virtual ~FunctionInfo() {}
}; };
class ArrayFI : public FunctionInfo { class ArrayFI : public FunctionInfo {
@ -251,7 +252,7 @@ namespace {
} }
}; };
// FunctionInfo for _d_allocclass // FunctionInfo for _d_newclass
class AllocClassFI : public FunctionInfo { class AllocClassFI : public FunctionInfo {
public: public:
virtual bool analyze(CallSite CS, const Analysis& A) { virtual bool analyze(CallSite CS, const Analysis& A) {
@ -358,7 +359,7 @@ GarbageCollect2Stack::GarbageCollect2Stack()
KnownFunctions["_d_allocmemoryT"] = &AllocMemoryT; KnownFunctions["_d_allocmemoryT"] = &AllocMemoryT;
KnownFunctions["_d_newarrayvT"] = &NewArrayVT; KnownFunctions["_d_newarrayvT"] = &NewArrayVT;
KnownFunctions["_d_newarrayT"] = &NewArrayT; KnownFunctions["_d_newarrayT"] = &NewArrayT;
KnownFunctions[_d_allocclass] = &AllocClass; KnownFunctions["_d_newclass"] = &AllocClass;
} }
static void RemoveCall(CallSite CS, const Analysis& A) { static void RemoveCall(CallSite CS, const Analysis& A) {

View file

@ -363,7 +363,7 @@ void SimplifyDRuntimeCalls::InitOptimizations() {
Optimizations["_d_newarraymT"] = &Allocation; Optimizations["_d_newarraymT"] = &Allocation;
Optimizations["_d_newarraymiT"] = &Allocation; Optimizations["_d_newarraymiT"] = &Allocation;
Optimizations["_d_newarraymvT"] = &Allocation; Optimizations["_d_newarraymvT"] = &Allocation;
Optimizations[_d_allocclass] = &Allocation; Optimizations["_d_newclass"] = &Allocation;
} }

View file

@ -426,11 +426,11 @@ static void LLVM_D_BuildRuntimeModule()
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
} }
// Object _d_allocclass(ClassInfo ci) // Object _d_newclass(const ClassInfo ci)
{ {
llvm::StringRef fname(_d_allocclass); llvm::StringRef fname("_d_newclass");
LLType *types[] = { classInfoTy }; LLType *types[] = { classInfoTy };
LLFunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); LLFunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)
->setAttributes(Attr_NoAlias); ->setAttributes(Attr_NoAlias);
} }

View file

@ -30,7 +30,6 @@ llvm::Function* LLVM_D_GetRuntimeFunction(llvm::Module* target, const char* name
llvm::GlobalVariable* LLVM_D_GetRuntimeGlobal(llvm::Module* target, const char* name); llvm::GlobalVariable* LLVM_D_GetRuntimeGlobal(llvm::Module* target, const char* name);
#define _d_allocclass "_d_newclass"
#define _adEq "_adEq2" #define _adEq "_adEq2"
#define _adCmp "_adCmp2" #define _adCmp "_adCmp2"