-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
compute mayinlinealloc more accurately (for ccall) #40947
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
This allows code to assume that `->layout` will be assigned when analyzing a type in codegen if the type is mapped to C. The ABI code often assumes this, and it is also just much generally easier that the jl_struct_to_llvm code can share the jl_compute_field_offsets results.
fc9d6ed to
802658d
Compare
| if (ty->layout->npointers > 0) { | ||
| if (pointerfree) | ||
| return 0; | ||
| if (ty->ninitialized != jl_svec_len(ty->types)) |
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.
No need to do it now, but it occurs to me ninitialized can move to TypeName as well?
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.
Good observation. I can make it n_uninitialized, then it would be shared. I'll do that once this is merged. I've also thought about removing ->names, since that is always shared too.
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.
names isn't shared for NamedTuples. I guess if we wanted we could fetch it out of the parameters in that case though.
| jl_datatype_t *jst = (jl_datatype_t*)ty; | ||
| return jst->layout || jl_has_fixed_layout(jst); | ||
| } | ||
| if (jl_is_tuple_type(jl_unwrap_unionall(ty))) |
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.
Why are tuple types a special case here?
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.
It would need to forward a covariant flag through jl_has_fixed_layout, and it just seemed unnecessary initially. People probably aren't trying to pass in abstract Tuples by value to ccall very often.
This allows code to assume that `->layout` will be assigned when analyzing a type in codegen if the type is mapped to C. The ABI code often assumes this, and it is also just much generally easier that the jl_struct_to_llvm code can share the jl_compute_field_offsets results.
This allows code to assume that `->layout` will be assigned when analyzing a type in codegen if the type is mapped to C. The ABI code often assumes this, and it is also just much generally easier that the jl_struct_to_llvm code can share the jl_compute_field_offsets results.
This allows code to assume that
->layoutwill be assigned whenanalyzing a type in codegen if the type is mapped to C. The ABI code
often assumes this, and it is also just much generally easier that the
jl_struct_to_llvm code can share the jl_compute_field_offsets results.