本文整理汇总了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);
}
}
}
}
}
示例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;
}