-
Notifications
You must be signed in to change notification settings - Fork 787
Remove closed world validation checks #7019
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
Conversation
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'm pleasantly surprised that this doesn't cause issues 👍
This isn't quite as simple as I'd hoped, after 100K iterations the fuzzer found an issue. While we don't use validation to decide what to optimize, we do use it to decide what to fuzz: we don't apply I added the fix here because it can't land before this PR (it won't validate) and it shouldn't land after (that would break bisection). I'll fuzz a lot more before landing, as there might be more such issues. |
Added a similar fix for abstract type refining (found not by fuzzing but analytically). |
Removed a comment about validating closed world which is now obsolete. |
src/passes/AbstractTypeRefining.cpp
Outdated
// Assume all public types are created, which makes them non-abstract and | ||
// hence ignored below. | ||
for (auto type : ModuleUtils::getPublicHeapTypes(*module)) { | ||
createdTypes.insert(type); | ||
} |
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.
Do we need to make this assumption? If we assumed the public types are not allocated outside the module due to closed-world, we could still optimize the casts in the test case without changing the public types. It is probably safer to never make assumptions about public types, though 🤔
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, we could do that, if we checked and found we'd need no changes to public types. I'll add a TODO, but it seems nontrivial.
Co-authored-by: Thomas Lively <[email protected]>
No new fuzzer issues, landing. |
This fixes a regression from #7019. That PR fixed an error on situations with mixed public and private types, but it made us stop optimizing in valid cases, including cases with entirely private types. The specific regression was that we checked if we had an entry in the map of "can become immutable", and we thought that was enough. But we may have a private child type with a public parent, and still be able to optimize in the child if the field is not present in the parent. We also did not have exhaustive checking of all the states canBecomeImmutable can be, so add those + testing.
These were added to avoid common problems with closed world mode, but
in practice they are causing more harm than good, forcing users to work
around them. In the meantime (until #6965 ), remove this validation to unblock
current toolchain makers.
There is a risk of getting more user reports here, but I don't see any other
risk. @tlively you were worried about fuzz bugs, but I don't think we depend
on validation for deciding what to optimize, so that should be ok? (I've fuzzed
a few thousand iterations so far without issue, too.)