mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-14 11:53:13 +01:00
CCP classes do not have a monitor.
This fixes a failure in runnable/xtest46.d. I still need to check the structure of the emitted class for compability with C++.
This commit is contained in:
@@ -154,17 +154,21 @@ void DtoInitClass(TypeClass* tc, LLValue* dst)
|
||||
{
|
||||
DtoResolveClass(tc->sym);
|
||||
|
||||
uint64_t n = tc->sym->structsize - Target::ptrsize * 2;
|
||||
const bool isCPPclass = tc->sym->isCPPclass() ? true : false;
|
||||
uint64_t n = tc->sym->structsize - Target::ptrsize * (isCPPclass ? 1 : 2);
|
||||
|
||||
// set vtable field seperately, this might give better optimization
|
||||
LLValue* tmp = DtoGEPi(dst,0,0,"vtbl");
|
||||
LLValue* val = DtoBitCast(tc->sym->ir.irAggr->getVtblSymbol(), tmp->getType()->getContainedType(0));
|
||||
DtoStore(val, tmp);
|
||||
|
||||
// monitor always defaults to zero
|
||||
tmp = DtoGEPi(dst,0,1,"monitor");
|
||||
val = LLConstant::getNullValue(tmp->getType()->getContainedType(0));
|
||||
DtoStore(val, tmp);
|
||||
if (!isCPPclass)
|
||||
{
|
||||
// monitor always defaults to zero
|
||||
tmp = DtoGEPi(dst,0,1,"monitor");
|
||||
val = LLConstant::getNullValue(tmp->getType()->getContainedType(0));
|
||||
DtoStore(val, tmp);
|
||||
}
|
||||
|
||||
// done?
|
||||
if (n == 0)
|
||||
|
||||
Reference in New Issue
Block a user