当前位置: 首页>>代码示例>>C++>>正文


C++ MM_MemorySubSpace类代码示例

本文整理汇总了C++中MM_MemorySubSpace的典型用法代码示例。如果您正苦于以下问题:C++ MM_MemorySubSpace类的具体用法?C++ MM_MemorySubSpace怎么用?C++ MM_MemorySubSpace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MM_MemorySubSpace类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: regionIterator

/**
 * Walk all segments and calculate the maximum number of chunks needed to represent the current heap.
 * The chunk calculation is done on a per segment basis (no segment can represent memory from more than 1 chunk),
 * and partial sized chunks (ie: less than the chunk size) are reserved for any remaining space at the end of a
 * segment.
 * @return number of chunks required to represent the current heap memory.
 */
uintptr_t
MM_SweepHeapSectioningSegmented::calculateActualChunkNumbers() const
{
	uintptr_t totalChunkCount = 0;

	MM_HeapRegionDescriptor *region;
	MM_Heap *heap = _extensions->heap;
	MM_HeapRegionManager *regionManager = heap->getHeapRegionManager();
	GC_HeapRegionIterator regionIterator(regionManager);

	while((region = regionIterator.nextRegion()) != NULL) {
		if ((region)->isCommitted()) {
			/* TODO:  this must be rethought for Tarok since it treats all regions identically but some might require different sweep logic */
			MM_MemorySubSpace *subspace = region->getSubSpace();
			/* if this is a committed region, it requires a non-NULL subspace */
			Assert_MM_true(NULL != subspace);
			uintptr_t poolCount = subspace->getMemoryPoolCount();

			totalChunkCount += MM_Math::roundToCeiling(_extensions->parSweepChunkSize, region->getSize()) / _extensions->parSweepChunkSize;

			/* Add extra chunks if more than one memory pool */
			totalChunkCount += (poolCount - 1);
		}
	}

	return totalChunkCount;
}
开发者ID:ChengJin01,项目名称:omr,代码行数:34,代码来源:SweepHeapSectioningSegmented.cpp

示例2:

/**
 * Reset the largest free chunk of all memorySubSpaces to 0.
 */
void
MM_MemorySpace::resetLargestFreeEntry()
{
	MM_MemorySubSpace *currentMemorySubSpace = _memorySubSpaceList;
	while(currentMemorySubSpace) {
		currentMemorySubSpace->resetLargestFreeEntry();
		currentMemorySubSpace = currentMemorySubSpace->getNext();
	}
}
开发者ID:LinHu2016,项目名称:omr,代码行数:12,代码来源:MemorySpace.cpp

示例3: while

/**
 * iterate through memorysubspace list & free up pages of free entries 
 */
uintptr_t
MM_MemorySpace::releaseFreeMemoryPages(MM_EnvironmentBase* env)
{
        uintptr_t releasedMemory = 0;
        MM_MemorySubSpace* memorySubSpace = _memorySubSpaceList;
        while(NULL != memorySubSpace) {
                releasedMemory += memorySubSpace->releaseFreeMemoryPages(env);
                memorySubSpace = memorySubSpace->getNext();
        }
        return releasedMemory;
}
开发者ID:LinHu2016,项目名称:omr,代码行数:14,代码来源:MemorySpace.cpp

示例4:

/**
 * Allocate an arraylet leaf.
 */
void *
MM_SegregatedAllocationInterface::allocateArrayletLeaf(MM_EnvironmentBase *env, MM_AllocateDescription *allocateDescription, MM_MemorySpace *memorySpace, bool shouldCollectOnFailure)
{
	void *result = NULL;
	MM_MemorySubSpace *subSpace = memorySpace->getDefaultMemorySubSpace();
	
	result = subSpace->allocateArrayletLeaf(env, allocateDescription, NULL, NULL, true);

	if ((NULL != result) && !allocateDescription->isCompletedFromTlh()) {
		_stats._allocationBytes += allocateDescription->getContiguousBytes();
		++_stats._allocationCount;
	}

	return result;
}
开发者ID:dinogun,项目名称:omr,代码行数:18,代码来源:SegregatedAllocationInterface.cpp

