RFR: 8275874: [JVMCI] use volatile accessors for aligned reads in c2v_readFieldValue

Aleksey Shipilev shade at openjdk.java.net
Tue Oct 26 10:05:09 UTC 2021


On Mon, 25 Oct 2021 14:33:27 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

> [JDK-8275645](https://bugs.openjdk.java.net/browse/JDK-8275645) resulted in loosing single-copy atomicity for reads in `c2v_readFieldValue`. This PR fixes that by using `<type>_field_acquire` accessors for all aligned reads and only using `<type>_field` accessors for unaligned reads.

As I read the original change (https://github.com/openjdk/jdk/commit/4dec8fc4cc2b1762fba554d0401da8be0d6d1166) more, I am puzzled some more. Apart from fields that carry their `isVolatile` properties, some other things, like constants, were accessed as volatiles unconditionally. Assuming the volatility is indeed needed there, then what this patch does is breaking that property for constants that reside at unfortunate (unaligned) offsets, right? That does not seem correct.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6109


More information about the hotspot-compiler-dev mailing list