Page MenuHomePhabricator

Add a test case for `YYINITDEPTH`
ClosedPublic

Authored by joshuaspence on Dec 2 2015, 3:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 3:17 AM
Unknown Object (File)
Thu, Apr 25, 1:34 AM
Unknown Object (File)
Mon, Apr 22, 10:54 AM
Unknown Object (File)
Fri, Apr 12, 11:18 AM
Unknown Object (File)
Thu, Apr 11, 9:08 AM
Unknown Object (File)
Mar 31 2024, 8:20 AM
Unknown Object (File)
Mar 27 2024, 9:58 PM
Unknown Object (File)
Mar 6 2024, 5:32 AM
Subscribers

Details

Summary

D14529 removed some questionable code from XHPAST:

// PHP's if/else rules use right reduction rather than left reduction which
// means while parsing nested if/else's the stack grows until it the last
// statement is read. This is annoying, particularly because of a quirk in
// bison.
// http://www.gnu.org/software/bison/manual/html_node/Memory-Management.html
// Apparently if you compile a bison parser with g++ it can no longer grow
// the stack. The work around is to just make your initial stack ridiculously
// large. Unfortunately that increases memory usage while parsing which is
// dumb. Anyway, putting a TODO here to fix PHP's if/else grammar.
#define YYINITDEPTH 500

It wasn't really clear why this code was needed and, hence, it was removed. The removal of this #define, however, caused a regression (see rPHU33b1620656f76aa1fdb303557afac5fd32ba0e91). This diff adds a test case in an attempt to prevent future regressions.

Test Plan

arc unit

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Add a test case for `YYINITDEPTH`.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.

Should this (or some other change) also revert D14529?

This revision is now accepted and ready to land.Dec 2 2015, 3:19 AM

Should this (or some other change) also revert D14529?

I cowboy-committed rPHU33b1620656f76aa1fdb303557afac5fd32ba0e91.

This revision was automatically updated to reflect the committed changes.