mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Change _d_newclass into _d_allocclass. Add initialization to ClassInfo.create.
This commit is contained in:
@@ -812,7 +812,7 @@ DValue* DtoNewClass(Loc loc, TypeClass* tc, NewExp* newexp)
|
||||
// default allocator
|
||||
else
|
||||
{
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_newclass");
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_allocclass");
|
||||
mem = gIR->CreateCallOrInvoke(fn, tc->sym->ir.irStruct->classInfo, ".newclass_gc_alloc")->get();
|
||||
mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc");
|
||||
}
|
||||
|
||||
@@ -257,9 +257,9 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
|
||||
}
|
||||
|
||||
// Object _d_newclass(ClassInfo ci)
|
||||
// Object _d_allocclass(ClassInfo ci)
|
||||
{
|
||||
std::string fname("_d_newclass");
|
||||
std::string fname("_d_allocclass");
|
||||
std::vector<const LLType*> types;
|
||||
types.push_back(classInfoTy);
|
||||
const llvm::FunctionType* fty = llvm::FunctionType::get(objectTy, types, false);
|
||||
|
||||
@@ -48,7 +48,7 @@ private
|
||||
debug(PRINTF) import tango.stdc.stdio; // : printf;
|
||||
|
||||
extern (C) void onOutOfMemoryError();
|
||||
extern (C) Object _d_newclass(ClassInfo ci);
|
||||
extern (C) Object _d_allocclass(ClassInfo ci);
|
||||
}
|
||||
|
||||
// NOTE: For some reason, this declaration method doesn't work
|
||||
@@ -188,7 +188,11 @@ class ClassInfo : Object
|
||||
{
|
||||
if (flags & 8 && !defaultConstructor)
|
||||
return null;
|
||||
Object o = _d_newclass(this);
|
||||
|
||||
Object o = _d_allocclass(this);
|
||||
// initialize it
|
||||
(cast(byte*) o)[0 .. init.length] = init[];
|
||||
|
||||
if (flags & 8 && defaultConstructor)
|
||||
{
|
||||
defaultConstructor(o);
|
||||
|
||||
@@ -88,11 +88,11 @@ private
|
||||
/**
|
||||
*
|
||||
*/
|
||||
extern (C) Object _d_newclass(ClassInfo ci)
|
||||
extern (C) Object _d_allocclass(ClassInfo ci)
|
||||
{
|
||||
void* p;
|
||||
|
||||
debug(PRINTF2) printf("_d_newclass(ci = %p, %s)\n", ci, cast(char *)ci.name.ptr);
|
||||
debug(PRINTF2) printf("_d_allocclass(ci = %p, %s)\n", ci, cast(char *)ci.name.ptr);
|
||||
/+
|
||||
if (ci.flags & 1) // if COM object
|
||||
{ /* COM objects are not garbage collected, they are reference counted
|
||||
|
||||
@@ -94,7 +94,7 @@ void _d_monitorexit(Object *h);
|
||||
int _d_isbaseof(ClassInfo *b, ClassInfo *c);
|
||||
Object *_d_dynamic_cast(Object *o, ClassInfo *ci);
|
||||
|
||||
Object * _d_newclass(ClassInfo *ci);
|
||||
Object * _d_allocclass(ClassInfo *ci);
|
||||
void _d_delclass(Object **p);
|
||||
|
||||
void _d_OutOfMemory();
|
||||
|
||||
Reference in New Issue
Block a user