RFR: 8287637: Loom: Mismatched VirtualThread::state accessor
Aleksey Shipilev
shade at openjdk.java.net
Wed Jun 1 08:05:04 UTC 2022
Found this by reading the code, no test failure detected yet.
The field is defined 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`
- [ ] Linux AArch64 fastdebug, `jdk_loom hotspot_loom`
-------------
Commit messages:
- Fix
Changes: https://git.openjdk.java.net/jdk/pull/8967/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8967&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8287637
Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod
Patch: https://git.openjdk.java.net/jdk/pull/8967.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8967/head:pull/8967
PR: https://git.openjdk.java.net/jdk/pull/8967
More information about the hotspot-runtime-dev
mailing list