RFR: JDK-8300245: Replace NULL with nullptr in share/jfr/
Johan Sjölen
jsjolen at openjdk.org
Thu Jan 19 21:12:17 UTC 2023
On Tue, 17 Jan 2023 11:26:12 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> Do the conversion in the share/jfr/ sub-directory and all of its files.
More manual fixes!
Fixed the review comments I found, opening this for review.
src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp line 1157:
> 1155: const int orig_stream_length = orig_stream->length();
> 1156: // allocate an identically sized buffer
> 1157: u1* const new_buffer = NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_nullptr(THREAD, u1, orig_stream_length);
fix
src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp line 1319:
> 1317: // to be used in building up a modified class [B.
> 1318: const jint new_buffer_size = extra_stream_bytes + orig_stream_size;
> 1319: u1* const new_buffer = NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_nullptr(THREAD, u1, new_buffer_size);
fix
src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp line 1558:
> 1556: const jint stream_len = new_stream->length();
> 1557: JvmtiCachedClassFileData* p =
> 1558: (JvmtiCachedClassFileData*)NEW_C_HEAP_ARRAY_RETURN_nullptr(u1, offset_of(JvmtiCachedClassFileData, data) + stream_len, mtInternal);
fix
src/hotspot/share/jfr/instrumentation/jfrJvmtiAgent.cpp line 102:
> 100: DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(THREAD));
> 101: ThreadInVMfromNative tvmfn(THREAD);
> 102: jclass* const classes = NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_nullptr(THREAD, jclass, classes_count);
fix
src/hotspot/share/jfr/jni/jfrJniMethod.cpp line 97:
> 95: jio_snprintf(pid_buf, sizeof(pid_buf), "%d", os::current_process_id());
> 96: jstring pid_string = env->NewStringUTF(pid_buf);
> 97: return pid_string; // exception pending if nullptr
fix
src/hotspot/share/jfr/jni/jfrUpcalls.cpp line 144:
> 142: assert(new_byte_array != nullptr, "invariant");
> 143: assert(new_bytes_length > 0, "invariant");
> 144: unsigned char* const new_bytes = NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_nullptr(THREAD, unsigned char, new_bytes_length);
fix
src/hotspot/share/jfr/jni/jfrUpcalls.cpp line 182:
> 180: assert(new_byte_array != nullptr, "invariant");
> 181: assert(new_bytes_length > 0, "invariant");
> 182: unsigned char* const new_bytes = NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_nullptr(THREAD, unsigned char, new_bytes_length);
fix
src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp line 156:
> 154: // might represent a primitive
> 155: const Klass* const ak = java_lang_Class::array_klass_acquire(_object);
> 156: // If ak is nullptr, this is most likely a mirror associated with a
fix
src/hotspot/share/jfr/periodic/jfrOSInterface.cpp line 191:
> 189:
> 190: int JfrOSInterface::JfrOSInterfaceImpl::system_processes(SystemProcess** system_processes, int* no_of_sys_processes) {
> 191: assert(system_processes != nullptr, "system_processes pointer is nullptr!");
fix
src/hotspot/share/jfr/periodic/jfrOSInterface.cpp line 205:
> 203: // caller need to ensure proper ResourceMark placement.
> 204: int JfrOSInterface::JfrOSInterfaceImpl::os_version(char** os_version) const {
> 205: assert(os_version != nullptr, "os_version pointer is nullptr!");
fix
src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp line 588:
> 586: ThreadsListHandle tlh;
> 587: // Resolve a sample session relative start position index into the thread list array.
> 588: // In cases where the last sampled thread is nullptr or not-nullptr but stale, find_index() returns -1.
fix
src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp line 97:
> 95:
> 96: bool JfrRepository::set_path(const char* path) {
> 97: assert(path != nullptr, "trying to set the repository path with a nullptr string!");
fix
src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp line 147:
> 145: const char* const canonical_chunk_path = JfrJavaSupport::c_str(path, jt);
> 146: if (nullptr == canonical_chunk_path && !_chunkwriter->is_valid()) {
> 147: // new output is nullptr and current output is nullptr
fix
src/hotspot/share/jfr/recorder/service/jfrMemorySizer.cpp line 364:
> 362: // Unordered selection:
> 363: //
> 364: // C(4, 0) = {} = nullptr set = 1
fix
src/hotspot/share/jfr/utilities/jfrAllocation.cpp line 127:
> 125:
> 126: char* JfrCHeapObj::realloc_array(char* old, size_t size) {
> 127: char* const memory = ReallocateHeap(old, size, mtTracing, AllocFailStrategy::RETURN_nullptr);
fix
src/hotspot/share/jfr/utilities/jfrAllocation.cpp line 138:
> 136:
> 137: char* JfrCHeapObj::allocate_array_noinline(size_t elements, size_t element_size) {
> 138: return AllocateHeap(elements * element_size, mtTracing, CALLER_PC, AllocFailStrategy::RETURN_nullptr);
fix
src/hotspot/share/jfr/utilities/jfrAllocation.hpp line 41:
> 39: * tear down the VM she is about to inspect as a side effect.
> 40: *
> 41: * This allocator uses the RETURN_nullptr capabilities
fix
src/hotspot/share/jfr/writers/jfrEncoding.hpp line 33:
> 31:
> 32: enum JfrStringEncoding {
> 33: nullptr_STRING = 0,
fix
src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp line 95:
> 93: void WriterHost<BE, IE, WriterPolicyImpl>::write_utf8(const char* value) {
> 94: if (nullptr == value) {
> 95: // only write encoding byte indicating nullptr string
fix
-------------
PR: https://git.openjdk.org/jdk/pull/12034
More information about the hotspot-jfr-dev
mailing list