On Tue, 22 Oct 2024 15:56:21 GMT, Andrew Haley <a...@openjdk.org> wrote:
>> Note also that `inc_held_monitor_count` clobbers `rscratch2`. That might be >> worth a comment at the call site. >> I guess `inc_held_monitor_count` is so hot that we can't push and pop >> scratch registers, in which case it'd clobber nothing. > >> Historically, silently using `rscratch1` and `rscratch2` in these macros has >> sometimes turned out to be a mistake. Please consider making `rscratch2` an >> additional argument to `fast_lock`, so that it's explicit in the caller. It >> won't make any difference to the generated code, but it might help >> readbility. > > Hmm, forget that. It's rather tricky code, that's true, but I think we're OK. I see we are already using rscratch1 in these locking macros so I could change it to use that instead. But looking at all other macros in this file we are already using rscratch1 and rscratch2 too, so I think we would be fine either way. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21565#discussion_r1813513144