RFR: 8324679: Replace NULL with nullptr in HotSpot .ad files

Vladimir Kozlov kvn at openjdk.org
Wed Jan 31 19:03:08 UTC 2024


On Wed, 31 Jan 2024 16:57:46 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> This is a straightforward mechanical (sed) replacement of NULL with nullptr.  One string was adjusted to not say nullptr ptr.  nullptr makes sense in the comments so I didn't change them.
> 
> Tested with tier1 Oracle platforms and build test with linux-x64-zero,linux-x64-zero-debug,linux-s390x-open,linux-arm32-debug,linux-ppc64le-debug,linux-riscv64-debug

1. All .ad files have next comment:

// NULL Pointer Immediate

`nullptr Pointer` change does not look good. May be keep `NULL` or use `Null`.

2. Some formats text were changed to `null ptr`. I suggest to use `null pointer`.

3. If I remember correctly you should not modify `aarch64.ad` but instead `aarch64_ad.m4`. But I let @theRealAph comment on that. I see changes were pushed directly into `aarch64.ad` without modifying `aarch64_ad.m4`.

src/hotspot/cpu/aarch64/aarch64.ad line 4666:

> 4664: %}
> 4665: 
> 4666: // nullptr Pointer Immediate

Should we keep NULL here?

src/hotspot/cpu/aarch64/aarch64.ad line 4798:

> 4796: %}
> 4797: 
> 4798: // Narrow nullptr Pointer Immediate

And here

src/hotspot/cpu/arm/arm.ad line 1990:

> 1988: %}
> 1989: 
> 1990: // nullptr Pointer Immediate

And here

src/hotspot/cpu/ppc/ppc.ad line 4113:

> 4111: %}
> 4112: 
> 4113: // nullptr Pointer Immediate

And here

src/hotspot/cpu/ppc/ppc.ad line 5957:

> 5955: %}
> 5956: 
> 5957: // Load nullptr as compressed oop.

And here

src/hotspot/cpu/riscv/riscv.ad line 2897:

> 2895: %}
> 2896: 
> 2897: // nullptr Pointer Immediate

here

src/hotspot/cpu/riscv/riscv.ad line 3018:

> 3016: %}
> 3017: 
> 3018: // Narrow nullptr Pointer Immediate

here

src/hotspot/cpu/riscv/riscv.ad line 4896:

> 4894: 
> 4895:   ins_cost(ALU_COST);
> 4896:   format %{ "mv  $dst, $con\t# null ptr, #@loadConP0" %}

May be "null pointer"

src/hotspot/cpu/riscv/riscv.ad line 4947:

> 4945: 
> 4946:   ins_cost(ALU_COST);
> 4947:   format %{ "mv  $dst, $con\t# compressed null ptr, #@loadConN0" %}

"null pointer"

src/hotspot/cpu/s390/s390.ad line 2969:

> 2967: %}
> 2968: 
> 2969: // Narrow nullptr Pointer Immediate

Keep `NULL`

src/hotspot/cpu/s390/s390.ad line 4317:

> 4315:   effect(KILL cr);
> 4316:   size(4);
> 4317:   format %{ "XGR     $dst,$dst\t # null ptr" %}

"null pointer"

src/hotspot/cpu/x86/x86_32.ad line 3399:

> 3397: %}
> 3398: 
> 3399: // nullptr Pointer Immediate

Keep `NULL`.

src/hotspot/cpu/x86/x86_64.ad line 2182:

> 2180: %}
> 2181: 
> 2182: // nullptr Pointer Immediate

here

src/hotspot/cpu/x86/x86_64.ad line 2210:

> 2208: %}
> 2209: 
> 2210: // nullptr Pointer Immediate

here

src/hotspot/cpu/x86/x86_64.ad line 4905:

> 4903:   match(Set dst src);
> 4904:   effect(KILL cr);
> 4905:   format %{ "xorq    $dst, $src\t# compressed null ptr" %}

"null pointer"

src/hotspot/cpu/x86/x86_64.ad line 5172:

> 5170: %}
> 5171: 
> 5172: // Store nullptr Pointer, mark word, or other simple pointer constant.

Keep `NULL`

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

PR Review: https://git.openjdk.org/jdk/pull/17658#pullrequestreview-1854569457
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473305574
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473305925
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473307646
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473308878
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473309341
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473311416
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473311577
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473313154
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473313503
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473314528
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473315184
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473316133
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473316373
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473316623
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473316977
PR Review Comment: https://git.openjdk.org/jdk/pull/17658#discussion_r1473317758


More information about the hotspot-compiler-dev mailing list