From 18f006e8c649b9575ac3eb518dc8890c9cbcc07b Mon Sep 17 00:00:00 2001 From: Frank Kang Date: Thu, 5 Oct 2023 09:49:50 -0700 Subject: [PATCH] Add reinitializeForRestore to GCExtBase Introduce reinitializeForRestore() method to GCExtBase, so that during restore we can simply call this method rather than access the GCExt members. This is done similar to other components which need to reinit such as Configuration. Also, add print in verboseGC for number of active cpus. Signed-off-by: Frank Kang frank.kang@ibm.com --- gc/base/GCExtensionsBase.cpp | 8 ++++++++ gc/base/GCExtensionsBase.hpp | 2 +- gc/verbose/VerboseHandlerOutput.cpp | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gc/base/GCExtensionsBase.cpp b/gc/base/GCExtensionsBase.cpp index 4e273b1f49..97abfe3271 100644 --- a/gc/base/GCExtensionsBase.cpp +++ b/gc/base/GCExtensionsBase.cpp @@ -323,6 +323,14 @@ MM_GCExtensionsBase::computeDefaultMaxHeap(MM_EnvironmentBase* env) memoryMax = MM_Math::roundToFloor(heapAlignment, (uintptr_t)memoryToRequest); } +void +MM_GCExtensionsBase::reinitializeForRestore(MM_EnvironmentBase* env) +{ + OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary()); + usablePhysicalMemory = omrsysinfo_get_addressable_physical_memory(); + parSweepChunkSize = 0; +} + bool MM_GCExtensionsBase::isSATBBarrierActive() { diff --git a/gc/base/GCExtensionsBase.hpp b/gc/base/GCExtensionsBase.hpp index 4368135a00..dc8a028306 100644 --- a/gc/base/GCExtensionsBase.hpp +++ b/gc/base/GCExtensionsBase.hpp @@ -894,7 +894,7 @@ class MM_GCExtensionsBase : public MM_BaseVirtual { virtual bool initialize(MM_EnvironmentBase* env); virtual void tearDown(MM_EnvironmentBase* env); virtual void computeDefaultMaxHeap(MM_EnvironmentBase* env); - + virtual void reinitializeForRestore(MM_EnvironmentBase* env); public: static MM_GCExtensionsBase* newInstance(MM_EnvironmentBase* env); virtual void kill(MM_EnvironmentBase* env); diff --git a/gc/verbose/VerboseHandlerOutput.cpp b/gc/verbose/VerboseHandlerOutput.cpp index 13c8e84ee2..b5abe129b5 100644 --- a/gc/verbose/VerboseHandlerOutput.cpp +++ b/gc/verbose/VerboseHandlerOutput.cpp @@ -362,6 +362,7 @@ MM_VerboseHandlerOutput::outputInitializedStanza(MM_EnvironmentBase *env, MM_Ver buffer->formatAndOutput(env, 1, ""); buffer->formatAndOutput(env, 2, "", omrsysinfo_get_physical_memory()); buffer->formatAndOutput(env, 2, "", omrsysinfo_get_number_CPUs_by_type(OMRPORT_CPU_ONLINE)); + buffer->formatAndOutput(env, 2, "", omrsysinfo_get_number_CPUs_by_type(OMRPORT_CPU_TARGET)); buffer->formatAndOutput(env, 2, "", omrsysinfo_get_CPU_architecture()); buffer->formatAndOutput(env, 2, "", omrsysinfo_get_OS_type()); buffer->formatAndOutput(env, 2, "", omrsysinfo_get_OS_version());