-
Notifications
You must be signed in to change notification settings - Fork 513
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
Add option for strict write barriers #1008
Conversation
@@ -198,13 +198,15 @@ create_domain_objects (MonoDomain *domain) | |||
mono_error_assert_ok (&error); | |||
mono_field_static_set_value (string_vt, string_empty_fld, empty_str); | |||
domain->empty_string = empty_str; | |||
mono_gc_wbarrier_generic_nostore (&domain->empty_string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it matters, but would replacing assignment above with mono_gc_wbarrier_generic_store
be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, guess that is nicer. Will change and then merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This and the other instances)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may make merge conflicts with upstream more frequent. Just wondering what practical difference is if anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should be no practical difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at it, I decided not to change it. The functionality is identical, and the code did not look nicer by merging the assignment and the write barrier, as lines become very long. Merged as is.
#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.