Integrated: 8319889: Vector API tests trigger VM crashes with -XX:+StressIncrementalInlining

Jatin Bhateja jbhateja at openjdk.org
Tue Mar 19 01:16:23 UTC 2024


On Wed, 13 Mar 2024 17:19:40 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> This bug fix patch fixes a crash occurring due to combined effect of bi-morphic inlining, exception handling, randomized incremental inlining. In this case top level slice API is invoked using concrete 256 bit vector, some of the intermediate APIs within sliceTemplate are marked for lazy inlining due to randomized IncrementalInlining, these APIs returns an abstract vector which when used for virtual dispatch of subsequent APIs results into bi-morphic inlining on account of multiple profile based receiver types. Consider following code snippet.
> 
> 
>     ByteVector sliceTemplate(int origin, Vector<Byte> v1) {
>         ByteVector that = (ByteVector) v1;
>         that.check(this);
>         Objects.checkIndex(origin, length() + 1);
>         VectorShuffle<Byte> iota = iotaShuffle();
>         VectorMask<Byte> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(length() - origin))));  [A]
>         iota = iotaShuffle(origin, 1, true);     [B]    
>         return that.rearrange(iota).blend(this.rearrange(iota), blendMask); [C]
>     }
> 
> 
> 
> Receiver for sliceTemplate is a 256 bit vector, parser defers inlining of toVector() API (see code at line A) and generates a Call IR returning an abstract vector. This abstract vector then virtually dispatches compare API. Compiler observes multiple profile based receiver types (128 and 256 bit byte vectors) for compare API and parser generates a chain of PredictedCallGenerators for bi-morphically inlining it.
>       
>          PredictedCallGenerators (Vector.compare)
>               PredictedCallGenerators (Byte256Vector.compare)
>                  ParseGenerator (Byte256Vector.compare)               [D]
>                  UncommonTrap (receiver other than Byte256Vector)
>               PredictedCallGenerators (Byte128Vector.compare)
>                  ParseGenerator (Byte128Vector.compare)               [E]
>                  UncommonTrap (receiver other than Byte128Vector)     [F]
>               PredictedCallGenerators (UncommonTrap)
>          [converged state] = Merge JVM State orginating from C and E  [G]
> 
>    Since top level receiver of sliceTemplate is Byte256Vector hence while executing the call generator for Byte128Vector.compare (see code at line E) compiler observes a mismatch b/w incoming argument species i.e. one argument is a 256 bit vector while other is 128 bit vector and throws an exception.
>     
> At state convergence point (see code at line G), since one of the control path resulted into an exception, compiler propagates ...

This pull request has now been integrated.

Changeset: 2dd5fba3
Author:    Jatin Bhateja <jbhateja at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2dd5fba3bd37c577b8442b67a67dbcb22b9a530e
Stats:     2 lines in 1 file changed: 0 ins; 0 del; 2 mod

8319889: Vector API tests trigger VM crashes with -XX:+StressIncrementalInlining

Reviewed-by: vlivanov, sviswanathan

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

PR: https://git.openjdk.org/jdk/pull/18282


More information about the hotspot-compiler-dev mailing list