-
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
AArch64: Compressed pointer decoding optimization when base is zero. #1094
Conversation
Hi there, |
Thank you for your contribution. I'll take a look as soon as possible. (And the other AArch64 related patches too) |
Currently decoding a compressed pointer with zero base will generate the following code: add x0, xzr, x0, lsl oracle#3 This patch will optimize it to: lsl x0, x0, oracle#3 Here is a jmh benchmark to decode a compressed pointer: public class UncompressPointer { private static final int field0 = 1000000; private int field1; static class A { B b; A(B b) { this.b = b; } } static class B { int field; B(int i) { this.field = i; } } static A[] arr; static { arr = new A[field0]; for (int i = 0; i < field0; i++) arr[i] = new A(new B(i)); } public static int func() { int result = 0; for (int i = 0; i < field0; i++) { result += arr[i].b.field; } return result; } @benchmark public void jmhUncompressPointer() { field1 = func(); } } And the performance results: Score Error Units Without this patch 21598.534 ? 2188.242 us/op With this patch 19322.791 ? 1219.022 us/op Change-Id: I5af6799eb82470d5598f5991e9210f99874f458a
e6eb9b7
to
a44a5dc
Compare
Thanks so much! |
|
||
private void compareAssembly() { | ||
byte[] expected = masm1.close(false); | ||
byte[] actual = masm2.close(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this kind of test. Nice work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Currently decoding a compressed pointer with zero base will generate
the following code:
add x0, xzr, x0, lsl #3
This patch will optimize it to:
lsl x0, x0, #3
Here is a jmh benchmark to decode a compressed pointer:
And the performance results:
Change-Id: I5af6799eb82470d5598f5991e9210f99874f458a