RFR: JDK-8300783: Consolidate byteswap implementations [v8]
Justin King
jcking at openjdk.org
Wed Jan 25 14:22:03 UTC 2023
On Wed, 25 Jan 2023 01:30:25 GMT, David Holmes <dholmes at openjdk.org> wrote:
> Have to wonder if we can go further with `get_Java_u2` etc, in a next step?
Probably. We can visit that in https://github.com/openjdk/jdk/pull/12078 after this one. We might be able to do something like `LittleEndian` and `BigEndian` where each has `store`, `store_unaligned`, `load`, and `load_unaligned`. `LittleEndian` would convert native to little endian for store and do the inverse for load. `BigEndian` would do the same for big endian. In cases where they are the same to native, its a noop.
uint32_t* aligned_ptr = /* */;
void* unaligned_ptr = /* */;
BigEndian::store(aligned_ptr, 1);
BigEndian::load(aligned_ptr);
BigEndian::store_unaligned<uint32_t>(unaligned_ptr, 1);
BigEndian::load_unaligned<uint32_t>(unaligned_ptr);
Maybe. Just a thought.
-------------
PR: https://git.openjdk.org/jdk/pull/12114
More information about the hotspot-jfr-dev
mailing list