-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mutation: Simplify the
detach
concept and make lists mutable
Detaching confusingly meant two things at once, but failed at both: 1. It was meant to rid fuzz test arguments of state shared with the mutator so that fuzz test body and future mutations couldn't affect each other. This wasn't working correctly for lists, which provided a shallowly immutable view on potentially mutable contents. 2. It also promised "mutable values where possible", which wasn't really well-defined and also doesn't match common use cases: If a function accepts a `List<Foo>`, it should generally be able to expect the list to permit modifications. Instead, `detach` now always returns an object that shares no mutable state, not even transitively, with the original object. Apart from simplifying the implementation, this allows mutators to copy values by applying `detach`, which previously could have resulted in shared state that couldn't be mutated independently. Since we are currently reading in the fuzz test arguments from the raw byte representation in every iteration, there is no need to detach and we can also return mutable lists directly. If we get rid of the re-reads, we would have to detach, which is now verified by a new consistency check in `ArgumentsMutator`. We might be able to optimize e.g. `List<String>` to avoid all copies in the future via a new annotation (e.g. `@Immutable`). The current implementation would already avoid copying the strings and would only recreate the list, which is most likely negligible overhead.
- Loading branch information
Showing
8 changed files
with
66 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
src/main/java/com/code_intelligence/jazzer/mutation/annotation/SafeToMutate.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.