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

Stefan Karlsson stefank at openjdk.org
Tue Jan 31 09:56:07 UTC 2023


On Fri, 27 Jan 2023 14:26:39 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Do stefank's fixes
>
> Marked as reviewed by stefank (Reviewer).

> @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.

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

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


More information about the hotspot-dev mailing list