WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
256235
Eliminate redundant reloading of registers when calling functions in BBQ JIT
https://bugs.webkit.org/show_bug.cgi?id=256235
Summary
Eliminate redundant reloading of registers when calling functions in BBQ JIT
David Degazio
Reported
2023-05-02 16:45:12 PDT
rdar://108812140
Currently, the implementation for calls in BBQ JIT first saves all values in caller-saved registers, then moves all argument values into the correct parameter locations per the calling convention. This is correct, but leads to a lot of redundant work. Specifically, I've noticed we tend to see a lot of code like this: [ 0x61f3] Call <53688> 0x13fa791b8: stur w0, [fp, #-160] <53692> 0x13fa791bc: stur w1, [fp, #-176] <53696> 0x13fa791c0: stur w2, [fp, #-192] <53700> 0x13fa791c4: ldur w0, [fp, #-160] <53704> 0x13fa791c8: ldur w1, [fp, #-176] <53708> 0x13fa791cc: ldur w2, [fp, #-192] <53712> 0x13fa791d0: movz w3, #0x0 <53716> 0x13fa791d4: bl 0x13fa791d4 -> <53716> Obviously, if we store a register to a stack slot, and then don't modify that register at all, we shouldn't need to load it back from the stack slot immediately. So that should save us maybe half the instructions on its own. But additionally, in BBQ JIT currently, every operand except constants pretty much is a temp. Whenever we use a temp, that corresponds to popping it off the WASM abstract stack, ending its live range - ergo, we shouldn't need to save the value in the first place. Probably these loads and stores buffer pretty well already, so I don't expect this to be a major performance win (although it probably doesn't hurt!). Maybe more important though is it's kind of a no-brainer code size optimization, since we can eliminate a lot of instructions in a lot of cases without any real downside.
Attachments
Add attachment
proposed patch, testcase, etc.
David Degazio
Comment 1
2023-05-02 16:56:09 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/13383
EWS
Comment 2
2023-05-03 11:06:48 PDT
Committed
263638@main
(0b7790f1f183): <
https://commits.webkit.org/263638@main
> Reviewed commits have been landed. Closing PR #13383 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug