-
-
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
Fix === and objectid of object with potentially undef inline immutable field #37557
Conversation
This is what led to #37511 and depends on #37511 . It came out of an attempt to reuse |
3894699
to
9707be4
Compare
src/codegen.cpp
Outdated
|
||
// TODO: handle the case where arg1.typ != arg2.typ, or when one of these isn't union, | ||
// or when the union can be pointer | ||
if (arg1.TIndex && arg2.TIndex && arg1.typ == arg2.typ && |
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.
if (arg1.TIndex && arg2.TIndex && arg1.typ == arg2.typ && | |
if (arg1.TIndex && arg2.TIndex && jl_egal(arg1.typ, arg2.typ) && |
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 assume so is the assert in the callee.
An undef field should always be treated equal to another undef field of the same type since there's no other way for the user to tell the difference between these. These could previously cause inconsistent comparison results or crashes. * Mark these types as `haspadding` so that they'll not hit the `memcmp` fast path. * Make sure `jl_egal` and `jl_object_id_` doesn't read bits fields in undef inline immutable field * Use `emit_getfield_knownidx` in `emit_bits_compare` so that the check can be done more easily Handle union fields of the same type in `emit_f_isa` to avoid regression. * Allow input to `emit_f_isa` to be NULL and lazily emit NULL check if necessary
9707be4
to
ba2f681
Compare
) An undef field should always be treated equal to another undef field of the same type since there's no other way for the user to tell the difference between these. These could previously cause inconsistent comparison results or crashes. * Mark these types as `haspadding` so that they'll not hit the `memcmp` fast path. * Make sure `jl_egal` and `jl_object_id_` doesn't read bits fields in undef inline immutable field * Use `emit_getfield_knownidx` in `emit_bits_compare` so that the check can be done more easily Handle union fields of the same type in `emit_f_isa` to avoid regression. * Allow input to `emit_f_isa` to be NULL and lazily emit NULL check if necessary (cherry picked from commit e84fec4)
) An undef field should always be treated equal to another undef field of the same type since there's no other way for the user to tell the difference between these. These could previously cause inconsistent comparison results or crashes. * Mark these types as `haspadding` so that they'll not hit the `memcmp` fast path. * Make sure `jl_egal` and `jl_object_id_` doesn't read bits fields in undef inline immutable field * Use `emit_getfield_knownidx` in `emit_bits_compare` so that the check can be done more easily Handle union fields of the same type in `emit_f_isa` to avoid regression. * Allow input to `emit_f_isa` to be NULL and lazily emit NULL check if necessary (cherry picked from commit e84fec4)
An undef field should always be treated equal to another undef field of the same type
since there's no other way for the user to tell the difference between these.
These could previously cause inconsistent comparison results or crashes.
Mark these types as
haspadding
so that they'll not hit thememcmp
fast path.Make sure
jl_egal
andjl_object_id_
doesn't read bits fields in undef inline immutable fieldUse
emit_getfield_knownidx
inemit_bits_compare
so that the check can be done more easilyHandle union fields of the same type in
emit_f_isa
to avoid regression.Allow input to
emit_f_isa
to be NULL and lazily emit NULL check if necessary