示例5: defined

void*
MM_SegregatedAllocationInterface::allocateArray(MM_EnvironmentBase *env, MM_AllocateDescription *allocateDescription, MM_MemorySpace *memorySpace, bool shouldCollectOnFailure)
{
	void *result = NULL;
#if defined(OMR_GC_ARRAYLETS)
	MM_MemorySubSpace *subSpace = memorySpace->getDefaultMemorySubSpace();
	
	result = subSpace->allocateObject(env, allocateDescription, NULL, NULL, shouldCollectOnFailure);

	if ((NULL != result) && !allocateDescription->isCompletedFromTlh()) {
		_stats._allocationBytes += allocateDescription->getContiguousBytes();
		++_stats._allocationCount;
	}

#else /* OMR_GC_ARRAYLETS */
	result = allocateObject(env, allocateDescription, memorySpace, shouldCollectOnFailure);
#endif /* OMR_GC_ARRAYLETS */
	return result;
}
开发者ID:dinogun,项目名称:omr,代码行数:19,代码来源:SegregatedAllocationInterface.cpp

示例6: registerMemorySubSpace

bool
MM_MemorySubSpaceFlat::initialize(MM_EnvironmentBase* env)
{
	if (!MM_MemorySubSpace::initialize(env)) {
		return false;
	}

	/* attach the child to the hierarchy */
	registerMemorySubSpace(_memorySubSpace);

#if defined(OMR_GC_MODRON_CONCURRENT_MARK)
	if (env->getExtensions()->concurrentMark) {
		setConcurrentCollectable();

		MM_MemorySubSpace* child = getChildren();
		while (child) {
			child->setConcurrentCollectable();
			child = child->getNext();
		}
	}
#endif /* OMR_GC_MODRON_CONCURRENT_MARK */

	return true;
}
开发者ID:bjornvar,项目名称:omr,代码行数:24,代码来源:MemorySubSpaceFlat.cpp

示例7: getRefreshSize

/**
 * Refresh the TLH.
 */
