RFR(M): 8244504: C2: refactor counted loop code in preparation for long counted loop
John Rose
john.r.rose at oracle.com
Wed May 6 20:19:03 UTC 2020
On May 6, 2020, at 1:00 PM, John Rose <john.r.rose at oracle.com> wrote:
>
> On May 6, 2020, at 2:33 AM, Roland Westrelin <rwestrel at redhat.com <mailto:rwestrel at redhat.com>> wrote:
>>
>>
>> https://bugs.openjdk.java.net/browse/JDK-8244504
>> http://cr.openjdk.java.net/~roland/8244504/webrev.00/
>>
>> This is some refactoring in the counted loop code to prepare for 8223051
>> (support loops with long (64b) trip counts). Some of the changes came up
>> in the review of 8223051 (that patch used to be part of 8223051).
>
> Very quick comment: this looks wrong:
>
> + jlong hi = uhi > (julong)max_jint && ulo < (julong)max_jint ? max_jint : MAX2((jlong)uhi, (jlong)ulo);
>
> max_jint should be max_jlong, no? I suppose it’s from an incompletely
> edited copy/paste.
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.
More information about the hotspot-compiler-dev
mailing list