RFR: ZGC: C2: Add MaxVectorSize support in C2 load barrier ad rules

Nils Eliasson nils.eliasson at oracle.com
Thu Mar 8 21:19:36 UTC 2018


This patch fixes failures when MaxVectorSize and the size of supported 
vectors doesn't correlate. It can be easily be reproduced with: "java 
-XX:+UseZGC -XX:MaxVectorSize=16" on any CPU with AVX2 support.

"assert((uint)_ideal_reg < (uint)_last_machine_leaf && 
Type::mreg2type[_ideal_reg]) failed: in bounds)"

This bug is a big problem on many AMD systems (family < 0x17h) where 
MaxVectorSize is set default 16 even when larger vectors are supported. 
MaxVectorSize will limit the initialized vector types (TypeVect::VECTZ 
etc.) to those actually available. In the loadbarrier matcher we fail 
when we try to kill YMM but no YMM-type is initialized.

In this patch we instead have rules specialized on the number of vector 
regs that need to be killed, and only kill the lowest sub reg of the 
vector. This has the effect that the entire vector use is killed, but 
that only types that are guaranteed to be supported are available.

This patch was forgotten in a dev branch when we transfered to openJDK. 
It has been tested on the few different CPU familys available to me.




More information about the zgc-dev mailing list