-
-
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
delete_method: remove method from any pre-existing ambiguities #28916
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.
The ambiguity doesn't disappear, it should simply be no longer applicable during lookup
So you mean the fix should be here? Lines 2006 to 2016 in 3ab56f1
Since we don't store the max_world in the method itself, wouldn't you have to walk the method table's typemapentry and find instances of mambig ? Doesn't that introduce an O(MN) step, where M is the number of methods previously determined to be possibly-ambiguous (i.e., length(m.ambig) ) and N is the number of methods in the typemapentry ? Or perhaps we should just get rid of the ambig field altogether and recompute everything by type intersection every time?
What's the downside of just removing it from |
Bump @vtjnash. I'm willing to implement it but I need to know more about why this isn't the right solution. AFAIK the |
We can just store it there—we already have copies of many of the other fields (sig, min-world, name). Currently, it seems like the purpose of Method is essentially just to contain the information about how to find it in the method table.
It's only supposed to check them for dispatch events in the applicable world (e.g. if someone is using a generated function, any later change in method definitions shouldn't be visible to them) |
OK, but redesigning So, is reasonable to fix this by implementing the |
Redesign, hm? Just add the field. That won't change anything about |
I'm just envisioning changes sprinkled throughout |
Mostly just need to revert a529199#diff-ab8c4a99930a43168794a7bd3b8bfa91 |
base/compiler/utilities.jl
Outdated
println(linfo.def) | ||
println(typeof(linfo.def)) | ||
println(typeof(m.source)) | ||
println(m.source) |
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.
With a make debug
, this debugging output produces lots of lines like (nb I've manually shortened the arrays)
print(Core.CoreSTDOUT, Type{Core.MethodInstance})
Core.print(...)
Method
Array{UInt8, 1}
Array{UInt8, (66,)}[0x00, 0x03, 0x00, 0x00, 0x00, ...]
show(Core.CoreSTDOUT, Type{Core.MethodInstance})
Core.show(...)
Method
Array{UInt8, 1}
Array{UInt8, (119,)}[0x00, 0x03, 0x00, 0x00, ...]
which all seem fine.
Then we get to the fatal error
validate_code_in_debug_mode(Core.MethodInstance, Core.CodeInfo, String)
Core.Compiler.validate_code_in_debug_mode(...)
Method
Core.MethodInstance
Array{UInt8, (452,)}[0x00, 0x07, 0x00, 0x00, ...]
error during bootstrap:
LoadError(at "compiler/compiler.jl" line 3: LoadError(at "compiler/bootstrap.jl" line 8: MethodError(f=typeof(Core.Compiler.copy_code_info)(), args=(Array{UInt8, (452,)}[0x00, 0x07, 0x00, 0x00, ...],), world=0x0000000000000e5d)))
Notice that m.source
is a MethodInstance
, which shouldn't happen and is inconsistent with the actual value that is printed. Interestingly, you can explain this if this is an off-by-one bug in the field offset and you're picking up unspecialized
instead. Since I added a field to method_t
, this seems plausible. Know of any places where field offsets are likely to be hard-coded?
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.
Got it:
Line 2218 in 2346be8
jl_svecset(jl_method_type->types, 10, jl_method_instance_type); |
Just happened to stumble across it while searching.
aae182b
to
f0b56a8
Compare
OK, ready for another round of review. |
...and now with bonus features (aka, passing tests even with Is it possible to run this against the package ecosystem and see whether adding that field to |
I think w/ @Keno 's new PkgEval it should be possible, though I'm not sure how much we worry about the number packages that actually pass tests currently. I think we have a critical mass that a PkgEval run would given decent signal. |
FWIW NewPkgEval takes less time to run than any of our current CI builds. |
How does one run it? If there's a bot it's one of the many discussions I've missed. |
The "one" must be @Keno and he must be brought a sacrificial offering. |
OK, that's easy: I'll find a rare but serious bug that is triggered by a combination of LLVM, our inlining engine, and 32bit that nevertheless can't be fixed without rewriting both Julia's compiler and all of LLVM. That should keep him happy for at least 3 days. |
@vtjnash, any chance you can take a second look at this? Revise has started working around this bug whenever it can, but we should still fix the core problem. I think this is ready to merge, but I won't do so without your approval. |
Fixes #28899. Kinda amazing we never noticed this til now.