Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple critical bug fixes #89

Merged
merged 7 commits into from
Mar 8, 2022
Merged

Conversation

hunkydoryrepair
Copy link
Contributor

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)

@hunkydoryrepair
Copy link
Contributor Author

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.

@hunkydoryrepair
Copy link
Contributor Author

bug #83 fixed.

@hunkydoryrepair
Copy link
Contributor Author

bug #80 - stack overflow running under IIS addressed by replacing recursion with stack

@hunkydoryrepair
Copy link
Contributor Author

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.

@hunkydoryrepair hunkydoryrepair changed the title handle nested long branches Multiple critical bug fixes Jun 11, 2021
@mparlak mparlak merged commit 5a923c3 into mparlak:master Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants