hokein added inline comments.
================ Comment at: clang-tools-extra/pseudo/lib/GLR.cpp:118 + CheckRefcounts(); + for (const auto *Head : NewHeads) { AddSteps(Head, Terminal.symbol()); ---------------- > The freelist works well (on AST.cpp, 35K nodes created but only 74 allocated), The number of saving is quite promising! But as discussed, it didn't speed up the parser (mostly we're paying extra cost of updating nodes in dead branches, causing ~10% slowdown). Wanted to explore an alternative (which we discussed briefly) -- for errory-recovery, the key point is that when there is no active head, we'd like to find a recovery state (retrieved from the most-recent live heads) and continue the parsing from there. This main parsing for-loop can provide a global view of active heads: - we can assume here the `NewHeads` is not empty (for-loop body always starts with active heads); - if all heads die, we can detect it after the `glrReduce` (on Line130, by checking `PendingShift` is empty); So the code is roughly like ``` for ( ... : Terminals) { auto PreviousNewHeads = NewHeads; .... glrReduce(...); if (PendingShift.empty()) { // run error-recovery from the PreviousNewHeads } else { glrShift(...); } } ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126337/new/ https://reviews.llvm.org/D126337 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits