Comments about JDK-8213473: Replace testB_mem_imm matcher with testUB_mem_imm

Vladimir Kozlov vladimir.kozlov at oracle.com
Fri Nov 16 16:33:36 UTC 2018


Thank you, Bernard

For signed bytes we should restore signed testB_mem_imm. We can't use unsigned load in such case I think.

Vladimir

On 11/16/18 6:33 AM, Roman Kennke wrote:
> Hi Bernard,
> 
> Right...
> 
> So either we reinstate the testB pattern, or we make the conversion
> check for sign-extended mask too? Not sure if the latter would be 100%
> correct though.
> 
> Roman
> 
>> Hi,
>>
>> The current fix [1] for JDK-8213473 [2] replaces 'testB_mem_imm' with
>> 'testUB_mem_imm' in 'x86_64.ad' which is fine for unsigned bytes, for
>> example:
>>    if ((flags & 0x80) != 0) ...
>>
>> But per JLS §5.6.2 & §5.1.2, if we have something like [3]:
>>    if ((flags & (byte)0x80) != 0) ...
>>
>> the mask is 32-bit sign-extended and 'LoadB' isn't converted to
>> 'LoadUB' in 'AndINode::Ideal' [4] which is fine.
>>
>> Unfortunately 'testUB_mem_imm' won't be matched in this case, so I
>> guess we'd need both 'testB_mem_imm' & 'testUB_mem_imm' patterns.
>>
>> If we all agree, I can create a JBS issue and send out a RFR for this?
>>
>> Thanks,
>> Bernard
>>
>> [1] http://hg.openjdk.java.net/jdk/jdk/rev/656d2f222b42
>> [2] https://bugs.openjdk.java.net/browse/JDK-8213473
>> [3] http://hg.openjdk.java.net/jdk/jdk/file/74109912c738/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN.java#l165
>> [4] http://hg.openjdk.java.net/jdk/jdk/file/74109912c738/src/hotspot/share/opto/mulnode.cpp#l493
>>
> 


More information about the hotspot-dev mailing list