From 2f29d5b59034a04bcd1d1f7c53fabe35e438e9f7 Mon Sep 17 00:00:00 2001 From: Gengchen Tuo Date: Fri, 6 Dec 2024 17:10:20 -0500 Subject: [PATCH] Make JFR compile on z/OS - ->system seems to be replaced by the compiler - = {0} initialization isn't supported by the compiler Signed-off-by: Gengchen Tuo --- runtime/oti/j9nonbuilder.h | 4 ++-- runtime/vm/JFRChunkWriter.hpp | 4 ++-- runtime/vm/JFRConstantPoolTypes.cpp | 4 ++-- runtime/vm/JFRConstantPoolTypes.hpp | 24 ++++++++++++------------ runtime/vm/jfr.cpp | 8 ++++---- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/runtime/oti/j9nonbuilder.h b/runtime/oti/j9nonbuilder.h index 3079b239755..e40e01f8912 100644 --- a/runtime/oti/j9nonbuilder.h +++ b/runtime/oti/j9nonbuilder.h @@ -430,8 +430,8 @@ typedef struct J9JFRCPULoad { typedef struct J9JFRThreadCPULoad { J9JFR_EVENT_COMMON_FIELDS - float user; - float system; + float userCPULoad; + float systemCPULoad; } J9JFRThreadCPULoad; typedef struct J9JFRClassLoadingStatistics { diff --git a/runtime/vm/JFRChunkWriter.hpp b/runtime/vm/JFRChunkWriter.hpp index 03f88cc544b..b4cecda6bad 100644 --- a/runtime/vm/JFRChunkWriter.hpp +++ b/runtime/vm/JFRChunkWriter.hpp @@ -595,10 +595,10 @@ class VM_JFRChunkWriter { _bufferWriter->writeLEB128(entry->threadIndex); /* write user thread CPU load */ - _bufferWriter->writeFloat(entry->user); + _bufferWriter->writeFloat(entry->userCPULoad); /* write system thread CPU load */ - _bufferWriter->writeFloat(entry->system); + _bufferWriter->writeFloat(entry->systemCPULoad); /* write size */ _bufferWriter->writeLEB128PaddedU32(dataStart, _bufferWriter->getCursor() - dataStart); diff --git a/runtime/vm/JFRConstantPoolTypes.cpp b/runtime/vm/JFRConstantPoolTypes.cpp index 6d7e9f47d20..af7725a1cae 100644 --- a/runtime/vm/JFRConstantPoolTypes.cpp +++ b/runtime/vm/JFRConstantPoolTypes.cpp @@ -1130,8 +1130,8 @@ VM_JFRConstantPoolTypes::addThreadCPULoadEntry(J9JFRThreadCPULoad *threadCPULoad } entry->ticks = threadCPULoadData->startTicks; - entry->user = threadCPULoadData->user; - entry->system = threadCPULoadData->system; + entry->userCPULoad = threadCPULoadData->userCPULoad; + entry->systemCPULoad = threadCPULoadData->systemCPULoad; entry->threadIndex = addThreadEntry(threadCPULoadData->vmThread); if (isResultNotOKay()) { diff --git a/runtime/vm/JFRConstantPoolTypes.hpp b/runtime/vm/JFRConstantPoolTypes.hpp index 7caed147ab6..48fc801ba1b 100644 --- a/runtime/vm/JFRConstantPoolTypes.hpp +++ b/runtime/vm/JFRConstantPoolTypes.hpp @@ -224,8 +224,8 @@ struct CPULoadEntry { struct ThreadCPULoadEntry { I_64 ticks; U_32 threadIndex; - float user; - float system; + float userCPULoad; + float systemCPULoad; }; struct ClassLoadingStatisticsEntry { @@ -1268,28 +1268,28 @@ class VM_JFRConstantPoolTypes { * zero is NULL threadGroup. */ _stringUTF8Count += 1; - _defaultStringUTF8Entry = {0}; + memset(&_defaultStringUTF8Entry, 0, sizeof(_defaultStringUTF8Entry)); _defaultStringUTF8Entry.string = (J9UTF8*)&nullString; _stringUTF8Count += 1; - _unknownClassStringUTF8Entry = {0}; + memset(&_unknownClassStringUTF8Entry , 0, sizeof(_unknownClassStringUTF8Entry)); _unknownClassStringUTF8Entry.string = (J9UTF8*)&unknownClass; _stringUTF8Count += 1; - _nativeMethodStringUTF8Entry = {0}; + memset(&_nativeMethodStringUTF8Entry, 0, sizeof(_nativeMethodStringUTF8Entry)); _nativeMethodStringUTF8Entry.string = (J9UTF8*)&nativeMethod; _stringUTF8Count += 1; - _nativeMethodSignatureStringUTF8Entry = {0}; + memset(&_nativeMethodSignatureStringUTF8Entry, 0, sizeof(_nativeMethodSignatureStringUTF8Entry)); _nativeMethodSignatureStringUTF8Entry.string = (J9UTF8*)&nativeMethodSignature; _moduleCount += 1; - _defaultModuleEntry = {0}; + memset(&_defaultModuleEntry, 0, sizeof(_defaultModuleEntry)); _firstModuleEntry = &_defaultModuleEntry; _previousModuleEntry = _firstModuleEntry; _packageCount += 1; - _defaultPackageEntry = {0}; + memset(&_defaultPackageEntry, 0, sizeof(_defaultPackageEntry)); _defaultPackageEntry.exported = TRUE; _defaultPackageEntry.packageName = J9UTF8_DATA((J9UTF8*) &defaultPackage); _defaultPackageEntry.packageNameLength = J9UTF8_LENGTH((J9UTF8*) &defaultPackage); @@ -1297,18 +1297,18 @@ class VM_JFRConstantPoolTypes { _previousPackageEntry = _firstPackageEntry; _threadGroupCount += 1; - _defaultThreadGroup = {0}; + memset(&_defaultThreadGroup, 0, sizeof(_defaultThreadGroup)); _firstThreadGroupEntry = &_defaultThreadGroup; _previousThreadGroupEntry = _firstThreadGroupEntry; _classCount += 1; - _defaultClassEntry = {0}; + memset(&_defaultClassEntry, 0, sizeof(_defaultClassEntry)); _defaultClassEntry.nameStringUTF8Index = (U_32)UnknownClass; _firstClassEntry = &_defaultClassEntry; _previousClassEntry = _firstClassEntry; _methodCount += 1; - _defaultMethodEntry = {0}; + memset(&_defaultMethodEntry, 0, sizeof(_defaultMethodEntry)); _defaultMethodEntry.nameStringUTF8Index = (U_32)NativeMethod; _defaultMethodEntry.descriptorStringUTF8Index = (U_32)NativeMethodSignature; /* default class */ @@ -1317,7 +1317,7 @@ class VM_JFRConstantPoolTypes { _previousMethodEntry = _firstMethodEntry; _stackTraceCount += 1; - _defaultStackTraceEntry = {0}; + memset(&_defaultStackTraceEntry, 0, sizeof(_defaultStackTraceEntry)); _firstStackTraceEntry = &_defaultStackTraceEntry; _previousStackTraceEntry = _firstStackTraceEntry; diff --git a/runtime/vm/jfr.cpp b/runtime/vm/jfr.cpp index 90335cd1dd8..b252a5c82a5 100644 --- a/runtime/vm/jfr.cpp +++ b/runtime/vm/jfr.cpp @@ -939,12 +939,12 @@ jfrThreadCPULoad(J9VMThread *currentThread, J9VMThread *sampleThread) int64_t currentTime = j9time_nano_time(); if (-1 == jfrState->prevTimestamp) { - jfrEvent->user = 0; - jfrEvent->system = 0; + jfrEvent->userCPULoad = 0; + jfrEvent->systemCPULoad = 0; } else { int64_t timeDelta = currentTime - jfrState->prevTimestamp; - jfrEvent->user = OMR_MIN((threadTimes.userTime - jfrState->prevThreadCPUTimes.userTime) / (double)timeDelta, 1.0); - jfrEvent->system = OMR_MIN((threadTimes.sysTime - jfrState->prevThreadCPUTimes.sysTime) / (double)timeDelta, 1.0); + jfrEvent->userCPULoad = OMR_MIN((threadTimes.userTime - jfrState->prevThreadCPUTimes.userTime) / (double)timeDelta, 1.0); + jfrEvent->systemCPULoad = OMR_MIN((threadTimes.sysTime - jfrState->prevThreadCPUTimes.sysTime) / (double)timeDelta, 1.0); } jfrState->prevTimestamp = currentTime; jfrState->prevThreadCPUTimes = threadTimes;