Skip to content

[Syntax] Unify RawSyntax and RawTokenSyntax using union and TrailingObjects #13990

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
Jan 18, 2018

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jan 17, 2018

It better matches with SwiftSyntax model.

Also, using TrailingObjects reduces the number of heap allocation. This gains about 18% performance improvement in libSyntax parsing.

@rintaro
Copy link
Member Author

rintaro commented Jan 17, 2018

@swift-ci Please ASAN test

@rintaro
Copy link
Member Author

rintaro commented Jan 17, 2018

@swift-ci Please smoke test

}
size_t numTrailingObjects(OverloadToken<TriviaPiece>) const {
return isToken() ? Bits.NumLeadingTrivia + Bits.NumTrailingTrivia : 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a super big deal but we shouldn't need to define numTrailingObjects for the last trailing object type. It will never get called.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, but I'd rather keep this so we can see how we calculate the number of trailing objects.

@rintaro rintaro force-pushed the syntax-rawsyntax-union branch from fb603bd to ce8c701 Compare January 18, 2018 04:39
@rintaro
Copy link
Member Author

rintaro commented Jan 18, 2018

@swift-ci Please smoke test

…bjects

It better matches with SwiftSyntax model.

Using TrailingObjects reduces the number of heap allocation which
gains 18% performance improvement.
@rintaro rintaro force-pushed the syntax-rawsyntax-union branch from ce8c701 to 0780c52 Compare January 18, 2018 05:50
@rintaro
Copy link
Member Author

rintaro commented Jan 18, 2018

@swift-ci Please smoke test

@rintaro rintaro changed the title [Do Not Merge][Syntax] Unify RawSyntax and RawTokenSyntax using union and TrailingObjects [Syntax] Unify RawSyntax and RawTokenSyntax using union and TrailingObjects Jan 18, 2018
@rintaro rintaro merged commit 3f5a710 into swiftlang:master Jan 18, 2018
@rintaro rintaro deleted the syntax-rawsyntax-union branch January 18, 2018 06:37
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.

2 participants