diff --git a/gen/classes.cpp b/gen/classes.cpp index 2e8e13b6..75874099 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -106,7 +106,7 @@ DValue* DtoNewClass(Loc loc, TypeClass* tc, NewExp* newexp) // default allocator 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)); mem = gIR->CreateCallOrInvoke(fn, ci, ".newclass_gc_alloc").getInstruction(); mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc"); diff --git a/gen/passes/GarbageCollect2Stack.cpp b/gen/passes/GarbageCollect2Stack.cpp index e6bffde3..cc0f38f4 100644 --- a/gen/passes/GarbageCollect2Stack.cpp +++ b/gen/passes/GarbageCollect2Stack.cpp @@ -146,6 +146,7 @@ namespace { : TypeInfoArgNr(typeInfoArgNr), SafeToDelete(safeToDelete), ReturnsArray(returnsArray) {} + virtual ~FunctionInfo() {} }; class ArrayFI : public FunctionInfo { @@ -251,7 +252,7 @@ namespace { } }; - // FunctionInfo for _d_allocclass + // FunctionInfo for _d_newclass class AllocClassFI : public FunctionInfo { public: virtual bool analyze(CallSite CS, const Analysis& A) { @@ -358,7 +359,7 @@ GarbageCollect2Stack::GarbageCollect2Stack() KnownFunctions["_d_allocmemoryT"] = &AllocMemoryT; KnownFunctions["_d_newarrayvT"] = &NewArrayVT; KnownFunctions["_d_newarrayT"] = &NewArrayT; - KnownFunctions[_d_allocclass] = &AllocClass; + KnownFunctions["_d_newclass"] = &AllocClass; } static void RemoveCall(CallSite CS, const Analysis& A) { diff --git a/gen/passes/SimplifyDRuntimeCalls.cpp b/gen/passes/SimplifyDRuntimeCalls.cpp index 6747c377..fe0b7350 100644 --- a/gen/passes/SimplifyDRuntimeCalls.cpp +++ b/gen/passes/SimplifyDRuntimeCalls.cpp @@ -363,7 +363,7 @@ void SimplifyDRuntimeCalls::InitOptimizations() { Optimizations["_d_newarraymT"] = &Allocation; Optimizations["_d_newarraymiT"] = &Allocation; Optimizations["_d_newarraymvT"] = &Allocation; - Optimizations[_d_allocclass] = &Allocation; + Optimizations["_d_newclass"] = &Allocation; } diff --git a/gen/runtime.cpp b/gen/runtime.cpp index e1e65be8..60b748f1 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -426,11 +426,11 @@ static void LLVM_D_BuildRuntimeModule() 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 }; - 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) ->setAttributes(Attr_NoAlias); } diff --git a/gen/runtime.h b/gen/runtime.h index f64e3ae4..cd052f8d 100644 --- a/gen/runtime.h +++ b/gen/runtime.h @@ -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); -#define _d_allocclass "_d_newclass" #define _adEq "_adEq2" #define _adCmp "_adCmp2"