Skip to content

Disable AST type caching for SILFunctionTypes since the mapping isn't #2245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2020

Conversation

adrian-prantl
Copy link

bijective, and relax check in TypeSystemSwiftTypeRef to take this fact
into account.

rdar://70552614

bijective, and relax check in TypeSystemSwiftTypeRef to take this fact
into account.

rdar://70552614
@adrian-prantl
Copy link
Author

@swift-ci test

@vedantk
Copy link

vedantk commented Dec 15, 2020

Note that we might be able to un-XFAIL the stepper integration test once this lands.

assert(&found_type->getASTContext() == ast_ctx);
swift::TypeBase *ast_type =
ConvertSILFunctionTypesToASTFunctionTypes(found_type).getPointer();
// This transformation is lossy: all SILFunction types are mapped

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just get rid of this mapping? IIRC, the old type reconstruction code didn't handle SILFunctionType at all, always returning () -> (). When I implemented full type reconstruction, there were a few places in lldb that weren't set up to handle a SILFunctionType so I added this hack to get the old behavior back. We should just remove it.

@adrian-prantl
Copy link
Author

If I remove it completely I get the following SIL verification error for the expression and it's not clear to me what :

SIL verification failed: init_existential_addr payload must be a lowering of the formal concrete type: isLoweringOf(AEI->getLoweredConcreteType(), AEI->getFormalConcreteType())
Verifying instruction:
     %132 = alloc_stack $Any                      // users: %139, %138, %137, %134
->   %134 = init_existential_addr %132 : $*Any, $Optional<@callee_guaranteed (@guaranteed String) -> ()> // user: %135
     store %133 to [init] %134 : $*Optional<@callee_guaranteed (@guaranteed String) -> ()> // id: %135

...

(lldb) p AEI->getLoweredConcreteType().dump()
error: Couldn't lookup symbols:
  __ZNK5swift23InitExistentialAddrInst22getLoweredConcreteTypeEv
(lldb) p AEI->dump()
  %134 = init_existential_addr %132 : $*Any, $Optional<@callee_guaranteed (@guaranteed String) -> ()> // user: %135

@adrian-prantl
Copy link
Author

frame #4: 0x0000000101988805 LLDB`swift::SILInstructionVisitor<(anonymous namespace)::SILVerifier, void>::visit(swift::SILInstruction*) [inlined] (anonymous namespace)::SILVerifier::checkInitExistentialAddrInst(this=0x00007ffeefbfa1f0, AEI=0x00000002ed33d050) at SILVerifier.cpp:3510:5 [opt]
   3502	    auto loweredTy = F.getLoweredType(Lowering::AbstractionPattern(archetype),
   3503	                                      AEI->getFormalConcreteType())
   3504	                      .getAddressType();
   3505	    
   3506	    requireSameType(loweredTy, AEI->getLoweredConcreteType(),
   3507	                    "init_existential_addr result type must be the lowered "
   3508	                    "concrete type at the right abstraction level");
   3509	
-> 3510	    require(isLoweringOf(AEI->getLoweredConcreteType(),
   3511	                         AEI->getFormalConcreteType()),
   3512	            "init_existential_addr payload must be a lowering of the formal "
   3513	            "concrete type");

@adrian-prantl adrian-prantl merged commit 1e4ded8 into swiftlang:swift/release/5.4 Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants