mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 23:50:43 +03:00
Use typed gep in DtoFinalizeScopeClass
(#4081)
This commit is contained in:
parent
a79a30c41e
commit
d8d105fb1b
3 changed files with 8 additions and 4 deletions
|
@ -188,7 +188,8 @@ void DtoFinalizeClass(const Loc &loc, LLValue *inst) {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void DtoFinalizeScopeClass(const Loc &loc, LLValue *inst, bool hasDtor) {
|
void DtoFinalizeScopeClass(const Loc &loc, DValue* dval, bool hasDtor) {
|
||||||
|
llvm::Value* inst = DtoRVal(dval);
|
||||||
if (!isOptimizationEnabled() || hasDtor) {
|
if (!isOptimizationEnabled() || hasDtor) {
|
||||||
DtoFinalizeClass(loc, inst);
|
DtoFinalizeClass(loc, inst);
|
||||||
return;
|
return;
|
||||||
|
@ -199,7 +200,9 @@ void DtoFinalizeScopeClass(const Loc &loc, LLValue *inst, bool hasDtor) {
|
||||||
llvm::BasicBlock *ifbb = gIR->insertBB("if");
|
llvm::BasicBlock *ifbb = gIR->insertBB("if");
|
||||||
llvm::BasicBlock *endbb = gIR->insertBBAfter(ifbb, "endif");
|
llvm::BasicBlock *endbb = gIR->insertBBAfter(ifbb, "endif");
|
||||||
|
|
||||||
const auto monitor = DtoLoad(DtoGEP(inst, 0, 1), ".monitor");
|
llvm::StructType *st = getIrAggr(static_cast<TypeClass *>(dval->type)->sym)
|
||||||
|
->getLLStructType();
|
||||||
|
const auto monitor = DtoLoad(st->getElementType(1), DtoGEP(st, inst, 0, 1), ".monitor");
|
||||||
const auto hasMonitor =
|
const auto hasMonitor =
|
||||||
gIR->ir->CreateICmp(llvm::CmpInst::ICMP_NE, monitor,
|
gIR->ir->CreateICmp(llvm::CmpInst::ICMP_NE, monitor,
|
||||||
getNullValue(monitor->getType()), ".hasMonitor");
|
getNullValue(monitor->getType()), ".hasMonitor");
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
class ClassDeclaration;
|
class ClassDeclaration;
|
||||||
class CtorDeclaration;
|
class CtorDeclaration;
|
||||||
|
class DValue;
|
||||||
class FuncDeclaration;
|
class FuncDeclaration;
|
||||||
class NewExp;
|
class NewExp;
|
||||||
class TypeClass;
|
class TypeClass;
|
||||||
|
@ -28,7 +29,7 @@ void DtoResolveClass(ClassDeclaration *cd);
|
||||||
DValue *DtoNewClass(const Loc &loc, TypeClass *type, NewExp *newexp);
|
DValue *DtoNewClass(const Loc &loc, TypeClass *type, NewExp *newexp);
|
||||||
void DtoInitClass(TypeClass *tc, llvm::Value *dst);
|
void DtoInitClass(TypeClass *tc, llvm::Value *dst);
|
||||||
void DtoFinalizeClass(const Loc &loc, llvm::Value *inst);
|
void DtoFinalizeClass(const Loc &loc, llvm::Value *inst);
|
||||||
void DtoFinalizeScopeClass(const Loc &loc, llvm::Value *inst, bool hasDtor);
|
void DtoFinalizeScopeClass(const Loc &loc, DValue* dval, bool hasDtor);
|
||||||
|
|
||||||
DValue *DtoCastClass(const Loc &loc, DValue *val, Type *to);
|
DValue *DtoCastClass(const Loc &loc, DValue *val, Type *to);
|
||||||
DValue *DtoDynamicCastObject(const Loc &loc, DValue *val, Type *to);
|
DValue *DtoDynamicCastObject(const Loc &loc, DValue *val, Type *to);
|
||||||
|
|
|
@ -1554,7 +1554,7 @@ public:
|
||||||
} else if (auto ve = e->e1->isVarExp()) {
|
} else if (auto ve = e->e1->isVarExp()) {
|
||||||
if (auto vd = ve->var->isVarDeclaration()) {
|
if (auto vd = ve->var->isVarDeclaration()) {
|
||||||
if (vd->onstack()) {
|
if (vd->onstack()) {
|
||||||
DtoFinalizeScopeClass(e->loc, DtoRVal(dval), vd->onstackWithDtor());
|
DtoFinalizeScopeClass(e->loc, dval, vd->onstackWithDtor());
|
||||||
onstack = true;
|
onstack = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue