diff --git a/buildspecs/j9.flags b/buildspecs/j9.flags
index c4dc825cdf0..7f3daf25676 100644
--- a/buildspecs/j9.flags
+++ b/buildspecs/j9.flags
@@ -1862,6 +1862,13 @@ Only available on zOS
+
+ Support for synchronizing memory with physical storage in shared classes cache
+ No support for synchronizing memory with physical storage in shared classes cache
+
+
+
+
Determines if sidecar files are built.
Standard J9 VM only - no sidecar support
diff --git a/buildspecs/zos_390-64.spec b/buildspecs/zos_390-64.spec
index c221758c480..74c6b19184d 100644
--- a/buildspecs/zos_390-64.spec
+++ b/buildspecs/zos_390-64.spec
@@ -233,6 +233,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-excepti
+
diff --git a/buildspecs/zos_390-64_cmprssptrs.spec b/buildspecs/zos_390-64_cmprssptrs.spec
index 384b60c16ab..3348430811b 100644
--- a/buildspecs/zos_390-64_cmprssptrs.spec
+++ b/buildspecs/zos_390-64_cmprssptrs.spec
@@ -233,6 +233,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-excepti
+
diff --git a/buildspecs/zos_390.spec b/buildspecs/zos_390.spec
index e2c7c5cb45b..6b6f71a6965 100644
--- a/buildspecs/zos_390.spec
+++ b/buildspecs/zos_390.spec
@@ -232,6 +232,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-excepti
+
diff --git a/runtime/bcutil/jimagereader.c b/runtime/bcutil/jimagereader.c
index 44d71f75e77..962f2cb90dd 100644
--- a/runtime/bcutil/jimagereader.c
+++ b/runtime/bcutil/jimagereader.c
@@ -26,11 +26,6 @@
#include "ut_j9bcu.h"
#include "util_api.h"
-
-#if !defined(OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE)
-#define OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE 0
-#endif /* !defined(OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE) */
-
VMINLINE static U_32 hashFn(const char *name, I_32 baseValue);
VMINLINE static I_32 getRedirectTableValue(const char *name, I_32 *redirectTable, U_32 redirectTableSize);
static I_32 verifyJImageHeader(const char *fileName, JImageHeader *header);
@@ -189,7 +184,7 @@ j9bcutil_loadJImage(J9PortLibrary *portlib, const char *fileName, J9JImage **pji
/*
* With OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE, j9mmap_map_file() has the old bahaviour that reads the file content into allocated private memory.
*/
- mmapflag |= OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE;
+ mmapflag = OMRPORT_MMAP_FLAG_ZOS_READ_MAPFILE;
#endif /* defined(J9ZOS390) */
jimage->jimageMmap = j9mmap_map_file(jimagefd, 0, mapSize, fileName, mmapflag, J9MEM_CATEGORY_CLASSES);
if (NULL == jimage->jimageMmap) {
diff --git a/runtime/cmake/caches/zos_390-64.cmake b/runtime/cmake/caches/zos_390-64.cmake
index b86a77e3168..311514aef46 100644
--- a/runtime/cmake/caches/zos_390-64.cmake
+++ b/runtime/cmake/caches/zos_390-64.cmake
@@ -59,5 +59,6 @@ set(J9VM_PORT_RUNTIME_INSTRUMENTATION ON CACHE BOOL "")
set(J9VM_THR_ASYNC_NAME_UPDATE OFF CACHE BOOL "")
set(J9VM_ZOS_3164_INTEROPERABILITY ON CACHE BOOL "")
+set(J9VM_OPT_SHR_MSYNC_SUPPORT ON CACHE BOOL "")
include("${CMAKE_CURRENT_LIST_DIR}/common.cmake")
diff --git a/runtime/cmake/options.cmake b/runtime/cmake/options.cmake
index 468853070b3..235b02ba9a3 100644
--- a/runtime/cmake/options.cmake
+++ b/runtime/cmake/options.cmake
@@ -155,3 +155,4 @@ option(J9VM_PORT_RUNTIME_INSTRUMENTATION "Controls whether runtime instrumentati
option(J9VM_USE_RDYNAMIC "Link using the -rdynamic option (Linux only)" OFF)
option(J9VM_ZOS_3164_INTEROPERABILITY "Enables support for 64-bit zOS to interoperate with 31-bit JNI native targets.")
+option(J9VM_OPT_SHR_MSYNC_SUPPORT "Enables support for synchronizing memory with physical storage in shared classes cache.")
diff --git a/runtime/include/j9cfg.h.in b/runtime/include/j9cfg.h.in
index f4cdc7843d4..aadeabc619b 100644
--- a/runtime/include/j9cfg.h.in
+++ b/runtime/include/j9cfg.h.in
@@ -241,6 +241,7 @@ extern "C" {
#cmakedefine J9VM_OPT_RESOURCE_MANAGED
#cmakedefine J9VM_OPT_ROM_IMAGE_SUPPORT
#cmakedefine J9VM_OPT_SHARED_CLASSES
+#cmakedefine J9VM_OPT_SHR_MSYNC_SUPPORT
#cmakedefine J9VM_OPT_SIDECAR
#cmakedefine J9VM_OPT_SRP_AVL_TREE_SUPPORT
#cmakedefine J9VM_OPT_STRING_COMPRESSION
diff --git a/runtime/nls/shrc/j9shr.nls b/runtime/nls/shrc/j9shr.nls
index 1cc0b0faef4..38627d430df 100644
--- a/runtime/nls/shrc/j9shr.nls
+++ b/runtime/nls/shrc/j9shr.nls
@@ -6896,3 +6896,24 @@ J9NLS_SHRC_CM_PRINTSTATS_PROCESSOR_FEATURES.explanation=NOTAG
J9NLS_SHRC_CM_PRINTSTATS_PROCESSOR_FEATURES.system_action=
J9NLS_SHRC_CM_PRINTSTATS_PROCESSOR_FEATURES.user_response=
# END NON-TRANSLATABLE
+
+J9NLS_CC_MSYNC_UNSUPPORTED=The system does not support synchronizing memory with physical storage.
+# START NON-TRANSLATABLE
+J9NLS_CC_MSYNC_UNSUPPORTED.explanation=Synchronization between memory and physical storage is not supported on the runtime platform, so the feature is disabled.
+J9NLS_CC_MSYNC_UNSUPPORTED.system_action=The JVM won't force the operating system to flush changes in memory to the physical storage.
+J9NLS_CC_MSYNC_UNSUPPORTED.user_response=No action required.
+# END NON-TRANSLATABLE
+
+J9NLS_SHRC_SHRINIT_HELPTEXT_MAP31=Map the shared class cache below the 2G addressing range.
+# START NON-TRANSLATABLE
+J9NLS_SHRC_SHRINIT_HELPTEXT_MAP31.explanation=NOTAG
+J9NLS_SHRC_SHRINIT_HELPTEXT_MAP31.system_action=
+J9NLS_SHRC_SHRINIT_HELPTEXT_MAP31.user_response=
+# END NON-TRANSLATABLE
+
+J9NLS_SHRC_OSCACHE_MMAP_MSYNC_ERROR=Error Synchronizing memory.
+# START NON-TRANSLATABLE
+J9NLS_SHRC_OSCACHE_MMAP_MSYNC_ERROR.explanation=An error has occurred in shared class processing.
+J9NLS_SHRC_OSCACHE_MMAP_MSYNC_ERROR.system_action=The JVM terminates, unless you have specified the non-fatal option with "-Xshareclasses:nonfatal", in which case the JVM continues without using shared classes.
+J9NLS_SHRC_OSCACHE_MMAP_MSYNC_ERROR.user_response=Contact your service representative.
+# END NON-TRANSLATABLE
diff --git a/runtime/oti/j9port.h b/runtime/oti/j9port.h
index 04338f994e1..908e3472c14 100644
--- a/runtime/oti/j9port.h
+++ b/runtime/oti/j9port.h
@@ -965,6 +965,9 @@ typedef struct J9CacheInfoQuery {
#define J9PORT_MMAP_FLAG_SHARED OMRPORT_MMAP_FLAG_SHARED
#define J9PORT_MMAP_FLAG_COPYONWRITE OMRPORT_MMAP_FLAG_COPYONWRITE
#define J9PORT_MMAP_SYNC_WAIT OMRPORT_MMAP_SYNC_WAIT
+#if defined(J9ZOS39064)
+#define J9PORT_MMAP_FLAG_ZOS_64BIT OMRPORT_MMAP_FLAG_ZOS_64BIT
+#endif /* defined(J9ZOS39064) */
#define J9PORT_RESOURCE_SHARED_MEMORY OMRPORT_RESOURCE_SHARED_MEMORY
#define J9PORT_RESOURCE_ADDRESS_SPACE OMRPORT_RESOURCE_ADDRESS_SPACE
diff --git a/runtime/oti/shcflags.h b/runtime/oti/shcflags.h
index 16221db1567..b3ee1486851 100644
--- a/runtime/oti/shcflags.h
+++ b/runtime/oti/shcflags.h
@@ -78,7 +78,7 @@
#define J9SHR_RUNTIMEFLAG_ENABLE_NONFATAL 0x2000
#define J9SHR_RUNTIMEFLAG_DO_DESTROY_CONFIG 0x4000
#define J9SHR_RUNTIMEFLAG_BLOCK_SPACE_FULL 0x8000
-// Available 0x10000
+#define J9SHR_RUNTIMEFLAG_MAP31 0x10000
#define J9SHR_RUNTIMEFLAG_ENABLE_AOT 0x20000
#define J9SHR_RUNTIMEFLAG_ENABLE_PERSISTENT_CACHE 0x40000
#define J9SHR_RUNTIMEFLAG_ENABLE_GROUP_ACCESS 0x80000
diff --git a/runtime/oti/util_api.h b/runtime/oti/util_api.h
index b3bbc658d1a..5421316bbcf 100644
--- a/runtime/oti/util_api.h
+++ b/runtime/oti/util_api.h
@@ -2490,31 +2490,6 @@ const char* props_file_get(j9props_file_t file, const char* key);
*/
void props_file_do(j9props_file_t file, j9props_file_iterator iterator, void* userData);
-
-
-/* ----------------- zosversion.c ---------------- */
-
-/**
- * Function to determine if the zos version is at least a given
- * release and version. The implementation is based on uname(),
- * NOT on __osname() as the __osname() release numbers are not
- * guaranteed to increase.
- *
- * For release and version numbers, see
- * http://publib.boulder.ibm.com/infocenter/zos/v1r10/index.jsp?topic=/com.ibm.zos.r10.bpxbd00/osnm.htm
- *
- * Operating System Sysname Release Version
- * z/OS V1.10 OS/390 20.00 03
- * z/OS 1.9 OS/390 19.00 03
- * z/OS 1.8 or z/OS.e 1.8 OS/390 18.00 03
- * z/OS 1.7 or z/OS.e 1.7 OS/390 17.00 03
- * z/OS 1.6 or z/OS.e 1.6 OS/390 16.00 03
- */
-BOOLEAN
-zos_version_at_least(double min_release, double min_version);
-
-
-
/* ----------------- ObjectHash.cpp ---------------- */
/**
* Hash an UDATA via murmur3 algorithm
diff --git a/runtime/shared_common/CompositeCache.cpp b/runtime/shared_common/CompositeCache.cpp
index 1c8bb51bc3d..846323a0d34 100644
--- a/runtime/shared_common/CompositeCache.cpp
+++ b/runtime/shared_common/CompositeCache.cpp
@@ -862,29 +862,6 @@ void
SH_CompositeCacheImpl::notifyPagesCommitted(BlockPtr start, BlockPtr end, UDATA expectedDirection)
{
Trc_SHR_CC_notifyPagesCommitted_Entry(start, end, expectedDirection);
-
-#if defined (J9SHR_MSYNC_SUPPORT)
- if (*_runtimeFlags & J9SHR_RUNTIMEFLAG_ENABLE_MSYNC) {
- UDATA actualDirection = (start < end) ? DIRECTION_FORWARD : DIRECTION_BACKWARD;
- BlockPtr syncStart, syncEnd;
-
- if ((_osPageSize == 0) || _readOnlyOSCache) {
- Trc_SHR_Assert_ShouldNeverHappen();
- return;
- }
-
- if (actualDirection == DIRECTION_FORWARD) {
- syncStart = (BlockPtr)ROUND_DOWN_TO(_osPageSize, (UDATA)start);
- syncEnd = (BlockPtr)ROUND_UP_TO(_osPageSize, (UDATA)end);
- } else {
- syncStart = (BlockPtr)ROUND_DOWN_TO(_osPageSize, (UDATA)end);
- syncEnd = (BlockPtr)ROUND_UP_TO(_osPageSize, (UDATA)start);
- }
- if (syncStart != syncEnd) {
- _oscache->syncUpdates((void*)syncStart, (syncEnd - syncStart), (J9PORT_MMAP_SYNC_WAIT | J9PORT_MMAP_SYNC_INVALIDATE));
- }
- }
-#endif
notifyPagesRead(start, end, expectedDirection, true);
Trc_SHR_CC_notifyPagesCommitted_Exit();
@@ -1044,7 +1021,15 @@ SH_CompositeCacheImpl::startup(J9VMThread* currentThread, J9SharedClassPreinitCo
bool OSCStarted = false;
setCurrentCacheVersion(vm, J2SE_VERSION(currentThread->javaVM), &versionData);
-
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
+ if (J9_ARE_ANY_BITS_SET(*_runtimeFlags, J9SHR_RUNTIMEFLAG_ENABLE_PERSISTENT_CACHE)) {
+ /**
+ * Set J9SHR_RUNTIMEFLAG_ENABLE_MSYNC here rather than in getDefaultRuntimeFlags().
+ * In unit tests where cacheMemory is not NULL, no mapped file is used. No need to do msync in unit tests.
+ */
+ *_runtimeFlags |= J9SHR_RUNTIMEFLAG_ENABLE_MSYNC;
+ }
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
/* Note that OSCache startup does not leave any kind of lock on the cache, so the cache file could in theory
* be recreated by another process whenever we're not holding a lock on it. This can happen until attach() is called */
@@ -1396,32 +1381,59 @@ SH_CompositeCacheImpl::startup(J9VMThread* currentThread, J9SharedClassPreinitCo
_readWriteAreaStart = NULL;
_readWriteAreaBytes = 0;
}
- if (isFirstStart && (!_theca->roundedPagesFlag || _readOnlyOSCache)) {
+ if (isFirstStart) {
+ if ((0 == _theca->roundedPagesFlag) || _readOnlyOSCache) {
/* If we don't have rounded pages or if we're running readonly, we can't do mprotect or msync */
-#if defined (J9SHR_MSYNC_SUPPORT)
- *_runtimeFlags &= ~(J9SHR_RUNTIMEFLAG_ENABLE_MSYNC
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
+ *_runtimeFlags &= ~(J9SHR_RUNTIMEFLAG_ENABLE_MSYNC
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_ALL
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_RW
| J9SHR_RUNTIMEFLAG_MPROTECT_PARTIAL_PAGES_ON_STARTUP
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_PARTIAL_PAGES
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_ONFIND);
-#else
- *_runtimeFlags &= ~(J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT
+ if (!_readOnlyOSCache) {
+ CC_TRACE(J9SHR_VERBOSEFLAG_ENABLE_VERBOSE, J9NLS_INFO, J9NLS_CC_PAGE_PROTECTION_UNSUPPORTED);
+ CC_TRACE(J9SHR_VERBOSEFLAG_ENABLE_VERBOSE, J9NLS_INFO, J9NLS_CC_MSYNC_UNSUPPORTED);
+ }
+ } else {
+ if (J9_ARE_ALL_BITS_SET(*_runtimeFlags, J9SHR_RUNTIMEFLAG_ENABLE_PERSISTENT_CACHE)) {
+ int32_t mmapCapabilities = j9mmap_capabilities();
+ if (J9_ARE_NO_BITS_SET(mmapCapabilities, J9PORT_MMAP_CAPABILITY_MSYNC)) {
+ *_runtimeFlags &= ~J9SHR_RUNTIMEFLAG_ENABLE_MSYNC;
+ if (!_readOnlyOSCache) {
+ CC_TRACE(J9SHR_VERBOSEFLAG_ENABLE_VERBOSE, J9NLS_INFO, J9NLS_CC_MSYNC_UNSUPPORTED);
+ }
+ }
+ if (J9_ARE_NO_BITS_SET(mmapCapabilities, J9PORT_MMAP_CAPABILITY_PROTECT)) {
+ *_runtimeFlags &= ~(J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT
+ | J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_ALL
+ | J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_RW
+ | J9SHR_RUNTIMEFLAG_MPROTECT_PARTIAL_PAGES_ON_STARTUP
+ | J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_PARTIAL_PAGES
+ | J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_ONFIND);
+ if (!_readOnlyOSCache) {
+ CC_TRACE(J9SHR_VERBOSEFLAG_ENABLE_VERBOSE, J9NLS_INFO, J9NLS_CC_PAGE_PROTECTION_UNSUPPORTED);
+ }
+ }
+ }
+#else /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
+ *_runtimeFlags &= ~(J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_ALL
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_RW
| J9SHR_RUNTIMEFLAG_MPROTECT_PARTIAL_PAGES_ON_STARTUP
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_PARTIAL_PAGES
| J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT_ONFIND);
-#endif
- if (!_readOnlyOSCache) {
- CC_TRACE(J9SHR_VERBOSEFLAG_ENABLE_VERBOSE, J9NLS_INFO, J9NLS_CC_PAGE_PROTECTION_UNSUPPORTED);
+ if (!_readOnlyOSCache) {
+ CC_TRACE(J9SHR_VERBOSEFLAG_ENABLE_VERBOSE, J9NLS_INFO, J9NLS_CC_PAGE_PROTECTION_UNSUPPORTED);
+ }
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
}
}
-#if defined (J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
_doHeaderSync = _doReadWriteSync = _doSegmentSync = _doMetaSync = (*_runtimeFlags & J9SHR_RUNTIMEFLAG_ENABLE_MSYNC);
-#endif
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
if (J9_ARE_ALL_BITS_SET(*_runtimeFlags, J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT)) {
_doSegmentProtect = !getContainsCachelets();
_doMetaProtect = true;
@@ -1533,6 +1545,7 @@ SH_CompositeCacheImpl::startup(J9VMThread* currentThread, J9SharedClassPreinitCo
if (_initializingNewCache) {
*cacheHasIntegrity = true;
_theca->ccInitComplete |= CC_STARTUP_COMPLETE;
+ Trc_SHR_CC_startup_setCacheInitComplete(currentThread);
}
_maxAOT = _theca->maxAOT;
_maxJIT = _theca->maxJIT;
@@ -1907,6 +1920,7 @@ SH_CompositeCacheImpl::enterWriteMutex(J9VMThread* currentThread, bool lockCache
rc = omrthread_monitor_enter(_utMutex);
}
if (rc == 0) {
+ Trc_SHR_Assert_Equals(NULL, _commonCCInfo->hasWriteMutexThread);
_commonCCInfo->hasWriteMutexThread = currentThread;
if (*_runtimeFlags & J9SHR_RUNTIMEFLAG_DENY_CACHE_UPDATES) {
/*Pass doDecWriteCounter=false b/c exitWriteMutex is being called without updating writerCount*/
@@ -1922,9 +1936,9 @@ SH_CompositeCacheImpl::enterWriteMutex(J9VMThread* currentThread, bool lockCache
&& (true == _started) && (0 == rc)) {
/*This function may be called before _theca is set (e.g SH_CompositeCacheImpl::startup)*/
unprotectHeaderReadWriteArea(currentThread, false);
-
this->_commonCCInfo->oldWriterCount = _theca->writerCount;
_theca->writerCount += 1;
+ Trc_SHR_CC_enterWriteMutex_writerCountInc(currentThread, this->_commonCCInfo->oldWriterCount, _theca->writerCount);
protectHeaderReadWriteArea(currentThread, false);
}
if (rc == -1) {
@@ -1971,10 +1985,10 @@ SH_CompositeCacheImpl::exitWriteMutex(J9VMThread* currentThread, const char* cal
&& (true == doDecWriteCounter) && (true == _started)) {
/*This function may be called before _theca is set (e.g SH_CompositeCacheImpl::startup)*/
unprotectHeaderReadWriteArea(currentThread, false);
-
_theca->writerCount -= 1;
- protectHeaderReadWriteArea(currentThread, false);
+ Trc_SHR_CC_exitWriteMutex_writerCountDec(currentThread, _theca->writerCount);
Trc_SHR_Assert_True(this->_commonCCInfo->oldWriterCount == _theca->writerCount);
+ protectHeaderReadWriteArea(currentThread, false);
}
doUnlockCache(currentThread);
@@ -2988,9 +3002,9 @@ SH_CompositeCacheImpl::commitUpdateHelper(J9VMThread* currentThread, bool isCach
* can occur. On at least zOS, the mprotected memory persists across vm invocations.
*/
if (_doSegmentProtect
-#if defined (J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
|| _doSegmentSync
-#endif
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
) {
if ((J9_ARE_ALL_BITS_SET(*_runtimeFlags, J9SHR_RUNTIMEFLAG_MPROTECT_PARTIAL_PAGES_ON_STARTUP) || (J9VM_PHASE_NOT_STARTUP == vm->phase))
&& (true == _doPartialPagesProtect)
@@ -3045,9 +3059,9 @@ SH_CompositeCacheImpl::commitUpdateHelper(J9VMThread* currentThread, bool isCach
_theca->jitBytes += _storedJITUsedBytes;
}
if (_doMetaProtect
-#if defined (J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
|| _doMetaSync
-#endif
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
) {
/* Note that _scan always points to the next available ShcItemHdr,
* so the memory between _scan and (_scan + sizeof(ShcItemHdr)) can be modified */
@@ -3737,6 +3751,11 @@ SH_CompositeCacheImpl::runExitCode(J9VMThread *currentThread)
if (UnitTest::MINMAX_TEST == UnitTest::unitTest) {
return;
}
+ /* If J9VM_OPT_SHR_MSYNC_SUPPORT is enabled, syncUpdates() is needed to write the header page to the cache file.
+ * Call runExitCode() first so that the last detach time can be saved to the file.
+ */
+ oscacheToUse->runExitCode();
+
/* If we're exiting abnormally, a thread may have the write mutex.
* If that's the case, do not attempt to update the cache CRC
* because otherwise we can hang writing the dumps */
@@ -3747,6 +3766,15 @@ SH_CompositeCacheImpl::runExitCode(J9VMThread *currentThread)
updateCacheCRC();
/* Deny updates so the CRC is not invalidated */
*_runtimeFlags |= J9SHR_RUNTIMEFLAG_DENY_CACHE_UPDATES;
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
+ if (J9_ARE_ALL_BITS_SET(*_runtimeFlags, J9SHR_RUNTIMEFLAG_ENABLE_MSYNC)) {
+ BlockPtr areaStart = _cacheHeaderPageStart;
+ BlockPtr areaEnd = (BlockPtr)ROUND_UP_TO(_osPageSize, (UDATA)CAEND(_theca));
+ if (NULL != areaStart) {
+ oscacheToUse->syncUpdates(areaStart, areaEnd - areaStart, J9PORT_MMAP_SYNC_WAIT);
+ }
+ }
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
if ((lockrc = oscacheToUse->releaseWriteLock(_commonCCInfo->writeMutexID)) != 0) {
CC_ERR_TRACE1(J9NLS_SHRC_CC_FAILED_EXIT_MUTEX, lockrc);
}
@@ -3754,7 +3782,6 @@ SH_CompositeCacheImpl::runExitCode(J9VMThread *currentThread)
CC_ERR_TRACE1(J9NLS_SHRC_CC_FAILED_RUN_EXIT_CODE_ACQUIRE_MUTEX, lockrc);
}
}
- oscacheToUse->runExitCode();
return;
}
@@ -3821,7 +3848,6 @@ SH_CompositeCacheImpl::enterReadWriteAreaMutex(J9VMThread* currentThread, BOOLEA
if (oscacheToUse && _readWriteAreaBytes) {
if (_commonCCInfo->readWriteAreaMutexID != CC_READONLY_LOCK_VALUE) {
-
Trc_SHR_Assert_NotEquals(currentThread, _commonCCInfo->hasReadWriteMutexThread);
Trc_SHR_Assert_NotEquals(currentThread, _commonCCInfo->hasRefreshMutexThread);
@@ -3953,12 +3979,6 @@ SH_CompositeCacheImpl::exitReadWriteAreaMutex(J9VMThread* currentThread, UDATA r
Trc_SHR_Assert_NotEquals(currentThread, _commonCCInfo->hasRefreshMutexThread);
if (oscacheToUse && _readWriteAreaBytes) {
-#if defined (J9SHR_MSYNC_SUPPORT)
- if (_doReadWriteSync) {
- oscacheToUse->syncUpdates((void*)_readWriteAreaStart, _readWriteAreaBytes, (J9PORT_MMAP_SYNC_WAIT | J9PORT_MMAP_SYNC_INVALIDATE));
- }
-#endif
-
if (resetReason != J9SHR_STRING_POOL_OK) {
UDATA oldNum = _theca->readWriteVerifyCntr;
/* The bottom 4 bits are reserved for flags, the count is shifted by 4 */
@@ -5022,7 +5042,14 @@ SH_CompositeCacheImpl::startupForStats(J9VMThread* currentThread, SH_OSCache * o
* take the read lock. The read-write area can also be written since we don't
* have the read-write lock.
*/
- *_runtimeFlags |= J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT;
+ if (J9_ARE_ANY_BITS_SET(*runtimeFlags, J9SHR_RUNTIMEFLAG_ENABLE_PERSISTENT_CACHE)) {
+ PORT_ACCESS_FROM_VMC(currentThread);
+ if (J9_ARE_ANY_BITS_SET(j9mmap_capabilities(), J9PORT_MMAP_CAPABILITY_PROTECT)) {
+ *_runtimeFlags |= J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT;
+ }
+ } else {
+ *_runtimeFlags |= J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT;
+ }
notifyPagesRead(CASTART(_theca), CAEND(_theca), DIRECTION_FORWARD, true);
}
diff --git a/runtime/shared_common/CompositeCacheImpl.hpp b/runtime/shared_common/CompositeCacheImpl.hpp
index dfcfc07f9c9..6ca855c501a 100644
--- a/runtime/shared_common/CompositeCacheImpl.hpp
+++ b/runtime/shared_common/CompositeCacheImpl.hpp
@@ -464,11 +464,11 @@ class SH_CompositeCacheImpl : public SH_CompositeCache, public AbstractMemoryPer
bool _doMetaProtect;
bool _doPartialPagesProtect;
bool _readOnlyOSCache;
-#if defined (J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
bool _doMetaSync;
bool _doHeaderSync;
bool _doSegmentSync;
-#endif
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
IDATA _headerProtectCntr;
IDATA _readWriteProtectCntr;
diff --git a/runtime/shared_common/OSCache.cpp b/runtime/shared_common/OSCache.cpp
index 98079882c90..d54d7701963 100644
--- a/runtime/shared_common/OSCache.cpp
+++ b/runtime/shared_common/OSCache.cpp
@@ -1248,6 +1248,10 @@ SH_OSCache::getCacheStatsCommon(J9JavaVM* vm, const char* ctrlDirName, UDATA gro
goto done;
}
+ if (J9PORT_SHR_CACHE_TYPE_PERSISTENT == cacheInfo->versionData.cacheType) {
+ runtimeflags |= J9SHR_RUNTIMEFLAG_ENABLE_PERSISTENT_CACHE;
+ }
+
startedForStats = cmStats->startupForStats(currentThread, ctrlDirName, groupPerm, cache, &runtimeflags, lowerLayerList);
if (startedForStats != CC_STARTUP_OK) {
diff --git a/runtime/shared_common/OSCache.hpp b/runtime/shared_common/OSCache.hpp
index a169d87f760..a3b95bda863 100644
--- a/runtime/shared_common/OSCache.hpp
+++ b/runtime/shared_common/OSCache.hpp
@@ -238,9 +238,9 @@ class SH_OSCache
virtual void *attach(J9VMThread* currentThread, J9PortShcVersion* expectedVersionData) = 0;
-#if defined (J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
virtual IDATA syncUpdates(void* start, UDATA length, U_32 flags) = 0;
-#endif
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
virtual IDATA getError(void) = 0;
diff --git a/runtime/shared_common/OSCachemmap.cpp b/runtime/shared_common/OSCachemmap.cpp
index 0184bd2c7bb..8fcfc6af872 100644
--- a/runtime/shared_common/OSCachemmap.cpp
+++ b/runtime/shared_common/OSCachemmap.cpp
@@ -183,7 +183,7 @@ SH_OSCachemmap::startup(J9JavaVM* vm, const char* ctrlDirName, UDATA cacheDirPer
versionData->cacheType = J9PORT_SHR_CACHE_TYPE_PERSISTENT;
mmapCapabilities = j9mmap_capabilities();
- if (!(mmapCapabilities & J9PORT_MMAP_CAPABILITY_WRITE) || !(mmapCapabilities & J9PORT_MMAP_CAPABILITY_MSYNC)) {
+ if (J9_ARE_NO_BITS_SET(mmapCapabilities, J9PORT_MMAP_CAPABILITY_WRITE | J9PORT_MMAP_CAPABILITY_MSYNC)) {
Trc_SHR_OSC_Mmap_startup_nommap(mmapCapabilities);
errorHandler(J9NLS_SHRC_OSCACHE_MMAP_STARTUP_MMAPCAP, NULL);
goto _errorPreFileOpen;
@@ -957,10 +957,8 @@ SH_OSCachemmap::internalAttach(bool isNewCache, UDATA generation)
IDATA rc = J9SH_OSCACHE_FAILURE;
Trc_SHR_OSC_Mmap_internalAttach_Entry();
-
/* Get current length of file */
accessFlags |= J9PORT_MMAP_FLAG_SHARED;
-
_actualFileLength = _cacheSize;
Trc_SHR_Assert_True(_actualFileLength > 0);
@@ -988,6 +986,13 @@ SH_OSCachemmap::internalAttach(bool isNewCache, UDATA generation)
}
#endif
+#if defined(J9ZOS39064)
+ if (J9_ARE_NO_BITS_SET(_runtimeFlags, J9SHR_RUNTIMEFLAG_MAP31)
+ && zos_version_at_least(ZOS_V2R4_RELEASE, ZOS_V2R4_VERSION)
+ ) {
+ accessFlags |= J9PORT_MMAP_FLAG_ZOS_64BIT;
+ }
+#endif /* defined(J9ZOS39064) */
/* Map the file */
_mapFileHandle = j9mmap_map_file(_fileHandle, 0, (UDATA)_actualFileLength, _cachePathName, accessFlags, J9MEM_CATEGORY_CLASSES_SHC_CACHE);
if ((NULL == _mapFileHandle) || (NULL == _mapFileHandle->pointer)) {
@@ -1650,7 +1655,7 @@ SH_OSCachemmap::runExitCode()
Trc_SHR_OSC_Mmap_runExitCode_Exit();
}
-#if defined (J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
/**
* Synchronise cache updates to disk
*
@@ -1662,14 +1667,17 @@ IDATA
SH_OSCachemmap::syncUpdates(void* start, UDATA length, U_32 flags)
{
PORT_ACCESS_FROM_PORT(_portLibrary);
-
- IDATA rc;
-
Trc_SHR_OSC_Mmap_syncUpdates_Entry(start, length, flags);
-
- rc = j9mmap_msync(start, length, flags);
+ IDATA rc = j9mmap_msync(start, length, flags);
if (-1 == rc) {
- Trc_SHR_OSC_Mmap_syncUpdates_badmsync();
+ I_32 errorno = j9error_last_error_number();
+ const char * errormsg = j9error_last_error_message();
+ LastErrorInfo lastErrorInfo;
+ lastErrorInfo.lastErrorCode = errorno;
+ lastErrorInfo.lastErrorMsg = errormsg;
+ Trc_SHR_OSC_Mmap_syncUpdates_badmsync1(errorno, errormsg);
+ errorHandler(J9NLS_SHRC_OSCACHE_MMAP_MSYNC_ERROR, &lastErrorInfo);
+ Trc_SHR_Assert_ShouldNeverHappen();
return -1;
}
Trc_SHR_OSC_Mmap_syncUpdates_goodmsync();
@@ -1677,7 +1685,7 @@ SH_OSCachemmap::syncUpdates(void* start, UDATA length, U_32 flags)
Trc_SHR_OSC_Mmap_syncUpdates_Exit();
return 0;
}
-#endif
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
/**
* Return the locking capabilities of this shared classes cache implementation
@@ -1725,12 +1733,17 @@ SH_OSCachemmap::getPermissionsRegionGranularity(J9PortLibrary* portLibrary)
/* The code below is used as is in SH_CompositeCacheImpl::initialize()
* for initializing SH_CompositeCacheImpl::_osPageSize during unit testing.
*/
-
- /* This call to capabilities is arguably unnecessary, but it is a good check to do */
- if (j9mmap_capabilities() & J9PORT_MMAP_CAPABILITY_PROTECT) {
+ int32_t mmapCapabilities = j9mmap_capabilities();
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
+#define MMAP_CAPABILITY_MASK (J9PORT_MMAP_CAPABILITY_PROTECT | J9PORT_MMAP_CAPABILITY_MSYNC)
+#else /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
+#define MMAP_CAPABILITY_MASK J9PORT_MMAP_CAPABILITY_PROTECT
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
+ if (J9_ARE_ANY_BITS_SET(mmapCapabilities, MMAP_CAPABILITY_MASK)) {
return j9mmap_get_region_granularity((void*)_headerStart);
}
return 0;
+#undef MMAP_CAPABILITY_MASK
}
/**
diff --git a/runtime/shared_common/OSCachemmap.hpp b/runtime/shared_common/OSCachemmap.hpp
index 5a317a998f8..dae5c2bb762 100644
--- a/runtime/shared_common/OSCachemmap.hpp
+++ b/runtime/shared_common/OSCachemmap.hpp
@@ -68,9 +68,9 @@ class SH_OSCachemmap : public SH_OSCacheFile
virtual IDATA detach(void);
-#if defined (J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
virtual IDATA syncUpdates(void* start, UDATA length, U_32 flags);
-#endif
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
virtual IDATA getWriteLockID(void);
virtual IDATA getReadWriteLockID(void);
diff --git a/runtime/shared_common/OSCachesysv.cpp b/runtime/shared_common/OSCachesysv.cpp
index b8adf0c196e..d0641aa79e2 100644
--- a/runtime/shared_common/OSCachesysv.cpp
+++ b/runtime/shared_common/OSCachesysv.cpp
@@ -1600,7 +1600,7 @@ SH_OSCachesysv::runExitCode(void)
/* No action required */
}
-#if defined(J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
/**
* Synchronise cache updates to disk
*
@@ -1613,7 +1613,7 @@ SH_OSCachesysv::syncUpdates(void* start, UDATA length, U_32 flags)
{
return -1;
}
-#endif /* defined(J9SHR_MSYNC_SUPPORT) */
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
/**
* Return the locking capabilities of this shared classes cache implementation
diff --git a/runtime/shared_common/OSCachesysv.hpp b/runtime/shared_common/OSCachesysv.hpp
index 944078f861e..1a1ac5e7c8d 100644
--- a/runtime/shared_common/OSCachesysv.hpp
+++ b/runtime/shared_common/OSCachesysv.hpp
@@ -141,9 +141,9 @@ class SH_OSCachesysv : public SH_OSCache
virtual IDATA detach(void);
-#if defined (J9SHR_MSYNC_SUPPORT)
+#if defined(J9VM_OPT_SHR_MSYNC_SUPPORT)
IDATA syncUpdates(void* start, UDATA length, U_32 flags);
-#endif
+#endif /* defined(J9VM_OPT_SHR_MSYNC_SUPPORT) */
IDATA getError(void);
diff --git a/runtime/shared_common/j9shr.tdf b/runtime/shared_common/j9shr.tdf
index 4ec036ac7a0..c70a8b94072 100644
--- a/runtime/shared_common/j9shr.tdf
+++ b/runtime/shared_common/j9shr.tdf
@@ -2994,3 +2994,8 @@ TraceException=Trc_SHR_CC_changePartialPageProtection_NotDone_V1 Overhead=1 Leve
TraceEvent=Trc_SHR_CC_freeBlockBytes_info NoEnv Overhead=1 Level=10 Template="CC getFreeBlockBytes: case %d, retVal %d, freeBytes %d, minAOT %d, aotBytes %d, minJIT %d, jitBytes %d"
TraceExit-Exception=Trc_SHR_CM_getCachedUTFString_exit4 Overhead=1 Level=2 Template="CM getCachedUTFString: Exiting due to memory allocation failed"
+
+TraceEvent=Trc_SHR_CC_startup_setCacheInitComplete Overhead=1 Level=9 Template="CC startup: set cache initialization complete"
+TraceEvent=Trc_SHR_CC_enterWriteMutex_writerCountInc Overhead=1 Level=9 Template="CC enterWriteMutex writerCount incremented from %zu to %zu"
+TraceEvent=Trc_SHR_CC_exitWriteMutex_writerCountDec Overhead=1 Level=9 Template="CC exitWriteMutex writerCount decremented to %zu"
+TraceExit=Trc_SHR_OSC_Mmap_syncUpdates_badmsync1 NoEnv Overhead=1 Level=1 Template="SH_OSCachemmap::syncUpdates: j9mmap_msync failed with error number: %d, error message %s"
diff --git a/runtime/shared_common/shrinit.cpp b/runtime/shared_common/shrinit.cpp
index f1d263fb6e8..5993a55317e 100644
--- a/runtime/shared_common/shrinit.cpp
+++ b/runtime/shared_common/shrinit.cpp
@@ -277,6 +277,9 @@ J9SharedClassesHelpText J9SHAREDCLASSESHELPTEXT[] = {
{OPTION_DISABLE_CORRUPT_CACHE_DUMPS, 0, 0, J9NLS_SHRC_SHRINIT_HELPTEXT_DISABLE_CORRUPT_CACHE_DUMPS},
{OPTION_CHECK_STRINGTABLE_RESET, 0, 0, J9NLS_SHRC_SHRINIT_HELPTEXT_CHECK_STRINGTABLE_RESET},
{OPTION_ADDTESTJITHINT, 0, 0, J9NLS_SHRC_SHRINIT_HELPTEXT_ADD_JIT_HINTS},
+#if defined(J9ZOS39064)
+ {OPTION_MAP31, 0, 0, J9NLS_SHRC_SHRINIT_HELPTEXT_MAP31},
+#endif /* defined(J9ZOS39064) */
{NULL, 0, 0, 0, 0}
};
@@ -376,6 +379,9 @@ J9SharedClassesOptions J9SHAREDCLASSESOPTIONS[] = {
{ OPTION_CREATE_LAYER, PARSE_TYPE_EXACT, RESULT_DO_CREATE_LAYER, 0 },
#endif /* defined(J9VM_OPT_MULTI_LAYER_SHARED_CLASS_CACHE) */
{ OPTION_NO_PERSISTENT_DISK_SPACE_CHECK, PARSE_TYPE_EXACT, RESULT_DO_ADD_RUNTIMEFLAG, J9SHR_RUNTIMEFLAG_NO_PERSISTENT_DISK_SPACE_CHECK},
+#if defined(J9ZOS39064)
+ { OPTION_MAP31, PARSE_TYPE_EXACT, RESULT_DO_ADD_RUNTIMEFLAG, J9SHR_RUNTIMEFLAG_MAP31},
+#endif /* defined(J9ZOS39064) */
{ NULL, 0, 0 }
};
@@ -1095,13 +1101,6 @@ parseArgs(J9JavaVM* vm, char* options, U_64* runtimeFlags, UDATA* verboseFlags,
options += (strlen(J9SHAREDCLASSESOPTIONS[i].option)+1);
}
-
-#if defined(J9ZOS390)
- /* Persistent shared classes caches not currently available */
- /* on zOS due to level of memory mapped file support */
- *runtimeFlags &= ~(J9SHR_RUNTIMEFLAG_ENABLE_PERSISTENT_CACHE);
-#endif
-
#if defined(AIXPPC)
if ((*runtimeFlags & J9SHR_RUNTIMEFLAG_ENABLE_PERSISTENT_CACHE) != 0) {
I_32 coreMmapSet;
@@ -4329,9 +4328,6 @@ getDefaultRuntimeFlags(void)
J9SHR_RUNTIMEFLAG_ENABLE_SHAREANONYMOUSCLASSES |
J9SHR_RUNTIMEFLAG_ENABLE_SHAREUNSAFECLASSES |
J9SHR_RUNTIMEFLAG_ENABLE_ROUND_TO_PAGE_SIZE |
-#if defined (J9SHR_MSYNC_SUPPORT)
- J9SHR_RUNTIMEFLAG_ENABLE_MSYNC |
-#endif
J9SHR_RUNTIMEFLAG_ENABLE_MPROTECT |
#if !defined(J9ZOS390) && !defined(AIXPPC)
/* Calling mprotect on the RW when using persistent caches on AIX and ZOS
diff --git a/runtime/shared_common/shrinit.h b/runtime/shared_common/shrinit.h
index 318f6be05f1..1adf62dd2b5 100644
--- a/runtime/shared_common/shrinit.h
+++ b/runtime/shared_common/shrinit.h
@@ -195,6 +195,7 @@ typedef struct J9SharedClassesOptions {
#define OPTION_LAYER_EQUALS "layer="
#define OPTION_CREATE_LAYER "createLayer"
#define OPTION_NO_PERSISTENT_DISK_SPACE_CHECK "noPersistentDiskSpaceCheck"
+#define OPTION_MAP31 "map31"
/* public options for printallstats= and printstats= */
#define SUB_OPTION_PRINTSTATS_ALL "all"
diff --git a/runtime/tests/port/j9mmapTest.c b/runtime/tests/port/j9mmapTest.c
index fea8950a721..7d1cac46401 100644
--- a/runtime/tests/port/j9mmapTest.c
+++ b/runtime/tests/port/j9mmapTest.c
@@ -155,15 +155,16 @@ j9mmap_test0(struct J9PortLibrary *portLibrary)
* processes read-only mapping
*
* @param[in] portLibrary The port library under test
+ * @param[in] extraMmapFlags Extra J9PORT_MMAP_FLAG_XXX flags passing to j9mmap_map_file()
*
* @return TEST_PASS on success, TEST_FAIL on error
*/
int
-j9mmap_test1(struct J9PortLibrary *portLibrary)
+j9mmap_test1(struct J9PortLibrary *portLibrary, U_32 extraMmapFlags)
{
PORT_ACCESS_FROM_PORT(portLibrary);
- const char* testName = "j9mmap_test1";
+ const char *testName = (0 == extraMmapFlags) ? "j9mmap_test1" : "j9mmap_test1_extraFlags";
const char *filename = "mmapTest1.tst";
IDATA fd;
IDATA rc;
@@ -230,7 +231,7 @@ j9mmap_test1(struct J9PortLibrary *portLibrary)
goto exit;
}
- mmapHandle = (J9MmapHandle *)j9mmap_map_file(fd, 0, (UDATA)fileLength, NULL, J9PORT_MMAP_FLAG_READ, OMRMEM_CATEGORY_PORT_LIBRARY);
+ mmapHandle = (J9MmapHandle *)j9mmap_map_file(fd, 0, (UDATA)fileLength, NULL, J9PORT_MMAP_FLAG_READ | extraMmapFlags, OMRMEM_CATEGORY_PORT_LIBRARY);
if ((NULL == mmapHandle) || (NULL == mmapHandle->pointer)) {
lastErrorMessage = (char *)j9error_last_error_message();
lastErrorNumber = j9error_last_error_number();
@@ -264,15 +265,15 @@ j9mmap_test1(struct J9PortLibrary *portLibrary)
* processes write mapping
*
* @param[in] portLibrary The port library under test
+ * @param[in] extraMmapFlags Extra J9PORT_MMAP_FLAG_XXX flags passing to j9mmap_map_file()
*
* @return TEST_PASS on success, TEST_FAIL on error
*/
int
-j9mmap_test2(struct J9PortLibrary *portLibrary)
+j9mmap_test2(struct J9PortLibrary *portLibrary, U_32 extraMmapFlags)
{
PORT_ACCESS_FROM_PORT(portLibrary);
- const char* testName = "j9mmap_test2";
-
+ const char *testName = (0 == extraMmapFlags) ? "j9mmap_test2" : "j9mmap_test2_extraFlags";
const char *filename = "mmapTest2.tst";
IDATA fd;
IDATA rc;
@@ -346,7 +347,7 @@ j9mmap_test2(struct J9PortLibrary *portLibrary)
goto exit;
}
- mmapHandle = (J9MmapHandle *)j9mmap_map_file(fd, 0, (UDATA)fileLength, NULL, J9PORT_MMAP_FLAG_WRITE, OMRMEM_CATEGORY_PORT_LIBRARY);
+ mmapHandle = (J9MmapHandle *)j9mmap_map_file(fd, 0, (UDATA)fileLength, NULL, J9PORT_MMAP_FLAG_WRITE | extraMmapFlags, OMRMEM_CATEGORY_PORT_LIBRARY);
if ((NULL == mmapHandle) || (NULL == mmapHandle->pointer)) {
lastErrorMessage = (char *)j9error_last_error_message();
lastErrorNumber = j9error_last_error_number();
@@ -2297,8 +2298,12 @@ j9mmap_runTests(struct J9PortLibrary *portLibrary, char *argv0, char *j9mmap_chi
*/
rc = j9mmap_test0(portLibrary);
if (TEST_PASS == rc) {
- rc |= j9mmap_test1(portLibrary);
- rc |= j9mmap_test2(portLibrary);
+ rc |= j9mmap_test1(portLibrary, 0);
+ rc |= j9mmap_test2(portLibrary, 0);
+#if defined(J9ZOS39064)
+ rc |= j9mmap_test1(portLibrary, J9PORT_MMAP_FLAG_ZOS_64BIT);
+ rc |= j9mmap_test2(portLibrary, J9PORT_MMAP_FLAG_ZOS_64BIT);
+#endif /* defined(J9ZOS39064) */
rc |= j9mmap_test3(portLibrary);
rc |= j9mmap_test4(portLibrary);
rc |= j9mmap_test5(portLibrary, argv0);
diff --git a/runtime/tests/shared/AttachedDataTest.cpp b/runtime/tests/shared/AttachedDataTest.cpp
index d347dddb872..d2db26b4b25 100644
--- a/runtime/tests/shared/AttachedDataTest.cpp
+++ b/runtime/tests/shared/AttachedDataTest.cpp
@@ -201,8 +201,7 @@ AttachedDataTest::openTestCache(J9JavaVM* vm, BlockPtr preallocatedCache, UDATA
goto done;
}
memset(piConfig, 0, sizeof(J9SharedClassPreinitConfig));
- /* j9mmap_get_region_granularity returns 0 on zOS */
- osPageSize = j9mmap_get_region_granularity(NULL);
+ osPageSize = J9_ARE_ANY_BITS_SET(j9mmap_capabilities(), J9PORT_MMAP_CAPABILITY_PROTECT) ? j9mmap_get_region_granularity(NULL) : 0;
piConfig->sharedClassDebugAreaBytes = -1;
piConfig->sharedClassSoftMaxBytes = -1;
if (0 == preallocatedCacheSize) {
diff --git a/runtime/util/zos/freessp.c b/runtime/util/zos/freessp.c
index 129e76f3605..bc82a56b1fd 100644
--- a/runtime/util/zos/freessp.c
+++ b/runtime/util/zos/freessp.c
@@ -27,9 +27,6 @@
#include "edcwccwi.h"
#endif
-#define ZOS_V1R10_RELEASE 20.00
-#define ZOS_V1R10_VERSION 3
-
/**
* Register the J9VMThread->systemStackPointer field with the operating system.
* This function needs to be called by the running thread on itself as the OS
diff --git a/test/functional/cmdLineTests/shareClassTests/SCCMLTests/ShareClassesCMLTests-1.xml b/test/functional/cmdLineTests/shareClassTests/SCCMLTests/ShareClassesCMLTests-1.xml
index c0f7237e238..a3f47fca36c 100644
--- a/test/functional/cmdLineTests/shareClassTests/SCCMLTests/ShareClassesCMLTests-1.xml
+++ b/test/functional/cmdLineTests/shareClassTests/SCCMLTests/ShareClassesCMLTests-1.xml
@@ -1432,6 +1432,44 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-excepti
+
+ $JAVA_EXE$ $currentMode$,verboseIO,persistent -Xscmx4m $CP_HANOI$ $PROGRAM_HANOI$
+
+
+
+
+
+
+
+
+
+
+
+ $JAVA_EXE$ $currentMode$,verboseIO,persistent $CP_HANOI$ $PROGRAM_HANOI$
+
+
+
+
+
+
+
+
+
+
+
+ $JAVA_EXE$ $currentMode$,persistent,destroy
+
+
+
+
+
+
+
+
+
+
+
+
$JAVA_EXE$ $currentMode$,destroy