On Tue, 5 Nov 2024 16:02:07 GMT, Kim Barrett <[email protected]> wrote:
> Can you use the (updated) regex in the JBS issue description to verify the
> only remaining "NULL"s in src/hotspot are the jvmti.{xml,xls} files and the
> globalDefinitions_{gcc,visCPP}.hpp files?
>
> There are also some NULLs recently introduced in test/hotspot:
> ./jtreg/serviceability/jvmti/GetMethodDeclaringClass/libTestUnloadedClass.cpp
> ./jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp
>
> (Found by applying the same regex to test/hotspot, and then removing .java
> and .c files.)
>
> There are a few other files in test/hotspot containing NULLs:
> ./jtreg/vmTestbase/nsk/share/jni/README
> ./jtreg/vmTestbase/nsk/share/jvmti/README These are documentation files with
> examples written in C, so should not be changed.
>
> ./jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp In a comment describing a
> string to be used for printing. Uses would need to be examined to ensure it's
> okay to change the string used for a null value. I think I planned to do this
> as a followup to JDK-8324799, and then forgot. I'd be okay with doing
> something about this being separate from the current PR. While the necessary
> textual changes are probably small, there's a lot of uses to examine to be
> sure a change is okay.
@kimbarrett I fixed the backslides in the *.cpp files you mentioned. The egrep
outputs are now:
% find test/hotspot -type f ! -name "*.c" ! -name "*.java" -exec egrep -H
"[^[:alnum:]_]NULL([^[:alnum:]_]|$)" {} ;
test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp: * Returns str or
"<NULL>" if str is null; useful for printing strings.
test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README: if
(!NSK_JVMTI_VERIFY(jvmti->GetVersion(&version) != NULL)) {
test/hotspot/jtreg/vmTestbase/nsk/share/jni/README:
jni->FindClass(class_name) != NULL)) {
test/hotspot/jtreg/vmTestbase/nsk/share/jni/README:
jni->FindClass(class_name)) != NULL)) {
and
egrep -R "[^[:alnum:]_]NULL([^[:alnum:]_]|$)" src/hotspot
src/hotspot/share/prims/jvmti.xml: or return value. A "null pointer" is C
<code>NULL</code> or C++ <code>nullptr</code>.
src/hotspot/share/prims/jvmti.xml: &methodName, NULL,
NULL);
src/hotspot/share/prims/jvmti.xml: GetThreadCpuTime(env, NULL, nanos_ptr)
src/hotspot/share/prims/jvmti.xsl: <xsl:value-of select="@const"/>,
NULL)</code>
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:// When __cplusplus is
defined, NULL is defined as 0 (32-bit constant) in
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:// On 64-bit
architectures, defining NULL as a 32-bit constant can cause
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:// varargs, we pass
the argument 0 as an int. So, if NULL was passed to a
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:// only 32-bits of the
"NULL" pointer may be initialized to zero. The
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:// Solution: For
64-bit architectures, redefine NULL as 64-bit constant 0.
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:#undef NULL
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:#define NULL 0LL
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:#ifndef NULL
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:#define NULL 0
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:// NULL vs NULL_WORD:
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:// On Linux NULL is
defined as a special type '__null'. Assigning __null to
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp:#define NULL_WORD NULL
src/hotspot/share/utilities/globalDefinitions_gcc.hpp:// NULL vs NULL_WORD:
src/hotspot/share/utilities/globalDefinitions_gcc.hpp:// On Linux NULL is
defined as a special type '__null'. Assigning __null to
src/hotspot/share/utilities/globalDefinitions_gcc.hpp: #define NULL_WORD NULL
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21826#issuecomment-2461610347