RFR (S): 8152179: C2: Folding of unsigned loads is broken w/ @Stable
vladimir.kozlov at oracle.com
Wed Mar 23 23:15:30 UTC 2016
I don't understand changes in is_mismatched_access(). It does not guarantee/check that loads have masking. If there are no masking then short and char loads should mismatch. Right?
On 3/23/16 9:56 AM, Vladimir Ivanov wrote:
> Byte and short loads with small masks are converted to unsigned loads.
> Constant folding logic for array elements doesn't respect unsigned loads and replace them with signed values.
> It usually happens when a small mask is applied to the value produced by a signed load (see AndINode::Ideal ):
> byteArr [i] & 0x000F; // AndI (LoadB 0x000F) => AndI (LoadUB 0xF)
> shortArr[i] & 0x000F; // AndI (LoadS 0x000F) => AndI (LoadUS 0xF)
> byteArr [i] & 0x00FF; // AndI (LoadB 0x00FF) => LoadUB
> shortArr[i] & 0xFFFF; // AndI (LoadS 0xFFFF) => LoadUS
> Field loads aren't affected since they are constant folded during parsing.
> Testing: regression tests, hotspot/compiler/stable, JPRT
> Best regards,
> Vladimir Ivanov
> PS: while experimenting with the fix, I found that constant folding of @Stable loads doesn't always happen. Filed 8152590 .
>  http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/d9d0a63499ce/src/share/vm/opto/mulnode.cpp#l483
>  https://bugs.openjdk.java.net/browse/JDK-8152590
More information about the hotspot-compiler-dev