On Fri, 22 Aug 2025 18:28:19 GMT, Ioi Lam <ik...@openjdk.org> wrote:

>> src/hotspot/share/cds/aotOopChecker.cpp line 52:
>> 
>>> 50: // Make sure we are not caching objects with assumptions that can be 
>>> violated in
>>> 51: // the production run.
>>> 52: void AOTOopChecker::check(oop obj) {
>> 
>> Should this also return a `bool` to indicate if the oop failed the check?  
>> It would make it easier to bail out in the caller if the oop was bad.
>
> The bail out and error logging needs to be done inside this function (as 
> there might be more than one reason why `obj` is unsafe). 
> 
> This is an unrecoverable error -- the caller has already found a bad oop. We 
> cannot just throw away this oop because there are other states that point to 
> this oop.

The existing error handling - to log and bail out - are 100% right.  We're not 
throwing an exception so the caller still needs to unwind itself as well and a 
`return false;` after the `MetaspaceShared::unrecoverable_writing_error();` 
makes it more obvious how the caller should handle it - it too should bail as 
early as it can

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26375#discussion_r2294404235

Reply via email to