[11] RFR(XS) 8202948: C2: assert(init_offset >= 0) failed: positive offset from object start
Vladimir Kozlov
vladimir.kozlov at oracle.com
Thu Jun 14 15:41:34 UTC 2018
Thank you, Tobias
Yes, I need to add test.
Thanks,
Vladimir
On 6/14/18 12:07 AM, Tobias Hartmann wrote:
> Hi Vladimir,
>
> looks good to me but shouldn't we add the test (looks like you came up with a very simple version)?
>
> Thanks,
> Tobias
>
> On 13.06.2018 19:14, Vladimir Kozlov wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8202948
>>
>> Predicates and Range checks before main loop will not help since they are runtime checks and limit
>> is not constant. The problem happens during compilation because vectorization is attempted for
>> over-unrolling loop which will not be executed in runtime (dead loop). Stride is negative (-3) value
>> and initial is 2 - loop will be executed at least once (or never) because of other conditions in
>> code. C2 did not recognize this because the test fails only with -Xcomp when profiling data is no
>> available (it passed without -Xcomp).
>>
>> Simplest fix is to convert the assert into compilation check which will skip superword optimization
>> in such case.
>>
>> diff -r 0d47e89382ed src/hotspot/share/opto/superword.cpp
>> --- a/src/hotspot/share/opto/superword.cpp
>> +++ b/src/hotspot/share/opto/superword.cpp
>> @@ -887,7 +887,9 @@
>> if (init_nd->is_Con() && p.invar() == NULL) {
>> int init = init_nd->bottom_type()->is_int()->get_con();
>> int init_offset = init * p.scale_in_bytes() + offset;
>> - assert(init_offset >= 0, "positive offset from object start");
>> + if (init_offset < 0) { // negative offset from object start?
>> + return false; // may happen in dead loop
>> + }
>> if (vw % span == 0) {
>> // If vm is a multiple of span, we use formula (1).
>> if (span > 0) {
>>
>> Test passed with and without Predicates with this fix.
>>
>> Tested with tier1, tier2, precheckin-xcomp
>>
More information about the hotspot-compiler-dev
mailing list