RFR: JDK-8300651: Replace NULL with nullptr in share/runtime/

David Holmes dholmes at openjdk.org
Mon Jan 23 01:25:09 UTC 2023


On Thu, 19 Jan 2023 12:27:23 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> Do the conversion in the share/runtime/ sub-directory and all of its files.

Looks good but a few cases where nullptr should be null in comments for consistency with surrounding changes if nothing else.

Thanks.

src/hotspot/share/runtime/handshake.cpp line 706:

> 704: 
> 705: bool HandshakeState::suspend_with_handshake() {
> 706:   assert(_handshakee->threadObj() != nullptr, "cannot suspend with a nullptr threadObj");

Use "null" in the message please.

src/hotspot/share/runtime/java.cpp line 672:

> 670:   // first and here. Any future calls to EXCEPTION_MARK requires
> 671:   // that no pending exceptions exist.
> 672:   JavaThread* THREAD = JavaThread::current(); // can't be nullptr

Change to null please

src/hotspot/share/runtime/javaCalls.cpp line 98:

> 96:   _thread->set_active_handles(new_handles);     // install new handle block and reset Java frame linkage
> 97: 
> 98:   assert (_thread->thread_state() != _thread_in_native, "cannot set native pc to null");

FYI this assertion message seems wrong and in fact the assertion is redundant so I'm removing it in https://github.com/openjdk/jdk/pull/12134.

src/hotspot/share/runtime/mutexLocker.cpp line 175:

> 173: void assert_locked_or_safepoint(const Mutex* lock) {
> 174:   // check if this thread owns the lock (common case)
> 175:   assert(lock != nullptr, "Need non-nullptr lock");

null for consistency

src/hotspot/share/runtime/os.hpp line 300:

> 298:   // Fill in buffer with current local time as an ISO-8601 string.
> 299:   // E.g., YYYY-MM-DDThh:mm:ss.mmm+zzzz.
> 300:   // Returns buffer, or nullptr if it failed.

Should be "null" to be consistent with L294

src/hotspot/share/runtime/sharedRuntime.cpp line 2141:

> 2139:   // at the end of it. If we happen to see that null then we can skip trying
> 2140:   // to patch. If we hit the window where the callee has a c2i in the
> 2141:   // from_compiled_entry and the nullptr isn't present yet then we lose the race

null for consistency

src/hotspot/share/runtime/threadSMR.hpp line 350:

> 348: public:
> 349:   JavaThreadIterator(ThreadsList *list) : _list(list), _index(0) {
> 350:     assert(list != nullptr, "ThreadsList must not be nullptr.");

null

src/hotspot/share/runtime/vmStructs.hpp line 115:

> 113: 
> 114:   // The last entry is identified over in the serviceability agent by
> 115:   // the fact that it has a nullptr typeName

null for consistency

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

Changes requested by dholmes (Reviewer).

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


More information about the hotspot-dev mailing list