RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v4]
Johannes Graham
duke at openjdk.org
Thu Jan 23 21:46:47 UTC 2025
On Thu, 23 Jan 2025 19:17:19 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> *edit2* Actually, the alternative version has an issue if either of the lo values is 0
>
> Why? `r0->_hi | r1->_hi == 0` would imply `r0->_hi == 0 && r1->_hi == 0`. This means that both operands are constants and should be filtered out from the previous step already.
The symptom I'm seeing with the alternative version is that the build fails with an exception of
Creating jdk.net.jmod
Error: More than one SourceFile attribute
java.lang.module.InvalidModuleDescriptorException: More than one SourceFile attribute
at java.base/jdk.internal.module.ModuleInfo.invalidModuleDescriptor(ModuleInfo.java:1228)
I am thinking that's a result of a bad xor. If I change the ``if ( (r0->_lo >= 0) `` to ``if ( (r0->_lo > 0)`` the build works again, but that might just be luck.
The case I'm concerned about is if `r0->_hi `and `r1->_hi` are both the same power of 2, say for example 4 and both lo values are 0. Then `round_up_power_of_2(4,4)-1` is 3. However, if the runtime value of one arg is 0 and the other is 4, `0 ^ 4 = 4`, which is larger than 3.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1927719778
More information about the hotspot-compiler-dev
mailing list