RFR: 8256387: Unexpected result if patching an entire instruction on AArch64 [v2]
Eric Liu
github.com+10482586+erik1iu at openjdk.java.net
Tue Nov 24 11:16:13 UTC 2020
> This patch fixed some potential risks in assembler_aarch64.hpp.
>
> According to the C standard, shift operation is undefined if the shift
> count greater than or equals to the length in bits of the promoted left
> operand.
>
> In assembler_aarch64.hpp, there are some utility functions for easily
> operating the encoded instructions. E.g.
>
> Instruction_aarch64::patch(address, int, int, uint64_t)
>
> All those functions use `(1U << nbits) - 1` to calculate mask which may
> have some potential risks if `nbits` equals 32. That would be an
> unexpected result if someone intends to deal with an entire instruction.
>
> To fix this issue, this patch simply uses `1ULL` to replace `1U`.
Eric Liu has updated the pull request incrementally with one additional commit since the last revision:
uses pre-defined macro `right_n_bits` to get the right-most bits set.
Change-Id: I456bcc883434b04527db912adaccc6a5f2dd96a0
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/1248/files
- new: https://git.openjdk.java.net/jdk/pull/1248/files/08ce2fba..29ed5d66
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1248&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1248&range=00-01
Stats: 6 lines in 1 file changed: 0 ins; 0 del; 6 mod
Patch: https://git.openjdk.java.net/jdk/pull/1248.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1248/head:pull/1248
PR: https://git.openjdk.java.net/jdk/pull/1248
More information about the hotspot-compiler-dev
mailing list