Closed Bug 1976699 Opened 1 year ago Closed 1 year ago

riscv64: ABIStackAlignment does not equal mandated value in psABI standard

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

defect

Tracking

()

RESOLVED FIXED
142 Branch
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).

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.

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?

Flags: needinfo?(jdemooij)

(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?

Flags: needinfo?(jdemooij)

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:

Cross-referencing this to bug 1975932.

See Also: → 1975932
Assignee: nobody → webmaster
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

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.

Flags: needinfo?(jdemooij)
Blocks: sm-jits
Severity: -- → S4
Priority: -- → P3
Flags: needinfo?(jdemooij)
Pushed by jdemooij@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/40c70a15bb5a https://hg.mozilla.org/integration/autoland/rev/8e7eb9353156 [riscv64] Part 1: Fix JitRuntime::generateEnterJIT stack alignment on an odd number of arguments and notOsr code path. r=jandem https://github.com/mozilla-firefox/firefox/commit/876588071f64 https://hg.mozilla.org/integration/autoland/rev/5ef9841219f5 [riscv64] Part 2: Remove erroneous stack alignment assert in EmitBaselineLeaveStubFrame. r=jandem https://github.com/mozilla-firefox/firefox/commit/10a56804791b https://hg.mozilla.org/integration/autoland/rev/dbb99e019406 [riscv64] Part 3: Match ABIStackAlignment and JitStackAlignment with RISC-V psABI's 128-bit boundary. r=jandem
Duplicate of this bug: 1975932

Removing redundant See Also refs.

See Also: 1975932 →
QA Whiteboard: [qa-triage-done-c143/b142]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: