RFR: JDK-8300244: Replace NULL with nullptr in share/interpreter/

Johan Sjölen jsjolen at openjdk.org
Thu Jan 19 15:38:27 UTC 2023


On Tue, 17 Jan 2023 11:24:00 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

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

Opening this up with these review comments unfixed.

src/hotspot/share/interpreter/bytecodeTracer.cpp line 205:

> 203: void print_oop(oop value, outputStream* st) {
> 204:   if (value == nullptr) {
> 205:     st->print_cr(" nullptr");

Fix

src/hotspot/share/interpreter/bytecodes.cpp line 274:

> 272:   //  Java bytecodes
> 273:   //  bytecode               bytecode name           format   wide f.   result tp  stk traps
> 274:   def(_nop                 , "nop"                 , "b"    , NULL    , T_VOID   ,  0, false);

All of these needs their alignment fixed.

src/hotspot/share/interpreter/bytecodes.hpp line 368:

> 366:   // bytecode.  The CI uses these methods but guarantees that
> 367:   // breakpoints are hidden so the method argument should be passed as
> 368:   // nullptr since in that case the bcp and Method* are unrelated

fix

src/hotspot/share/interpreter/interpreterRuntime.cpp line 507:

> 505: 
> 506:     // assertions
> 507:     assert(h_exception.not_null(), "nullptr exceptions should be handled by athrow");

Fix

src/hotspot/share/interpreter/interpreterRuntime.cpp line 743:

> 741:   Handle h_obj(current, elem->obj());
> 742:   assert(Universe::heap()->is_in_or_null(h_obj()),
> 743:          "must be nullptr or an object");

Fix

src/hotspot/share/interpreter/linkResolver.cpp line 840:

> 838:     char buf[200];
> 839:     jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", resolved_klass->external_name());
> 840:     THROW_MSG_nullptr(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);

Fix THROW_MSG_nullptr

src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp line 3083:

> 3081:     // in unpredictable places. Instead we must protect the places where we enter the
> 3082:     // VM. It would be much simpler (and safer) if we could allocate a real handle with
> 3083:     // a nullptr oop in it and then overwrite the oop later as needed. This isn't

Fix

src/hotspot/share/interpreter/zero/bytecodeInterpreter.inline.hpp line 38:

> 36: #define VERIFY_OOP(o_) \
> 37:       if (VerifyOops) { \
> 38:         assert(oopDesc::is_oop_or_null(oop(o_)), "Expected an oop or nullptr at " PTR_FORMAT, p2i(oop(o_))); \

Fix

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

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


More information about the hotspot-runtime-dev mailing list