RFR (L) JDK-8230505: Replace JVM type comparisons to T_OBJECT and T_ARRAY with call to is_reference_type

coleen.phillimore at oracle.com coleen.phillimore at oracle.com
Wed Sep 11 20:44:19 UTC 2019

On 9/11/19 4:06 PM, John Rose wrote:
> On Sep 11, 2019, at 11:55 AM, Lois Foltan <lois.foltan at oracle.com 
> <mailto:lois.foltan at oracle.com>> wrote:
>> Thanks Coleen for the review.  I too share your concern about calling 
>> is_reference_type in the default label of the case statement, however 
>> I plan to leave as-is because it does allow for future reference 
>> types like potentially valhalla inline types.
> This function was introduced as an alternative to editing many switch 
> statements when a new type of reference is introduced in Valhalla.  So 
> even though the fix disrupts the clarity of some switches, it’s 
> belongs as part of this change.
> The other uses are also helpful, and would have prevented a number of 
> historical bugs (of the form “I forget T_ARRAY”) if we had adopted the 
> practice from the first.  Maybe that’s another reason to look at the 
> switches as something to change rather than keep.

I think if you add a new T_SOME_REFERENCE_TYPE, you're going to have to 
find and possibly change all these switch statements regardless of this 
change, and this is going to break your flow.

coleen$ grep -r "case T_OBJECT" | wc -l

This only changes 2 of them.   I like this rest of this change enough 
that I won't really argue if you want to leave it, but it's going to 
cause someone to waste some mental energy down the line anyway.

> — John

More information about the hotspot-dev mailing list