Integrated: 8287637: Loom: Mismatched VirtualThread::state accessor
Aleksey Shipilev
shade at openjdk.java.net
Fri Jun 3 16:47:36 UTC 2022
On Wed, 1 Jun 2022 07:57:34 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> Found this by reading the code, no test failure detected yet.
>
> The field is defined on Java side as:
>
>
> // virtual thread state, accessed by VM
> private volatile int state;
>
>
> The field is defined on VM side as:
>
>
> macro(_state_offset, k, "state", int_signature, false)
>
>
> And yet, it is accessed as `short`:
>
>
> u2 java_lang_VirtualThread::state(oop vthread) {
> return vthread->short_field_acquire(_state_offset);
> }
>
>
> I think this is just asking for trouble on different endianness: the partial `u2` read from `int` field can read the "higher" two bytes, not the "lower" two bytes.
>
> Additional testing:
> - [x] Linux x86_64 fastdebug, `jdk_loom hotspot_loom`
> - [x] Linux AArch64 fastdebug, `jdk_loom hotspot_loom`
This pull request has now been integrated.
Changeset: ce5ae517
Author: Aleksey Shipilev <shade at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/ce5ae51773974dfc324b5fff52accbe14a0c032e
Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod
8287637: Loom: Mismatched VirtualThread::state accessor
Reviewed-by: alanb
-------------
PR: https://git.openjdk.java.net/jdk/pull/8967
More information about the hotspot-runtime-dev
mailing list