-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[ffi][riscv] CopyFromCompoundToStack and PopFromStackToTypedDataBase confused by struct packing #48645
Comments
…time calls. TEST=ci Bug: #48645 Change-Id: I3454fa695e98c9bf2de9d32fc8b0f1187281c3d3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238301 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
As expected re: Ryan's note in the gardening log for yesterday, we saw the following failures on
|
These two assumptions enable copying the chunks in the struct on a word-size basis. edit:
Ah, RISC-V might be the first calling convention which splits packed members out over multiple registers in a way that we can't just treat the bytes as bytes. (All other calling conventions pass structs as fully on stack or as a pointer to a memory location) when they have misaligned members.) Then, this requires a bit more refactoring.
|
…hanges. Bug: #48645 Change-Id: I3729c7df81ad2089224bf886a8c5345cc857f026 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324764 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
TEST=ffi/*structs_by_value* Bug: #48645 Change-Id: I28a139aec3370be9799279325717057d7034b341 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332141 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
CopyFromCompoundToStack and PopFromStackToTypedDataBase compute a rolling byte offset based on the size of Representations seen so far. This doesn't correctly account for pieces whose Representation is widened compared to the piece's size (because our IL doesn't really support Representations smaller than 32-bit), nor would it account for varying alignments in pieces.
For example, in PassStruct9BytesPackedMixedx10DoubleInt32x2 passing a packed struct { uint8_t, double }
The double is incorrectly loaded from offset 4 instead of offset 1.
It looks like the relevant information is gone by time CopyFromCompoundToStack runs. Even its caller FfiCallConvertCompoundArgumentToNative has only a MultipleNativeLocation that knows the eventual destination is a 8-byte cpu register and a 8-byte fpu register, but doesn't seem to have any description of the struct fields these values are meant to come from.
The text was updated successfully, but these errors were encountered: