RFR: JDK-8301498: Replace NULL with nullptr in cpu/x86
Johan Sjölen
jsjolen at openjdk.org
Fri Feb 10 09:45:57 UTC 2023
On Tue, 31 Jan 2023 11:40:19 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory cpu/x86. Unfortunately the script that does the change isn't perfect, and so we
> need to comb through these manually to make sure nothing has gone wrong. I also review these changes but things slip past my eyes sometimes.
>
> Here are some typical things to look out for:
>
> 1. No changes but copyright header changed (probably because I reverted some changes but forgot the copyright).
> 2. Macros having their NULL changed to nullptr, these are added to the script when I find them. They should be NULL.
> 3. nullptr in comments and logs. We try to use lower case "null" in these cases as it reads better. An exception is made when code expressions are in a comment.
>
> An example of this:
>
> ```c++
> // This function returns null
> void* ret_null();
> // This function returns true if *x == nullptr
> bool is_nullptr(void** x);
>
>
> Note how `nullptr` participates in a code expression here, we really are talking about the specific value `nullptr`.
>
> Thanks!
Some things to fix
Builds and sent out for testing.
src/hotspot/cpu/x86/frame_x86.inline.hpp line 163:
> 161: // value.
> 162: // UPDATE: this constructor is only used by trace_method_handle_stub() now.
> 163: // assert(_pc != null, "no pc?");
nullptr
src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp line 233:
> 231: // Calling the runtime using the regular call_VM_leaf mechanism generates
> 232: // code (generated by InterpreterMacroAssember::call_VM_leaf_base)
> 233: // that checks that the *(ebp+frame::interpreter_frame_last_sp) == null.
nullptr
src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp line 267:
> 265: // Calling the runtime using the regular call_VM_leaf mechanism generates
> 266: // code (generated by InterpreterMacroAssember::call_VM_leaf_base)
> 267: // that checks that the *(ebp+frame::interpreter_frame_last_sp) == null.
nullptr
src/hotspot/cpu/x86/icBuffer_x86.cpp line 60:
> 58: // (1) the value is old (i.e., doesn't matter for scavenges)
> 59: // (2) these ICStubs are removed *before* a GC happens, so the roots disappear
> 60: // assert(cached_value == null || cached_oop->is_perm(), "must be perm oop");
nullptr
src/hotspot/cpu/x86/interp_masm_x86.cpp line 303:
> 301: jcc(Assembler::equal, L);
> 302: stop("InterpreterMacroAssembler::call_VM_base:"
> 303: " last_sp != null");
nullptr
src/hotspot/cpu/x86/interp_masm_x86.cpp line 402:
> 400: movptr(tmp, Address(rthread, JavaThread::jvmti_thread_state_offset()));
> 401: testptr(tmp, tmp);
> 402: jcc(Assembler::zero, L); // if (thread->jvmti_thread_state() == null) exit;
nullptr
src/hotspot/cpu/x86/interp_masm_x86.cpp line 1779:
> 1777: // // main copy of decision tree, rooted at row[1]
> 1778: // if (row[0].rec == rec) { row[0].incr(); goto done; }
> 1779: // if (row[0].rec != null) {
nullptr
src/hotspot/cpu/x86/macroAssembler_x86.cpp line 2866:
> 2864: } else {
> 2865: // nothing to do, (later) access of M[reg + offset]
> 2866: // will provoke OS null exception if reg = null
is not =
src/hotspot/cpu/x86/macroAssembler_x86.cpp line 4265:
> 4263: }
> 4264:
> 4265: // for (scan = klass->itable(); scan->interface() != null; scan += scan_step) {
nullptr
src/hotspot/cpu/x86/stubGenerator_x86_32.cpp line 1553:
> 1551: // one less register, because needed values are on the argument stack.
> 1552: // __ check_klass_subtype_fast_path(sub_klass, *super_klass*, temp,
> 1553: // L_success, L_failure, null);
nullptr
src/hotspot/cpu/x86/stubGenerator_x86_32.cpp line 1924:
> 1922: const Register length = rcx; // transfer count
> 1923:
> 1924: // if (src == null) return -1;
nullptr
src/hotspot/cpu/x86/stubGenerator_x86_32.cpp line 1934:
> 1932: __ jccb(Assembler::negative, L_failed_0);
> 1933:
> 1934: // if (dst == null) return -1;
nullptr
src/hotspot/cpu/x86/stubGenerator_x86_32.cpp line 1956:
> 1954:
> 1955: #ifdef ASSERT
> 1956: // assert(src->klass() != null);
nullptr
src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp line 2298:
> 2296: //
> 2297:
> 2298: // if (src == null) return -1;
nullptr
src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp line 2307:
> 2305: __ jccb(Assembler::negative, L_failed_0);
> 2306:
> 2307: // if (dst == null) return -1;
nullptr
src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp line 2335:
> 2333: __ load_klass(r10_src_klass, src, rklass_tmp);
> 2334: #ifdef ASSERT
> 2335: // assert(src->klass() != null);
nullptr
-------------
PR: https://git.openjdk.org/jdk/pull/12326
More information about the shenandoah-dev
mailing list