mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IRGen] Erase thunks before emission.
Previously, a call to emitMethodLookupFunction or emitDispatchThunk would always simply emit a function, even if it had previously been emitted. That was a problem since these emissions are triggered by emitting class type context descriptors which can now be lazily reemitted upon encountering prespecialized metadata. Here, that behavior is changed to delete the old body, if any, before emitting the body again.
This commit is contained in:
@@ -102,6 +102,9 @@ static FunctionPointer lookupMethod(IRGenFunction &IGF, SILDeclRef declRef) {
|
|||||||
|
|
||||||
void IRGenModule::emitDispatchThunk(SILDeclRef declRef) {
|
void IRGenModule::emitDispatchThunk(SILDeclRef declRef) {
|
||||||
auto *f = getAddrOfDispatchThunk(declRef, ForDefinition);
|
auto *f = getAddrOfDispatchThunk(declRef, ForDefinition);
|
||||||
|
if (!f->isDeclaration()) {
|
||||||
|
f->deleteBody();
|
||||||
|
}
|
||||||
|
|
||||||
IRGenFunction IGF(*this, f);
|
IRGenFunction IGF(*this, f);
|
||||||
|
|
||||||
@@ -163,6 +166,9 @@ IRGenModule::getAddrOfMethodLookupFunction(ClassDecl *classDecl,
|
|||||||
|
|
||||||
void IRGenModule::emitMethodLookupFunction(ClassDecl *classDecl) {
|
void IRGenModule::emitMethodLookupFunction(ClassDecl *classDecl) {
|
||||||
auto *f = getAddrOfMethodLookupFunction(classDecl, ForDefinition);
|
auto *f = getAddrOfMethodLookupFunction(classDecl, ForDefinition);
|
||||||
|
if (!f->isDeclaration()) {
|
||||||
|
f->deleteBody();
|
||||||
|
}
|
||||||
|
|
||||||
IRGenFunction IGF(*this, f);
|
IRGenFunction IGF(*this, f);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user