Record stack size used by parser and apply it during error checking too
commit7d1f41116a53b75169c3d26a293613463e99423a
authorKasper Kopec <kasper@fb.com>
Tue, 17 Sep 2019 23:22:52 +0000 (17 16:22 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 17 Sep 2019 23:27:39 +0000 (17 16:27 -0700)
tree8c60a34a1f35d4e2626e93c327494aee8dec9b48
parent7b03d2b6de7d7fce3df2aec3a2107ec23f2e2821
Record stack size used by parser and apply it during error checking too

Summary:
The same files that were problematic during parsing are causing troubles when error checking too. We also need to be able to up the stack limit space for few outliers.

We can't / don't want to do it in the same way it was done there for two reasons:

- the "exponential retry" is based on ability to retry, which was easy in case of parser - we always start from "the scratch" (from the file), so it's easy to retry. Here, we are starting from syntax tree, and if the running function consumes it (not a case here, but will be in few other cases soon), there is no easy way to retry again
- it is done in a very invasive way, requiring running code to periodically check for stack space usage

Instead lets optimistically (and completely without any guarantees) assume that the space used while parsing is an upper bound of space used in subsequent phases. Getting the new thread to operate on a syntax tree passed from main one requires some ugly tricks to convince Rust that it is safe in that case.

Reviewed By: shiqicao, losvald

Differential Revision: D17356084

fbshipit-source-id: 9f9580f374261d832a188b73cdfe4cc5908a2e9d
hphp/hack/src/parser/parser.rs
hphp/hack/src/parser/rust_parser_errors.rs
hphp/hack/src/parser/rust_parser_ffi.rs
hphp/hack/src/parser/syntax_tree.rs