RFR: JDK-8301072: Replace NULL with nullptr in share/oops/ [v2]

Johan Sjölen jsjolen at openjdk.org
Tue Jan 31 14:41:56 UTC 2023


On Tue, 31 Jan 2023 09:53:36 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> > @stefank , we do need to those `oop` casts. The `NativeAccess<>::oop_store` calls makes sense, `oop_store` is templated so we need to provide the type. We also need the casts in `CompressedOops`, and I don't know why that is.
> 
> I took a look at this. And as far as I can see, there's no obvious problem with the oop_store ore CompressedOops changes, but with the NativeAccess<>::oop_load changes.
> 
> NativeAccess<>::oop_load returns an OopLoadProxy object instead of oop, which causes the following code:
> 
> ```
> inline oop OopHandle::resolve() const {
>   return (_obj == nullptr) ? nullptr : NativeAccess<>::oop_load(_obj);
> }
> ```
> 
> To use the raw `nullptr` and create an OopLoadProxy, which then crashes because the passed in value is null.
> 
> We might want to reconsider removing OopLoadProxy, since it isn't the first time it is causing problems for us. I'll think about that in a context of a separate RFE.

Thanks for looking at these. I'm removing the unnecessary casts and keeping the remaining ones.

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

PR: https://git.openjdk.org/jdk/pull/12186


More information about the hotspot-dev mailing list