本文整理汇总了C++中MM_GCExtensionsBase::isDebugConcurrentScavengerPageAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ MM_GCExtensionsBase::isDebugConcurrentScavengerPageAlignment方法的具体用法?C++ MM_GCExtensionsBase::isDebugConcurrentScavengerPageAlignment怎么用?C++ MM_GCExtensionsBase::isDebugConcurrentScavengerPageAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MM_GCExtensionsBase
的用法示例。
在下文中一共展示了MM_GCExtensionsBase::isDebugConcurrentScavengerPageAlignment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
bool
MM_MemoryManager::createVirtualMemoryForHeap(MM_EnvironmentBase* env, MM_MemoryHandle* handle, uintptr_t heapAlignment, uintptr_t size, uintptr_t tailPadding, void* preferredAddress, void* ceiling)
{
Assert_MM_true(NULL != handle);
MM_GCExtensionsBase* extensions = env->getExtensions();
MM_VirtualMemory* instance = NULL;
uintptr_t mode = (OMRPORT_VMEM_MEMORY_MODE_READ | OMRPORT_VMEM_MEMORY_MODE_WRITE);
uintptr_t options = 0;
uint32_t memoryCategory = OMRMEM_CATEGORY_MM_RUNTIME_HEAP;
uintptr_t pageSize = extensions->requestedPageSize;
uintptr_t pageFlags = extensions->requestedPageFlags;
Assert_MM_true(0 != pageSize);
uintptr_t allocateSize = size;
uintptr_t concurrentScavengerPageSize = 0;
if (extensions->isConcurrentScavengerEnabled()) {
OMRPORT_ACCESS_FROM_ENVIRONMENT(env);
/*
* Allocate extra memory to guarantee proper alignment regardless start address location
* Minimum size of over-allocation should be (Concurrent_Scavenger_page_size - section size) however
* Virtual Memory can return heap size shorter by a region (and here region size == section size)
* So to guarantee desired heap size over-allocate it by full Concurrent_Scavenger_page_size
*/
concurrentScavengerPageSize = extensions->getConcurrentScavengerPageSectionSize() * CONCURRENT_SCAVENGER_PAGE_SECTIONS;
allocateSize += concurrentScavengerPageSize;
if (extensions->isDebugConcurrentScavengerPageAlignment()) {
omrtty_printf("Requested heap size 0x%zx has been extended to 0x%zx for guaranteed alignment\n", size, allocateSize);
}
} else {
if (heapAlignment > pageSize) {
allocateSize += (heapAlignment - pageSize);
}
}
#if defined(OMR_GC_MODRON_SCAVENGER)
if (extensions->enableSplitHeap) {
/* currently (ceiling != NULL) is using to recognize CompressedRefs so must be NULL for 32 bit platforms */
Assert_MM_true(NULL == ceiling);
switch(extensions->splitHeapSection) {
case MM_GCExtensionsBase::HEAP_INITIALIZATION_SPLIT_HEAP_TENURE:
/* trying to get Tenure at the bottom of virtual memory */
options |= OMRPORT_VMEM_ALLOC_DIR_BOTTOM_UP;
break;
case MM_GCExtensionsBase::HEAP_INITIALIZATION_SPLIT_HEAP_NURSERY:
/* trying to get Nursery at the top of virtual memory */
options |= OMRPORT_VMEM_ALLOC_DIR_TOP_DOWN;
break;
case MM_GCExtensionsBase::HEAP_INITIALIZATION_SPLIT_HEAP_UNKNOWN:
default:
Assert_MM_unreachable();
break;
}
}
#endif /* defined(OMR_GC_MODRON_SCAVENGER) */
if (NULL == ceiling) {
instance = MM_VirtualMemory::newInstance(env, heapAlignment, allocateSize, pageSize, pageFlags, tailPadding, preferredAddress,
ceiling, mode, options, memoryCategory);
} else {
#if defined(OMR_GC_COMPRESSED_POINTERS)
OMRPORT_ACCESS_FROM_ENVIRONMENT(env);
/*
* This function is used for Compressed References platforms only
* The ceiling for such platforms is set maximum memory value be supported (32G for 3-bit shift)
* The ceiling it is 0 for all other platforms
*/
/* NON_SCALING_LOW_MEMORY_HEAP_CEILING is set to 4G for 64-bit platforms only, 0 for 32-bit platforms */
Assert_MM_true(NON_SCALING_LOW_MEMORY_HEAP_CEILING > 0);
/*
* Usually the suballocator memory should be allocated first (before heap) however
* in case when preferred address is specified we will try to allocate heap first
* to avoid possible interference with requested heap location
*/
bool shouldHeapBeAllocatedFirst = (NULL != preferredAddress);
void* startAllocationAddress = preferredAddress;
/* Set the commit size for the sub allocator. This needs to be completed before the call to omrmem_ensure_capacity32 */
omrport_control(OMRPORT_CTLDATA_ALLOCATE32_COMMIT_SIZE, extensions->suballocatorCommitSize);
if (!shouldHeapBeAllocatedFirst) {
if (OMRPORT_ENSURE_CAPACITY_FAILED == omrmem_ensure_capacity32(extensions->suballocatorInitialSize)) {
extensions->heapInitializationFailureReason = MM_GCExtensionsBase::HEAP_INITIALIZATION_FAILURE_REASON_CAN_NOT_ALLOCATE_LOW_MEMORY_RESERVE;
return false;
}
}
options |= OMRPORT_VMEM_STRICT_ADDRESS | OMRPORT_VMEM_ALLOC_QUICK;
#if defined(J9ZOS39064)
/* 2TO32G area is extended to 64G */
options |= OMRPORT_VMEM_ZOS_USE2TO32G_AREA;
/*
* On ZOS an address space below 2G can not be taken for virtual memory
*/
//.........这里部分代码省略.........