RFR: JDK-8297660: x86: Redundant test+jump in C1 allocateArray
Thomas Stuefe
stuefe at openjdk.org
Sat Nov 26 10:49:06 UTC 2022
On Sat, 26 Nov 2022 09:48:07 GMT, Andrew Haley <aph at openjdk.org> wrote:
> Surely a macro assembler function that takes a length should not misbehave of that length is zero. It's a fairly basic correctness criterion that it most not, because zero is a valid number. We shouldn't be building fragility into the system. I agree that it makes sense to remove one of the checks, but it should be the one in the caller.
Okay, did that.
I did it the other way around originally since the outer test cannot be removed, it's the sub of the header size. So the test in zero_memory is still redundant, but the outer jz has been removed at least:
0x00007f8080ca2f02: sub $0x10,%rsi << initialize_body
0x00007f8080ca2f06: test %rsi,%rsi << zero_memory
0x00007f8080ca2f09: je 0x00007f8080ca2f20 << zero_memory
-------------
PR: https://git.openjdk.org/jdk/pull/11372
More information about the hotspot-dev
mailing list