RFR: 8369947: Bytecode rewriting causes Java heap corruption on RISC-V
Aleksey Shipilev
shade at openjdk.org
Fri Oct 17 07:17:04 UTC 2025
On Fri, 17 Oct 2025 07:01:49 GMT, Fei Yang <fyang at openjdk.org> wrote:
> @shipilev @theRealAph : For the aarch64 counterpart, shouldn't the `ldarb` at [1] prevent the reordering of `STR` of PBC and `STLR` of RFE? It's a load instruction with acquire semantics.
Yes, I was confused about this myself. A key thing for this particular issue: the _reader_ we need to sync up with is not `patch_bytecode`, it is the thread that _executes_ the patched bytecode. In other words, the _writer_ is `patch_bytecode`, and _reader_ is executing thread.
So acquire barrier in `patch_bytecode` does not help this case, because it is a write path, it needs release. The read path needs some other synchronization for acquire-like semantics; in aarch64 we reasoned the control dependency on bytecode itself and the barrier in RFE resolution is enough to do this. See my writeup here: https://bugs.openjdk.org/browse/JDK-8369506?focusedId=14824157#comment-14824157 -- and the comments after it.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27850#issuecomment-3414168731
More information about the hotspot-compiler-dev
mailing list