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


C++ MM_GCExtensionsBase::getObjectAlignmentInBytes方法代码示例

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


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

示例1: preservedSlotObject

void
MM_CollectorLanguageInterfaceImpl::scavenger_fixupDestroyedSlot(MM_EnvironmentBase *env, MM_ForwardedHeader *forwardedHeader, MM_MemorySubSpaceSemiSpace *subSpaceNew)
{
	/* This method must be implemented if (and only if) the object header is stored in a compressed slot. in that
	 * case the other half of the full (omrobjectptr_t sized) slot may hold a compressed object reference that
	 * must be restored by this method.
	 */
	/* This assumes that all slots are object slots, including the slot adjacent to the header slot */
	if ((0 != forwardedHeader->getPreservedOverlap()) && !_extensions->objectModel.isIndexable(forwardedHeader)) {
		MM_GCExtensionsBase *extensions = MM_GCExtensionsBase::getExtensions(_omrVM);
		/* Get the uncompressed reference from the slot */
		fomrobject_t preservedOverlap = (fomrobject_t)forwardedHeader->getPreservedOverlap();
		GC_SlotObject preservedSlotObject(_omrVM, &preservedOverlap);
		omrobjectptr_t survivingCopyAddress = preservedSlotObject.readReferenceFromSlot();
		/* Check if the address we want to read is aligned (since mis-aligned reads may still be less than a top address but extend beyond it) */
		if (0 == ((uintptr_t)survivingCopyAddress & (extensions->getObjectAlignmentInBytes() - 1))) {
			/* Ensure that the address we want to read is within part of the heap which could contain copied objects (tenure or survivor) */
			void *topOfObject = (void *)((uintptr_t *)survivingCopyAddress + 1);
			if (subSpaceNew->isObjectInNewSpace(survivingCopyAddress, topOfObject) || extensions->isOld(survivingCopyAddress, topOfObject)) {
				/* if the slot points to a reverse-forwarded object, restore the original location (in evacuate space) */
				MM_ForwardedHeader reverseForwardedHeader(survivingCopyAddress);
				if (reverseForwardedHeader.isReverseForwardedPointer()) {
					/* overlapped slot must be fixed up */
					fomrobject_t fixupSlot = 0;
					GC_SlotObject fixupSlotObject(_omrVM, &fixupSlot);
					fixupSlotObject.writeReferenceToSlot(reverseForwardedHeader.getReverseForwardedPointer());
					forwardedHeader->restoreDestroyedOverlap((uint32_t)fixupSlot);
				}
			}
		}
	}
}
开发者ID:dinogun,项目名称:omr,代码行数:32,代码来源:CollectorLanguageInterfaceImpl.cpp

示例2: isCommittedHeapObject

	MMINLINE bool
	isValidObject(omrobjectptr_t objectPtr)
	{
		bool shouldCheck = isCommittedHeapObject(objectPtr) && OMR_ARE_NO_BITS_SET((uintptr_t)objectPtr, _extensions->getObjectAlignmentInBytes() - 1);
		if (shouldCheck) {
			return _objectMap->isBitSet(objectPtr);
		}
		/* Everything else is not a valid object. */
		return false;
	}
开发者ID:LinHu2016,项目名称:omr,代码行数:10,代码来源:ObjectMap.hpp


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