-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[metadata] Fix racy next_generic_inst_id #5299
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
[metadata] Fix racy next_generic_inst_id #5299
Conversation
|
@cherusker, |
|
|
lambdageek
left a comment
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.
I agree with @lewurm let's make next_generic_inst_id and MonoGenericInst:id an explicitly sized type (so uint32_t)
|
@lewurm, @lambdageek: so far, A cast from #include <stdint.h>
#include <stdio.h>
int main() {
uint32_t x = -3;
int32_t y = x;
for (int i = 0; i < 5; ++i) {
x = ++y;
(void) printf("x = %u, y = %i\n", x, y);
}
return 0;
}My second idea is to add something like |
|
@cherusker you can just do |
|
Just make them signed, no need to use unsigned types unless necessary, it just complicates things. |
|
Looks ok, please squash the changes when committing. |
- as discussed in https://bugzilla.xamarin.com/show_bug.cgi?id=58423 - in addition, unify `int` and `guint` into `gint32` which can be used flawlessly with `InterlockedIncrement ()`
0c3b534 to
47535f5
Compare
|
@vargaz I thought that all commits get squashed automagically when a PR gets merged and, due to that, I usually keep many small commits if somebody wants to retrace a specific PR. Anyways - just squashed everything :) |
|
we can |
|
@monojenkins merge |
|
cannot merge:
|
…-next-generic-inst-id [metadata] Fix racy next_generic_inst_id Like suggested by @luhenry, I would like to propose this fix which was discussed in https://bugzilla.xamarin.com/show_bug.cgi?id=58423. As `next_generic_inst_id` is `int`, `InterlockedIncrement64 ()` seems to be the right choice. Also, I cannot add any reviewers or assignees, which is why I would kindly ask @lambdageek to review this as well :) Commit migrated from mono/mono@8bbca2b
Like suggested by @luhenry, I would like to propose this fix which was discussed in https://bugzilla.xamarin.com/show_bug.cgi?id=58423. As
next_generic_inst_idisint,InterlockedIncrement64 ()seems to be the right choice.Also, I cannot add any reviewers or assignees, which is why I would kindly ask @lambdageek to review this as well :)