RFR: 8312125: Refactor CDS enum class handling [v2]

Ioi Lam iklam at openjdk.org
Wed Jul 3 19:57:52 UTC 2024


On Wed, 3 Jul 2024 17:42:07 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fixed copyright
>
> src/hotspot/share/cds/cdsEnumKlass.cpp line 2:
> 
>> 1: /*
>> 2:  * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> 
> Please update the copyrights on the new files.

I changed the dates to `2023, 2024` as these files were initially published in the leyden repo last year.

> src/hotspot/share/cds/cdsEnumKlass.cpp line 68:
> 
>> 66:                                    oop orig_obj) {
>> 67:   assert(level > 1, "must never be called at the first (outermost) level");
>> 68:   assert(is_enum_obj(orig_obj), "must be");
> 
> Is this assert redundant? You check for this before you make the call to `handle_enum_obj()` below. I think you can move the if statement in here.

The assert declares the fact that the caller must check that orig_obj is an enum before calling this function. This guards against inadvertent changes that might accidentally drop the "if" check in the caller.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20013#discussion_r1664690497
PR Review Comment: https://git.openjdk.org/jdk/pull/20013#discussion_r1664687592


More information about the hotspot-dev mailing list