RFR: 8295110: RISC-V: Mark out relocations as incompressible
Fei Yang
fyang at openjdk.org
Wed Oct 12 06:45:03 UTC 2022
On Tue, 11 Oct 2022 05:32:51 GMT, Xiaolin Zheng <xlinzheng at openjdk.org> wrote:
> This patch marks all relocations incompressible as pre-discussions at [1] and converts instructions to their 2-byte compressible counterparts as much as possible when UseRVC is enabled.
>
> Chaining PR #10421.
>
> 1. Code size reduction rate: about ~17% now after this patch under RVC, meaning if there's a piece of code of 1000 bytes, it may shrink to 830 bytes when RVC is enabled. [2]
> 2. Performance: conservatively no regressions observed. [3]
>
> Several details:
> 1. The overloaded `relocate()` methods hide `IncompressibleRegion`s inside, to exclude instructions used at relocations from being compressed.
> 2. I kept two different lambda flavours because I think
>
> __ la_patchable(t0, RuntimeAddress(dest), [&] (int32_t off) {
> __ jalr(x1, t0, off);
> });
>
> might make programmers overlook the `__ jalr()` inside the lambda. So I made the code with jalr aligning the previous style:
>
> __ la_patchable(t0, RuntimeAddress(dest), [&] (int32_t off) {
> __ jalr(x1, t0, off);});
>
> But well maybe it's up to the reviewers' flavor and I am okay with any case.
>
>
> Having tested several times hotspot tier1~tier4; Testing another turn on board.
>
>
>
> [1] https://mail.openjdk.org/pipermail/riscv-port-dev/2022-September/000615.html
> [2] https://mail.openjdk.org/pipermail/riscv-port-dev/2022-September/000633.html
> [3] https://mail.openjdk.org/pipermail/riscv-port-dev/2022-October/000656.html
Personally, I prefer the following style:
__ relocate(spec, [&] {
int32_t off = 0;
la_patchable(t0, RuntimeAddress(entry), off);
jalr(x1, t0, off);
});
Then the code looks more unified to me. And we don't need to extend a new la_patchable interface.
-------------
PR: https://git.openjdk.org/jdk/pull/10643
More information about the hotspot-dev
mailing list