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)
Sun, Nov 24, 3:01 PM
Unknown Object (File)
Sun, Nov 10, 11:05 AM
Unknown Object (File)
Sat, Nov 9, 10:49 AM
Unknown Object (File)
Fri, Nov 1, 7:05 AM
Unknown Object (File)
Oct 19 2024, 12:30 AM
Unknown Object (File)
Oct 18 2024, 5:12 AM
Unknown Object (File)
Oct 17 2024, 2:00 AM
Unknown Object (File)
Oct 13 2024, 11:07 PM
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
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 9201
Build 10886: Run Core Tests
Build 10885: arc lint + arc unit

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.