RFR: 8324242: Avoid null check for OopHandle::ptr_raw()

Kim Barrett kbarrett at openjdk.org
Tue Jan 23 11:24:26 UTC 2024


On Mon, 22 Jan 2024 10:45:35 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Looks reasonable.
> 
> I guess the use in `ClassLoaderData::remove_handle` is fine, because we want to assert it?

I forgot about this one.  I initially skipped it because I didn't understand what was happening here.  I'd forgotten that
the CLD uses OopHandle to wrap a pointer to the CLD handle area rather than an OopStorage entry. I'll push a fix
after I've run tests.

> Related, pre-existing: the use in `ClassLoaderData::print_on` is also odd. This reports the address of oophandle slot, not the classloader oop itself? Should probably be `.peek()`?
> 
> ```
>   out->print_cr(" - class loader        " INTPTR_FORMAT, p2i(_class_loader.ptr_raw()));
> ```

I think you are probably correct, but felt that was a little out of scope for
what I was doing in this PR.

It looks like it was changed from printing the (void* cast) loader oop to
printing the (newly introduced) handle address by 8201556: "Disallow reading
oops in ClassLoaderData if unloading". I don't know whether that was
intentional, but guessing not.

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

PR Comment: https://git.openjdk.org/jdk/pull/17510#issuecomment-1905834809


More information about the hotspot-dev mailing list