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:
Kai Nacke 2013-11-28 07:59:01 +01:00
parent eb85713ed1
commit e1464fe458

View file

@ -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)