RFR: 8280003: C1: Reconsider uses of logical_and immediates in LIRGenerator::do_getObjectSize [v3]

Sergey Nazarkin snazarki at openjdk.java.net
Wed Jan 19 16:47:58 UTC 2022


On Wed, 19 Jan 2022 11:54:49 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp line 291:
>> 
>>> 289:   assert(type == T_LONG || type == T_INT, "should be");
>>> 290:   LIR_Opr r = make_constant(type, x);
>>> 291:   bool imm_in_range = (x >= 0) && (x <= UINT_MAX) &&
>> 
>> The check is too strict, what about x >= INT_MIN && x <= INT_MAX?
>
> How is it strict? We are about to cast to _unsigned int_, surely we want to test that the value is in range of unsigned int?

The method is correct but a bit unoptimal. I may be wrong, but _x_ is signed variable and may contain negative value that fits _logic_and_ (like ~0xFF00)

-------------

PR: https://git.openjdk.java.net/jdk/pull/7080


More information about the hotspot-compiler-dev mailing list