Skip to content

Re-enable parse_stdlib tests for macOS #12706

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

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.
Our Linux CI is still running out of memory on these tests, but try to
reinstate macOS testing so we don't regress here.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit b6a7449 into swiftlang:master Nov 1, 2017
@DougGregor DougGregor deleted the reenable-parse-stdlib-test-macos branch November 1, 2017 22: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