RFR: 8324680: Replace NULL with nullptr in JVMTI generated code

Serguei Spitsyn sspitsyn at openjdk.org
Mon Feb 26 22:54:46 UTC 2024


On Thu, 15 Feb 2024 08:46:43 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

> This enhancement replaces uses of NULL with nullptr in the XML-description files for JVMTI. These are the files `hotsport/share/prims/jvmti.xml` and `hotspot/share/prims/jvmti*.xls`.
> 
> The following files are auto-generated from the `jvmti.xml` and `*.xsl files` in the `build/<CFG>/variant-server/gensrc/jvmtifiles': `jvmti.h`, `jvmti.html`, `jvmtiEnter.cpp`, `jvmtiEnterTrace.cpp`, `jvmtiEnv.hpp`
> 
> This addresses a category of NULL uses that wasn't dealt with by:
>  [JDK-8299837](https://bugs.openjdk.org/browse/JDK-8299837).
>  
>  Testing:
>    - TBD: run mach5 tiers1-3

Now, we this section:

Function Return Values

JVM TI functions always return an [error code](http://100.110.26.5:8080/view/loom/job/loom-fibers-branch-build/lastSuccessfulBuild/artifact/loom/build/linux-x64/images/docs/specs/jvmti.html#ErrorSection) via the [jvmtiError](http://100.110.26.5:8080/view/loom/job/loom-fibers-branch-build/lastSuccessfulBuild/artifact/loom/build/linux-x64/images/docs/specs/jvmti.html#jvmtiError) function return value. Some functions can return additional values through pointers provided by the calling function. In some cases, JVM TI functions allocate memory that your program must explicitly deallocate. This is indicated in the individual JVM TI function descriptions. Empty lists, arrays, sequences, etc are returned as `nullptr`.
In the event that the JVM TI function encounters an error (any return value other than `JVMTI_ERROR_NONE`) the values of memory referenced by argument pointers is undefined, but no memory will have been allocated and no global references will have been allocated. If the error occurs because of invalid input, no action will have occurred.

The `nullptr` is mentioned here. As I understand from the Alan's and David's comments above we want to clarify what does it mean for C/C++ code.

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

PR Comment: https://git.openjdk.org/jdk/pull/17866#issuecomment-1965473360


More information about the serviceability-dev mailing list