lib/be effects: Use DFA for fz -effects
and avoid panic in mutate, fix #2293
#2407
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this patch, the effects reported for HelloWorld.fz were useless:
This patch fixes this by switching the effects backend used by
fz -effects
to use DFA instead for CFG, which give higher analysis accuracy and avoids the many...as_array.m
effects.Then,
effect.abortable
was added as a feature that can be redefined to indicate that a given effect must not supportabort
. This helps removing the reportedpanic
effect and consequently alsoio.err
andexit
.Finally, the use of
mutate
effect was removed fromexit
(which is an effect already any may as well useset
andlist.as_array
(which usedmut
in a local mutate instance, which made the local mutate instance useless). Also, the use ofpanic
inmutate.check_and_replace
was replaced by a precondition.A minor cleanup in the code using a local mutate instance in
Stream.as_array
is also part of this patch.fz -effects
now supports-verbose=1
, which will print the reason and a sample call chain why the reported effects are there, this facilitates understanding the results significantly. To reduce noise, verbose output of DFA was moved one verbosity level up.The resulting output of
fz -effects HelloWorld.fz
now isWhile
-verbose
adds a nice explanation (plus some unrelated warnings that need to be fixed).