Skip to content

[Sema] Descriptor for argument of PreCheckFunctionBuilderRequest #33013

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

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jul 20, 2020

Follow-up to #32946 (comment)

@rintaro
Copy link
Member Author

rintaro commented Jul 20, 2020

@hamishknight @CodaFi I thought this is effectively NFC. But it crashes test/Constraints/function_builder.swift with

Assertion failed: (!isRecording && "Probably not a good idea to allow nested recording"), function replay, file /Users/rintaro/Repositories/swift-oss/swift/lib/AST/Evaluator.cpp, line 451.

What am I doing wrong?

@CodaFi

This comment has been minimized.

@rintaro
Copy link
Member Author

rintaro commented Jul 20, 2020

@CodaFi I suppose the code you mentioned is in evaluator::DependencyRecorder::record, right? That doesn't resolve the crash. BTW, the assertion is in the one in evaluator::DependencyRecorder::replay https://github.com/apple/swift/blob/7b14c1dad735cbd357c739fae59a116b7d2249ce/lib/AST/Evaluator.cpp#L448-L452

@hamishknight
Copy link
Contributor

hamishknight commented Jul 20, 2020

It sounds like the call to getBody() is firing off a request in the equality and hashing functions while we're handling request dependencies. I'm not sure if we want to support this kind of re-entrant evaluation as it might cause iterator invalidation (not just for dependency tracking, but also things like the evaluator's internal cache).

Perhaps we should call getBody() when the descriptor is constructed and store it as a property? At least it's still encapsulated rather than being a direct input of the request.

@rintaro rintaro force-pushed the sema-precheckfunctionbuilder-descriptor branch from 1782eb7 to 1579673 Compare July 20, 2020 23:44
@rintaro
Copy link
Member Author

rintaro commented Jul 20, 2020

@swift-ci Please smoke test

@rintaro rintaro marked this pull request as ready for review July 20, 2020 23:48
@rintaro rintaro requested a review from hamishknight July 20, 2020 23:49
Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

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

LGTM!

@rintaro
Copy link
Member Author

rintaro commented Jul 21, 2020

Windows: Build Status

@rintaro rintaro merged commit 994edab into swiftlang:master Jul 21, 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