RFR: 8375046: C2: Assertion failed in GrowableArray::remove_till(0) [v4]

Aleksey Shipilev shade at openjdk.org
Mon Jan 19 10:31:40 UTC 2026


On Wed, 14 Jan 2026 22:38:04 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>> 
>>  - Leave only the C2 fix
>>  - Merge branch 'master' into JDK-8375046-growable-array-till-zero
>>  - Only clear pos when needed
>>  - Handle the C2 side by removing/inlining remove_till
>>  - No trailing comma
>>  - Fix
>
> src/hotspot/share/opto/compile.cpp line 2148:
> 
>> 2146:     _late_inlines_pos = 0;
>> 2147:   }
>> 2148:   assert(_late_inlines_pos == 0, "sanity");
> 
> The bug is the assert in `GrowableArray::remove_range`. The argument to
> `remove_till` is explicitly documented as exclusive. And the arguments for
> `remove_range` are explicitly documented as being the range "[start, end)". And
> that's how it's implemented.  Except for the assert.
> 
> So I think that assert should be fixed, and the original code here is correct and
> shouldn't be modified.

All right, we can indeed say `[x; x)` is an empty range and accept it. `[0; 0)` is a special case of that special case. I made a few gtests to see that the whole thing still works as intended.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29171#discussion_r2704146350


More information about the hotspot-dev mailing list