RFR: 8322694: C1: Handle Constant and IfOp in NullCheckEliminator [v2]

Denghui Dong ddong at openjdk.org
Wed Jan 3 13:41:40 UTC 2024


On Wed, 3 Jan 2024 12:12:24 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Denghui Dong has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   update
>
> src/hotspot/share/c1/c1_Optimizer.cpp line 1206:
> 
>> 1204: void NullCheckEliminator::handle_Constant(Constant *x) {
>> 1205:   ObjectType* ot = x->type()->as_ObjectType();
>> 1206:   if (ot && ot->is_loaded()) {
> 
> Hotspot style guide insists we avoid implicit bool conversions. Check `ot != nullptr` explicitly.

fixed.

> src/hotspot/share/c1/c1_Optimizer.cpp line 1208:
> 
>> 1206:   if (ot && ot->is_loaded()) {
>> 1207:     ObjectConstant* oc = ot->as_ObjectConstant();
>> 1208:     if (!oc || !oc->value()->is_null_object()) {
> 
> Ditto, check `oc == nullptr`.
> 
> Now, the fact that `as_ObjectConstant` returns `nullptr` means this is not an _object constant_, but some other constant, right? I think this is similar to what other places in C1 do, so while awkward, this looks okay.

fixed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17191#discussion_r1440462233
PR Review Comment: https://git.openjdk.org/jdk/pull/17191#discussion_r1440462604


More information about the hotspot-compiler-dev mailing list