Add option for strict write barriers #1008
Merged
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.
#958 added support for incremental Boehm GC by adding write barriers to mono.
Incremental Boehm requires only one write barrier call on any pointer within an object even if multiple references in the object have changed, as the object is then considered as dirty, and rescanned.
However, our technique for validating correct use of write barriers (by verifying that all found references have been set through a write barrier call) is not that tolerant (And potentially, neither are future Boehm replacements). So, to get a good test coverage for write barrier use to work, we need an option to set write barriers on all reference writes. Mono has some functions which touch whole blocks of managed memory (which may contain references). This PR adds a "strict write barrier" mode, which will set write barriers for each potential reference in those functions.
This needs to land in order to get test coverage on write barrier use in Unity to run.