Skip to content

Re-enable parse_stdlib tests. #12700

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 3 commits into from
Nov 1, 2017

Conversation

DougGregor
Copy link
Member

The parse_stdlib tests have been disabled for a while due to excessive memory use. At one point, the problem appeared to be the GenericSignatureBuilder. However, now the problem was actually in the parser's syntax map. Address that issue and try to re-enable the tests.

For very large source files, the parser's syntax map---which contains a
very large number of TrivialLists---was taking an inordinate amount of
memory due to the inefficiency of std::deque. Specifically, a
std::deque containing just one trivia element would allocate 4k of
memory. With the ~120MB SIL output of one of the parse_stdlib tests,
these std::deques would add up to > 6GB of memory, most of which is
wasted.

Replacing the std::deque with a std::vector knocks the memory required
for one of the parse_stdlib tests from > 8GB down closer to 2 GB. The
parser's syntax map is still large (e.g., a 512MB allocation for the
overall std::vector plus a few hundred MB of raw-syntax data), but not
prohibitively so.

Addresses rdar://problem/34771322

For very large source files, the parser's syntax map---which contains a
very large number of TrivialLists---was taking an inordinate amount of
memory due to the inefficiency of std::deque. Specifically, a
std::deque containing just one trivial element would allocate 4k of
memory. With the ~120MB SIL output of one of the parse_stdlib tests,
these std::deques would add up to > 6GB of memory, most of which is
wasted.

Replacing the std::deque with a std::vector knocks the memory required
for one of the parse_stdlib tests from > 8GB down closer to 2 GB. The
parser's syntax map is still large (e.g., a 512MB allocation for the
overall vector plus a few hundred MB of raw-syntax data), but not
prohibitively so.

Part of rdar://problem/34771322.
When printing SIL, we end up printing both @NoEscape and @autoclosure. It's
not technically wrong (just redundant), so allow it when parsing the SIL
back.
Now that memory usage is (more) under control, re-enable the parse_stdlib
tests. Fixes rdar://problem/34771322.
@DougGregor DougGregor requested a review from nkcsgexi November 1, 2017 06:44
@DougGregor
Copy link
Member Author

@swift-ci please test and merge

@swift-ci swift-ci merged commit c89e490 into swiftlang:master Nov 1, 2017
@DougGregor
Copy link
Member Author

Still failing on Linux. Reverting!

@DougGregor DougGregor deleted the reenable-parse-stdlib-test branch November 1, 2017 14:30
@DougGregor
Copy link
Member Author

Trying to bring this back online for just macOS via #12706

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