-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Validate CodeInstances with no external edges #41961
Conversation
I think the serializer needs to store this information. Sometimes we will have methods without backedges because we know that they are invalid beforehand. |
c905725
to
2a47425
Compare
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 think this seems reasonable to me
hm, CI might disagree with it: https://build.julialang.org/#/builders/7/builds/2647 |
Oh dear. If we need to revert that's OK, but I'm looking into this. |
Hmm, strange. It's rare, but if I run the test ~50 times I can get it. From debugging with a key diff @@ -2083,10 +2089,17 @@ static void validate_new_code_instances(void)
size_t i;
for (i = 0; i < new_code_instance_validate.size; i += 2) {
if (new_code_instance_validate.table[i+1] != HT_NOTFOUND) {
+ jl_printf(JL_STDOUT, "validating ");
+ jl_(((jl_code_instance_t*)new_code_instance_validate.table[i])->def);
((jl_code_instance_t*)new_code_instance_validate.table[i])->max_world = ~(size_t)0;
new_code_instance_validate.table[i+1] = HT_NOTFOUND;
- }
+ } else if (new_code_instance_validate.table[i] != HT_NOTFOUND) {
+ jl_printf(JL_STDOUT, "for invalid ci, max_world is %ld: ", ((jl_code_instance_t*)new_code_instance_validate.table[i])->max_world);
+ jl_(((jl_code_instance_t*)new_code_instance_validate.table[i])->def);
+ }
} I captured
It makes it seem as if it could be in the |
Seems like a case you can quickly catch under |
I am guessing this will fix it: diff --git a/src/dump.c b/src/dump.c
index af3290a511..0cd8513426 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -2080,12 +2080,20 @@ static void jl_insert_backedges(jl_array_t *list, jl_array_t *targets)
static void validate_new_code_instances(void)
{
- size_t i;
- for (i = 0; i < new_code_instance_validate.size; i += 2) {
+ size_t i = 0;
+ while (i < new_code_instance_validate.size) {
if (new_code_instance_validate.table[i+1] != HT_NOTFOUND) {
((jl_code_instance_t*)new_code_instance_validate.table[i])->max_world = ~(size_t)0;
new_code_instance_validate.table[i+1] = HT_NOTFOUND;
- }
+ } else {
+ // The same key can be inserted in multiple places
+ void *p = new_code_instance_validate.table[i];
+ while (i + 2 < new_code_instance_validate.size && new_code_instance_validate.table[i+2] == p) {
+ i += 2;
+ new_code_instance_validate.table[i+1] = HT_NOTFOUND;
+ }
+ }
+ i += 2;
}
} The same pointer is definitely inserted twice in a row (rarely). |
Or would it be better to call |
The hash-table iteration scheme used in #41961 is flawed because the same key (pointer) can appear in (at least) successive key-slots. For safety, it's best to get the "official" value assigned to this key before making decisions about validation.
See #42008 |
In JuliaLang#38983 and JuliaLang#41872, it was discovered that only CodeInstances with external backedges get validated after deserialization. This adds a "second chance" for each CodeInstance: it validates any that have neither been validated nor invalidated by the end of deserialization. Closes JuliaLang#41872
In JuliaLang#38983 and JuliaLang#41872, it was discovered that only CodeInstances with external backedges get validated after deserialization. This adds a "second chance" for each CodeInstance: it validates any that have neither been validated nor invalidated by the end of deserialization. Closes JuliaLang#41872
In #38983 and #41872, it was discovered that only CodeInstances with
external backedges get validated after deserialization.
This stores new CodeInstances in a list, and if they have neither been
validated nor invalidated, it validates them.
Closes #41872
CC @martinholters