RFR: 8326716: JVMTI spec: clarify what nullptr means for C/C++ developers [v4]
David Holmes
dholmes at openjdk.org
Mon Jun 3 08:04:18 UTC 2024
On Fri, 31 May 2024 08:07:36 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> The following RFE was fixed recently:
>> [8324680](https://bugs.openjdk.org/browse/JDK-8324680): Replace NULL with nullptr in JVMTI generated code
>>
>> It replaced all the `NULL`'s in the generated spec with`nullptr`. JVMTI agents can be developed in C or C++.
>> This update is to make it clear that `nullptr` is C programming language `null` pointer.
>>
>> I think we do not need a CSR for this fix.
>>
>> Testing: N/A (not needed)
>
> Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:
>
> review: more null pointer corrections
The general rules are to either say "a null pointer" (possibly with capital A depending on context), or just "null". And in most cases you could choose either. I made various suggestions but really it is up to you. It is hard to get a sense of consistency from these small fragments.
The word "null" should never be in code font as it is not a programming language entity.
Thanks for your patience and perseverance on this.
src/hotspot/share/prims/jvmti.xml line 1101:
> 1099: <description>
> 1100: On return, a pointer to the beginning of the allocated memory.
> 1101: If <code>size</code> is zero, null pointer is returned.
If saying "null pointer" then it should be "a null pointer".
src/hotspot/share/prims/jvmti.xml line 1533:
> 1531: <outptr><jthread/></outptr>
> 1532: <description>
> 1533: On return, points to the current thread, or <code>null</code>.
remove code font
src/hotspot/share/prims/jvmti.xml line 1996:
> 1994: <description>
> 1995: The thread group to which this thread belongs.
> 1996: null pointer if the thread has terminated.
Just "Null if ..."
src/hotspot/share/prims/jvmti.xml line 2142:
> 2140: <description>
> 2141: On return, filled with the current contended monitor, or
> 2142: null pointer if there is none.
Just "null"
src/hotspot/share/prims/jvmti.xml line 2262:
> 2260: <inbuf>
> 2261: <void/>
> 2262: <nullok>null pointer is passed to the start function</nullok>
A null ...
src/hotspot/share/prims/jvmti.xml line 2353:
> 2351: If thread-local storage has not been set with
> 2352: <functionlink id="SetThreadLocalStorage"></functionlink> the returned
> 2353: pointer is <code>null</code>.
Remove code font
src/hotspot/share/prims/jvmti.xml line 4277:
> 4275: <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>,
> 4276: or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>.
> 4277: Otherwise null pointer.
a null ...
src/hotspot/share/prims/jvmti.xml line 4322:
> 4320: points to the zero if the referrer
> 4321: object is not tagged.
> 4322: null pointer if the referrer in not an object (that is,
Null if ...
src/hotspot/share/prims/jvmti.xml line 4769:
> 4767: <inbuf>
> 4768: <void/>
> 4769: <nullok>null pointer is passed as the user supplied data</nullok>
a null pointer
src/hotspot/share/prims/jvmti.xml line 4945:
> 4943: <inbuf>
> 4944: <void/>
> 4945: <nullok>null pointer is passed as the user supplied data</nullok>
a null pointer
src/hotspot/share/prims/jvmti.xml line 5593:
> 5591: <inbuf>
> 5592: <void/>
> 5593: <nullok>null pointer is passed as the user supplied data</nullok>
a null pointer
src/hotspot/share/prims/jvmti.xml line 5637:
> 5635: callback will not be called until the appropriate callback has been called
> 5636: for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is
> 5637: specified as null pointer then this function returns after
Just "as null then"
src/hotspot/share/prims/jvmti.xml line 5692:
> 5690: <void/>
> 5691: <nullok>>null pointer is passed as the user supplied data</nullok>
> 5692: </inbuf>
a null pointer
src/hotspot/share/prims/jvmti.xml line 5750:
> 5748: <inbuf>
> 5749: <void/>
> 5750: <nullok>null pointer is passed as the user supplied data</nullok>
a null pointer
src/hotspot/share/prims/jvmti.xml line 6770:
> 6768: If a named module is defined to the class loader and it
> 6769: contains the package then that named module is returned,
> 6770: otherwise null pointer is returned.
Just "null"
src/hotspot/share/prims/jvmti.xml line 6803:
> 6801: <description>
> 6802: On return, points to a <code>java.lang.Module</code> object
> 6803: or points to <code>null</code>.
Remove code font
src/hotspot/share/prims/jvmti.xml line 7264:
> 7262: <internallink id="mUTF">modified UTF-8</internallink> string.
> 7263: If there is no generic signature attribute for the class, then,
> 7264: on return, points to <code>null</code>.
Remove code font
src/hotspot/share/prims/jvmti.xml line 7794:
> 7792: If the class was not created by a class loader
> 7793: or if the class loader is the bootstrap class loader,
> 7794: points to <code>null</code>.
Remove code font
src/hotspot/share/prims/jvmti.xml line 8414:
> 8412: <internallink id="mUTF">modified UTF-8</internallink> string.
> 8413: If there is no generic signature attribute for the field, then,
> 8414: on return, points to <code>null</code>.
Remove code font
src/hotspot/share/prims/jvmti.xml line 8607:
> 8605: <internallink id="mUTF">modified UTF-8</internallink> string.
> 8606: If there is no generic signature attribute for the method, then,
> 8607: on return, points to <code>null</code>.
Remove code font
src/hotspot/share/prims/jvmti.xml line 9243:
> 9241: <paramlink id="prefix_count"/> of <code>1</code>.
> 9242: Calling <code>SetNativeMethodPrefix</code> with
> 9243: null pointer is the same as calling this function with
a null pointer
src/hotspot/share/prims/jvmti.xml line 11657:
> 11655: <inbuf>
> 11656: <void/>
> 11657: <nullok>value is set to <code>null</code></nullok>
Remove code font
src/hotspot/share/prims/jvmti.xml line 11951:
> 11949: </errorid>
> 11950: <errorid id="JVMTI_ERROR_NULL_POINTER" num="100">
> 11951: Pointer is unexpectedly <code>null</code>.
Remove code font.
src/hotspot/share/prims/jvmti.xml line 12458:
> 12456: <description>
> 12457: Object with the field being accessed if the field is an
> 12458: instance field; null pointer otherwise
a null pointer
src/hotspot/share/prims/jvmti.xml line 12528:
> 12526: <description>
> 12527: Object with the field being modified if the field is an
> 12528: instance field; null pointer otherwise
a null pointer
src/hotspot/share/prims/jvmti.xml line 12879:
> 12877: <jclass method="catch_method"/>
> 12878: <description>
> 12879: Class that will catch the exception, or null pointer if no known catch
Just "null"
src/hotspot/share/prims/jvmti.xml line 12885:
> 12883: <jmethodID class="catch_klass"/>
> 12884: <description>
> 12885: Method that will catch the exception, or null pointer if no known catch
Just "null"
src/hotspot/share/prims/jvmti.xml line 13397:
> 13395: <functionlink id="RedefineClasses">redefined</functionlink> or
> 13396: <functionlink id="RetransformClasses">retransformed</functionlink>.
> 13397: null pointer if sent by class load.
A null pointer
src/hotspot/share/prims/jvmti.xml line 13404:
> 13402: <description>
> 13403: The class loader loading the class.
> 13404: null pointer if the bootstrap class loader.
A null pointer
src/hotspot/share/prims/jvmti.xml line 13414:
> 13412: <internallink id="mUTF">modified UTF-8</internallink> string.
> 13413: Note: if the class is defined with a null pointer name or
> 13414: without a name specified, <code>name</code> will be null.
How do you not specify a name other than by passing "null" for the name??
src/hotspot/share/prims/jvmti.xml line 13632:
> 13630: <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>
> 13631: to <code>start_address-1</code> of the next entry.
> 13632: null pointer if mapping information cannot be supplied.
A null pointer
src/hotspot/share/prims/jvmti.xml line 14695:
> 14693: </change>
> 14694: <change date="22 Jan 2003">
> 14695: Allow null pointer as RunAgentThread arg.
Just "null"
src/hotspot/share/prims/jvmti.xml line 14705:
> 14703: </change>
> 14704: <change date="31 Jan 2003">
> 14705: Change GetFieldName to allow null pointer like GetMethodName.
Just null
src/hotspot/share/prims/jvmti.xml line 14814:
> 14812: Clarify semantics of raw monitors.
> 14813: Change flags on <code>GetThreadStatus</code>.
> 14814: <code>GetClassLoader</code> return null pointer for the bootstrap class loader.
a null pointer
src/hotspot/share/prims/jvmti.xml line 14824:
> 14822: <change date="14 May 2003" version="v63">
> 14823: Define the data type <code>jvmtiEventCallbacks</code>.
> 14824: Zero length allocations return null pointer.
a null pointer
src/hotspot/share/prims/jvmti.xml line 14846:
> 14844: remove GetHeapRoots, add reachable iterators,
> 14845: and rename "annotation" to "tag".
> 14846: null pointer thread parameter on most functions is current
A null pointer
src/hotspot/share/prims/jvmti.xsl line 1589:
> 1587: <xsl:apply-templates select="." mode="paramlink"/>
> 1588: <xsl:text> is </xsl:text>
> 1589: <code>null</code> pointer
Remove code font
src/hotspot/share/prims/jvmtiEnv.xsl line 139:
> 137: <xsl:param name="name"/>
> 138: <xsl:text>
> 139: // method - pre-checked for validity, but may be null pointer meaning obsolete method</xsl:text>
Just "null"
src/hotspot/share/prims/jvmtiEnv.xsl line 169:
> 167: // </xsl:text>
> 168: <xsl:value-of select="$name"/>
> 169: <xsl:text> - pre-checked for null pointer</xsl:text>
Just null
src/hotspot/share/prims/jvmtiEnv.xsl line 175:
> 173: // </xsl:text>
> 174: <xsl:value-of select="$name"/>
> 175: <xsl:text> - null pointer is a valid value, must be checked</xsl:text>
Just null
src/hotspot/share/prims/jvmtiLib.xsl line 180:
> 178: </code>
> 179: is
> 180: <code>null</code> pointer, <xsl:apply-templates/>.
Just null (no code font)
src/hotspot/share/prims/jvmtiLib.xsl line 381:
> 379: </code>
> 380: is
> 381: <code>null</code> pointer, the current thread is used.
Just null (no code font)
-------------
Changes requested by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/19257#pullrequestreview-2093011060
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623916928
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623917438
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623918169
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623920264
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623920788
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623921174
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623922170
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623923033
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623923386
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623923954
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623924658
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623925443
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623925864
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623926064
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623926453
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623926975
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623927420
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623927827
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623928337
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623928549
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623928967
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623930079
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623930308
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623931169
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623931569
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623932080
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623932303
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623932917
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623933143
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623934935
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623935320
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623935750
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623936049
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623936478
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623936755
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623937128
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623938553
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623938932
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623939238
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623939410
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623940127
PR Review Comment: https://git.openjdk.org/jdk/pull/19257#discussion_r1623941054
More information about the hotspot-dev
mailing list