-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1878113: Generate better code for arm64 VM wrappers r=jandem
There are three parts to this patch: 1. When we're building the exit frame, instead of moving both the SP and the PSP for every push, we move the SP all at once. This lets us eliminate 3 instructions. 2. The syncStackPtr in callWithABIPre is redundant with the syncStackPtr in call. Removing it eliminates another instruction. 3. Prior to this patch, the VM wrapper epilogue looked like this: ``` mov x28, x29 // restore fp to psp mov sp, x28 A // sync sp ldr x29, [x28], #8 // restore saved fp to fp ldr x16, [x28], #32 // load return address into x16 mov sp, x28 B // sync sp ret x16 // return to x16 ``` Instructions A and B look redundant. In my first version of this patch, I removed B. However, the two ldr instructions actually do a post-index modification of the PSP, so that version of the patch left SP and PSP unsynchronized when returning from the VM wrapper. Oddly, that version of the patch still passed all jit-tests. It seems much safer, though, to just remove A instead. In total, this removes 5 instructions from each VM wrapper. There is still some room for improvement around passing arguments: we emit a sync after we finish passing arguments, even if we aren't passing anything on the stack. In theory we could also allocate space for stack arguments while we're building the exit frame, but that would involve duplicating much more of the argument passing code. Differential Revision: https://phabricator.services.mozilla.com/D200541
- Loading branch information
1 parent
c2bb94d
commit 8acefc1
Showing
2 changed files
with
93 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters