RFR(M): 8244504: C2: refactor counted loop code in preparation for long counted loop

Roland Westrelin rwestrel at redhat.com
Wed May 13 14:48:44 UTC 2020


>> Looking a little more at the interval arithmetic subroutines,
>> I think it would be reasonable to leave out most of the linkage to
>> TypeInt/TypeLong, and isolate the logic that does the min-ing
>> and max-ing, with separate routines for translating to and from
>> the Type* world.
>>
>> Maybe:
>>
>> struct MinMaxInterval {
>>   julong shi, slo, uhi, ulo;
>>   boolean is_int;
>>   void signedMaxWith(const Interval& that);
>>   void unsignedMaxWith(const Interval& that);
>>   void signedMinWith(const Interval& that);
>>   void unsignedMinWith(const Interval& that);
>>   MinMaxInterval(TypeInt*);
>>   MinMaxInterval(TypeLong*);
>>   const TypeInt* asTypeInt();
>>   const TypeInt* asTypeLong();
>> };
>>
>> It would be overkill in many cases to put such small routines
>> into their own class, but in this case the min/max interval logic
>> is very subtle and deserves a little display platform.

After spending some time trying to get this to work, I have to admit my
initial logic was very much wrong and it's a lot less straightforward to
get this to work in a way that I'm confident about than I thought.

> Another way to deal with that, would be to pass the expected result type
> as argument to unsigned_min() rather than compute it.

So I went that way and passes the type as an argument to the min/max
methods in case the caller knows something about the result:

http://cr.openjdk.java.net/~roland/8244504/webrev.01/

Roland.



More information about the hotspot-compiler-dev mailing list