RFR: 8320275: assert(_chunk->bitmap().at(index)) failed: Bit not set at index
Patricio Chilano Mateo
pchilanomate at openjdk.org
Tue Nov 28 00:38:15 UTC 2023
Please review the following fix. The assert fails while verifying the top frame of the stackChunk before returning from a thaw call. The stackChunk is in gc mode but we found a narrow oop for this c2 compiled frame that doesn't have its corresponding bit set. This is because while thawing its callee we cleared the bitmap range associated with the argument area, but this narrow oop happens to land at the very last stack slot of that region.
Loom code assumes the size of the argument area is always a multiple of 2 stack slots, as SharedRuntime::java_calling_convention() shows. But c2 doesn't seem to follow this convention and, knowing the last passed argument only takes one stack slot, it's using the remaining space to store a narrow oop for the caller. There are more details about the specific crash in JBS.
The initial proposed fix is to just restrict the range of the bitmap we clear by excluding the last stack slot of the argument area, since passed oops are always word aligned. I've also experimented with a patch where I changed SharedRuntime::java_calling_convention() and Fingerprinter::do_type_calling_convention() to not round up the number of stack slots used, and then changed the callers to use a round up value or not depending on the needs [1]. I wasn't convinced it was worthy given we only care about this difference in this Loom code, but I don't mind going with that fix instead. The 3rd alternative would be to just change c2 to not use this stack slot and start spilling at a word aligned offset from the sp.
I run the patch with the failing test and verified the crash doesn't reproduce anymore. I've also run this patch through loom tiers1-5.
Thanks,
Patricio
[1] https://github.com/pchilano/jdk/commit/42ae9269b28beb6f36c502182116545b680e418f
-------------
Commit messages:
- v1
Changes: https://git.openjdk.org/jdk/pull/16837/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16837&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8320275
Stats: 15 lines in 3 files changed: 6 ins; 1 del; 8 mod
Patch: https://git.openjdk.org/jdk/pull/16837.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16837/head:pull/16837
PR: https://git.openjdk.org/jdk/pull/16837
More information about the hotspot-dev
mailing list