RFR: 8296136: Use correct register in aarch64_enc_fast_unlock() [v2]

Roman Kennke rkennke at openjdk.org
Wed Nov 2 11:32:21 UTC 2022


On Tue, 1 Nov 2022 12:16:48 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> In aarch64_enc_fast_unlock() (aarch64.ad) we have this piece of code:
>> 
>> 
>>     __ ldr(tmp, Address(oop, oopDesc::mark_offset_in_bytes()));
>>     __ tbnz(disp_hdr, exact_log2(markWord::monitor_value), object_has_monitor);
>> 
>> 
>> The tbnz uses the wrong register - it should really use tmp. disp_hdr has been loaded with the displaced header of the stack-lock, which would never have its monitor bits set, thus the branch will always take the slow path. In this common case, it is only a performance nuisance. In the case of !UseHeavyMonitors it is even worse, then disp_hdr will be unitialized, and we are facing a correctness problem.
>> 
>> As far as I can tell, the problem dates back to when aarch64 C2 parts have been added to OpenJDK.
>> 
>> Testing:
>>  - [x] tier1
>>  - [x] tier2
>>  - [x] tier3
>>  - [x] tier4
>
> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Same fix for RISC-V

Thank you!

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

PR: https://git.openjdk.org/jdk/pull/10921


More information about the hotspot-compiler-dev mailing list