mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 15:40:55 +03: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:
parent
eb85713ed1
commit
e1464fe458
1 changed files with 9 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue