riscv64: ABIStackAlignment does not equal mandated value in psABI standard
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox142 | --- | fixed |
People
(Reporter: csmantle, Assigned: csmantle)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
Constants ABIStackAlignment and JitStackAlignment (8) does not match the values mandated by the psABI (16).
- https://searchfox.org/mozilla-central/rev/1eb4f27ece7cb96ac94b635ad0dc95c00d1443db/js/src/jit/riscv64/Assembler-riscv64.h#92-94
- https://riscv-non-isa.github.io/riscv-elf-psabi-doc/#integer-cc
The stack grows downwards (towards lower addresses) and the stack pointer shall be aligned to a 128-bit boundary upon procedure entry. The first argument passed on the stack is located at offset zero of the stack pointer on function entry; following arguments are stored at correspondingly higher addresses.
| Assignee | ||
Comment 1•1 year ago
|
||
Directly changing these two values at once would make all jit-tests to fail. Would you mind providing me with some pointers on where to start?
Comment 2•1 year ago
|
||
(In reply to Rong Bao [:csmantle] from comment #1)
Directly changing these two values at once would make all jit-tests to fail. Would you mind providing me with some pointers on where to start?
We use 16 also on arm64 and x64 so code should mostly be able to do the right thing. Are we failing the checkStackAlignment breakpoint here? In that case we have to find out where that happens and fix the alignment. Maybe the generateEnterJIT implementation for RISCV needs to be fixed to align the stack to 16 bytes?
| Assignee | ||
Comment 3•1 year ago
|
||
I pinpointed this issue down to one assertion in function EmitBaselineLeaveStubFrame at https://searchfox.org/mozilla-central/rev/162a9137664040430d01d15c4a9be41c331c09ac/js/src/jit/riscv64/SharedICHelpers-riscv64.h#54.
Curiously, some other architectures has this assertions while some do not:
| Assignee | ||
Comment 5•1 year ago
|
||
Updated•1 year ago
|
| Assignee | ||
Comment 6•1 year ago
|
||
| Assignee | ||
Comment 7•1 year ago
|
||
| Assignee | ||
Comment 8•1 year ago
|
||
In diff D256932, I chose to remove this assert to match four 128-bit aligned architectures' choice: loong64, mips64, x86, and x64. May I get some review on this? Thanks.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 12•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/8e7eb9353156
https://hg.mozilla.org/mozilla-central/rev/5ef9841219f5
https://hg.mozilla.org/mozilla-central/rev/dbb99e019406
Updated•1 year ago
|
Description
•