Skip to content

[libSyntax] Reference count SyntaxData #36230

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
Mar 5, 2021

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 2, 2021

Instead of having a heap-allocated RefCountedBox to store a SyntaxData's parent, reference-count SyntaxData itself. This has a couple of advantages:

  • When passing SyntaxData around, only a pointer needs to be passed instead of the entire struct contents. This is faster.
  • We can later introduce a SyntaxDataRef, which behaves similar to SyntaxData, but delegates the responsibility that the parent stays alive to the user. While sacrificing memory safety, this means that SyntaxData can then be stack-allocated without any ref-counting overhead.

@ahoppen
Copy link
Member Author

ahoppen commented Mar 2, 2021

@swift-ci Please test

@ahoppen ahoppen force-pushed the pr/ref-count-syntaxdata branch from 1873d23 to 8ed3ea4 Compare March 2, 2021 15:37
@swiftlang swiftlang deleted a comment from swift-ci Mar 2, 2021
@swiftlang swiftlang deleted a comment from swift-ci Mar 2, 2021
@swiftlang swiftlang deleted a comment from swift-ci Mar 2, 2021
@swiftlang swiftlang deleted a comment from swift-ci Mar 2, 2021
@ahoppen ahoppen marked this pull request as ready for review March 2, 2021 16:41
@ahoppen ahoppen requested a review from rintaro March 2, 2021 16:41
@ahoppen
Copy link
Member Author

ahoppen commented Mar 2, 2021

@swift-ci Please test Linux

@ahoppen ahoppen force-pushed the pr/ref-count-syntaxdata branch from 8ed3ea4 to 88e9048 Compare March 2, 2021 21:46
@ahoppen
Copy link
Member Author

ahoppen commented Mar 2, 2021

Full testing passed before rebasing onto main. Just running smoke testing now.

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Mar 3, 2021

@swift-ci Please test Windows

Instead of having a heap-allocated RefCountedBox to store a SyntaxData's
parent, reference-count SyntaxData itself. This has a couple of
advantages:
 - When passing SyntaxData around, only a pointer needs to be passed
   instead of the entire struct contents. This is faster.
 - We can later introduce a SyntaxDataRef, which behaves similar to
   SyntaxData, but delegates the responsibility that the parent stays
   alive to the user. While sacrificing guaranteed memory safety, this
   means that SyntaxData can then be stack-allocated without any
   ref-counting overhead.
@ahoppen ahoppen force-pushed the pr/ref-count-syntaxdata branch from 88e9048 to 56a9234 Compare March 3, 2021 08:12
@ahoppen
Copy link
Member Author

ahoppen commented Mar 3, 2021

And another rebase onto main.

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Mar 4, 2021

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 4, 2021

Build failed
Swift Test Linux Platform
Git Sha - 56a9234

@ahoppen
Copy link
Member Author

ahoppen commented Mar 5, 2021

@swift-ci Please test Linux

@swift-ci
Copy link
Contributor

swift-ci commented Mar 5, 2021

Build failed
Swift Test Linux Platform
Git Sha - 56a9234

@ahoppen
Copy link
Member Author

ahoppen commented Mar 5, 2021

@swift-ci Please smoke test Linux

@ahoppen ahoppen merged commit bde8224 into swiftlang:main Mar 5, 2021
@ahoppen ahoppen deleted the pr/ref-count-syntaxdata branch March 5, 2021 13:32
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