RFR: 8319889: Vector API tests trigger VM crashes with -XX:+StressIncrementalInlining [v2]
Sandhya Viswanathan
sviswanathan at openjdk.org
Mon Mar 18 21:26:20 UTC 2024
On Sat, 16 Mar 2024 22:19:10 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 c...
>
> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>
> Restricting the patch to only bi-morphic inlining crash fix.
Looks good to me.
-------------
Marked as reviewed by sviswanathan (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18282#pullrequestreview-1944229136
More information about the hotspot-compiler-dev
mailing list