bool
MM_TLHAllocationSupport::refresh(MM_EnvironmentBase *env, MM_AllocateDescription *allocDescription, bool shouldCollectOnFailure)
{
	MM_GCExtensionsBase* extensions = env->getExtensions();

	/* Refresh the TLH only if the allocation request will fit in half the refresh size
	 * or in the TLH minimum size.
	 */
	uintptr_t sizeInBytesRequired = allocDescription->getContiguousBytes();
	uintptr_t tlhMinimumSize = extensions->tlhMinimumSize;
	uintptr_t tlhMaximumSize = extensions->tlhMaximumSize;
	uintptr_t halfRefreshSize = getRefreshSize() >> 1;
	uintptr_t abandonSize = (tlhMinimumSize > halfRefreshSize ? tlhMinimumSize : halfRefreshSize);
	if (sizeInBytesRequired > abandonSize) {
		/* increase thread hungriness if we did not refresh */
		if (getRefreshSize() < tlhMaximumSize && sizeInBytesRequired < tlhMaximumSize) {
			setRefreshSize(getRefreshSize() + extensions->tlhIncrementSize);
		}
		return false;
	}

	MM_AllocationStats *stats = _objectAllocationInterface->getAllocationStats();

	stats->_tlhDiscardedBytes += getSize();

	/* Try to cache the current TLH */
	if (NULL != getRealAlloc() && getSize() >= tlhMinimumSize) {
		/* Cache the current TLH because it is bigger than the minimum size */
		MM_HeapLinkedFreeHeaderTLH* newCache = (MM_HeapLinkedFreeHeaderTLH*)getRealAlloc();
		newCache->setSize(getSize());
		newCache->_memoryPool = getMemoryPool();
		newCache->_memorySubSpace = getMemorySubSpace();
		newCache->setNext(_abandonedList);
		_abandonedList = newCache;
		++_abandonedListSize;
		if (_abandonedListSize > stats->_tlhMaxAbandonedListSize) {
			stats->_tlhMaxAbandonedListSize = _abandonedListSize;
		}
		wipeTLH(env);
	} else {
		clear(env);
	}

	bool didRefresh = false;
	/* Try allocating a TLH */
	if ((NULL != _abandonedList) && (sizeInBytesRequired <= tlhMinimumSize)) {
		/* Try to get a cached TLH */
		setupTLH(env, (void *)_abandonedList, (void *)_abandonedList->afterEnd(),
				_abandonedList->_memorySubSpace, _abandonedList->_memoryPool);

		_abandonedList = (MM_HeapLinkedFreeHeaderTLH *)_abandonedList->getNext();
		--_abandonedListSize;

#if defined(OMR_GC_BATCH_CLEAR_TLH)
		if (_zeroTLH) {
			if (0 != extensions->batchClearTLH) {
				memset(getBase(), 0, sizeof(MM_HeapLinkedFreeHeaderTLH));
			}
		}
#endif /* OMR_GC_BATCH_CLEAR_TLH */

		allocDescription->setTLHAllocation(true);
		allocDescription->setNurseryAllocation(getMemorySubSpace()->getTypeFlags() == MEMORY_TYPE_NEW);
		allocDescription->setMemoryPool(getMemoryPool());

		stats->_tlhRefreshCountReused += 1;
		stats->_tlhAllocatedReused += getSize();
		stats->_tlhDiscardedBytes -= getSize();

		didRefresh = true;
	} else {
		/* Try allocating a fresh TLH */
		MM_AllocationContext *ac = env->getAllocationContext();
		MM_MemorySpace *memorySpace = _objectAllocationInterface->getOwningEnv()->getMemorySpace();

		if (NULL != ac) {
			/* ensure that we are allowed to use the AI in this configuration in the Tarok case */
			/* allocation contexts currently aren't supported with generational schemes */
			Assert_MM_true(memorySpace->getTenureMemorySubSpace() == memorySpace->getDefaultMemorySubSpace());
			didRefresh = (NULL != ac->allocateTLH(env, allocDescription, _objectAllocationInterface, shouldCollectOnFailure));
		} else {
			MM_MemorySubSpace *subspace = memorySpace->getDefaultMemorySubSpace();
			didRefresh = (NULL != subspace->allocateTLH(env, allocDescription, _objectAllocationInterface, NULL, NULL, shouldCollectOnFailure));
		}

		if (didRefresh) {
#if defined(OMR_GC_BATCH_CLEAR_TLH)
			if (_zeroTLH) {
				if (0 != extensions->batchClearTLH) {
					void *base = getBase();
					void *top = getTop();
					OMRZeroMemory(base, (uintptr_t)top - (uintptr_t)base);
				}
			}
#endif /* defined(OMR_GC_BATCH_CLEAR_TLH) */

			/*
//.........这里部分代码省略.........
开发者ID:bjornvar,项目名称:omr,代码行数:101,代码来源:TLHAllocationSupport.cpp

示例8: payAllocationTax

	MMINLINE void payAllocationTax(MM_EnvironmentBase *env)
	{
		if (0 != _allocationTaxSize) {
			/* alloctor should have set this to point to subspace that spine came from */
			Assert_MM_true(NULL != _memorySubSpace);

			omrthread_t mutator = omrthread_self();
			uintptr_t category = omrthread_get_category(mutator);
			MM_GCExtensionsBase *extensions = env->getExtensions();

			if (extensions->trackMutatorThreadCategory) {
				/* this thread is doing concurrent GC work, charge time spent against the GC category */
				omrthread_set_category(mutator, J9THREAD_CATEGORY_SYSTEM_GC_THREAD, J9THREAD_TYPE_SET_GC);
			}

			_memorySubSpace->payAllocationTax(env, this);

			if (extensions->trackMutatorThreadCategory) {
				/* done doing concurrent GC work, restore the thread category */
				omrthread_set_category(mutator, category, J9THREAD_TYPE_SET_GC);
			}
		}
	}
开发者ID:LinHu2016,项目名称:omr,代码行数:23,代码来源:AllocateDescription.hpp


注:本文中的MM_MemorySubSpace类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。