Closed hunkydoryrepair closed 2 years ago
also added a fix for #84, along with a new TestMethod to verify the change. Also test methods to verify #86 is fixed. Adjusted other test cases to run without undue configuration effort.
bug #83 fixed.
bug #80 - stack overflow running under IIS addressed by replacing recursion with stack
297bf9a also includes fix for #73. The 4 RegExp expressions with non-trivial repeat patterns have been flagged so no attempt to parse them using the NFA parser will be done, and they go directly to full RegExp parser. When creating many contexts, these exceptions had a performance impact.
Bug #86 exposes a bug in Flee where nested long branches are not handled.
When generating nested expressions, a "temp" generator is used. This is done to determine where the branches are and how long they should be, but nested expressions don't adjust for long branches when the generator is in temp mode, since the isTemp flag forces short branches even when it compiles twice.
When in temp compiling mode, the actual branches don't matter on the nested code, just the final offet, so instead of compiling twice to adjust for long branches, the nested expressions only need to add a few NOPs so that the proper offsets can be found by the calling frame of reference. Thus ComputeBranches now emits NOP to make the generated code the proper size.
A more elegant solution may be to have a single BranchManager for the entire expression, shared by all nested conditionals/IN/AndOr/etc. In that case, the entire expression would only be compiled twice, rather than multiple times. However, the ComputeBranches method would need to be changed as it also doesn't handle nested branches properly (at a minimum, needs to start with last branch and move backward)