Skip to content

Commit

Permalink
Remove uses of OMR_INTERP_COMPRESSED_OBJECT_HEADER
Browse files Browse the repository at this point in the history
Replace with OMR_GC_COMPRESSED_POINTERS. In every build, either both or
neither the flags are set. Removal of the flag definitions will follow
later.

[ci skip]

Signed-off-by: Graham Chapman <graham_chapman@ca.ibm.com>
  • Loading branch information
gacholio committed Apr 10, 2019
1 parent 2abc34c commit 7b85a65
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 69 deletions.
4 changes: 2 additions & 2 deletions example/glue/Object.hpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2018 IBM Corp. and others
* Copyright (c) 2018, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -30,7 +30,7 @@

typedef uint8_t ObjectFlags;

#if defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined(OMR_GC_COMPRESSED_POINTERS)
typedef uint32_t RawObjectHeader;
typedef uint32_t ObjectSize;
#else
Expand Down
8 changes: 4 additions & 4 deletions example/glue/ScavengerDelegate.cpp
Expand Up @@ -175,16 +175,16 @@ MM_ScavengerDelegate::reverseForwardedObject(MM_EnvironmentBase *env, MM_Forward
(ObjectSize)objectModel->getConsumedSizeInBytesWithHeader(forwardedObject),
(uint8_t)objectModel->getObjectFlags(forwardedObject));

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
/* Restore destroyed overlapped slot in the original object. This slot might need to be reversed
* as well or it may be already reversed - such fixup will be completed at in a later pass.
*/
forwardedHeader->restoreDestroyedOverlap();
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
}
}

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
void
MM_ScavengerDelegate::fixupDestroyedSlot(MM_EnvironmentBase *env, MM_ForwardedHeader *forwardedHeader, MM_MemorySubSpaceSemiSpace *subSpaceNew)
{
Expand Down Expand Up @@ -217,6 +217,6 @@ MM_ScavengerDelegate::fixupDestroyedSlot(MM_EnvironmentBase *env, MM_ForwardedHe
}
}
}
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */

#endif /* defined(OMR_GC_MODRON_SCAVENGER) */
4 changes: 2 additions & 2 deletions example/glue/ScavengerDelegate.hpp
Expand Up @@ -211,7 +211,7 @@ class MM_ScavengerDelegate : public MM_BaseVirtual {
*/
void reverseForwardedObject(MM_EnvironmentBase *env, MM_ForwardedHeader *forwardedObject);

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
/**
* This method is similar to reverseForwardedObject() but is called from a different context. The implementation
* must first determine whether or not the compressed slot adjacent to the scavenger forwarding slot may contain an object
Expand All @@ -229,7 +229,7 @@ class MM_ScavengerDelegate : public MM_BaseVirtual {
* @param[in] subSpaceNew Pointer to new space
*/
void fixupDestroyedSlot(MM_EnvironmentBase *env, MM_ForwardedHeader *forwardedObject, MM_MemorySubSpaceSemiSpace *subSpaceNew);
#endif /* OMR_INTERP_COMPRESSED_OBJECT_HEADER */
#endif /* OMR_GC_COMPRESSED_POINTERS */

#if defined(OMR_GC_CONCURRENT_SCAVENGER)
/**
Expand Down
4 changes: 2 additions & 2 deletions gc/base/HeapLinkedFreeHeader.hpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2018 IBM Corp. and others
* Copyright (c) 1991, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -30,7 +30,7 @@
#include"AtomicOperations.hpp"

/* Split pointer for all compressed platforms */
#if defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined(OMR_GC_COMPRESSED_POINTERS)
#define SPLIT_NEXT_POINTER
#endif

Expand Down
26 changes: 13 additions & 13 deletions gc/base/ObjectModelBase.hpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2018 IBM Corp. and others
* Copyright (c) 1991, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -487,11 +487,11 @@ class GC_ObjectModelBase : public MM_BaseVirtual
break;
}
}
#if defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined(OMR_GC_COMPRESSED_POINTERS)
while (oldFlags != MM_AtomicOperations::lockCompareExchangeU32(flagsPtr, oldFlags, newFlags));
#else /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
while (oldFlags != MM_AtomicOperations::lockCompareExchange(flagsPtr, (uintptr_t)oldFlags, (uintptr_t)newFlags));
#endif /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */

return result;
}
Expand Down Expand Up @@ -589,11 +589,11 @@ class GC_ObjectModelBase : public MM_BaseVirtual
break;
}
}
#if defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined(OMR_GC_COMPRESSED_POINTERS)
while (oldFlags != MM_AtomicOperations::lockCompareExchangeU32(flagsPtr, oldFlags, newFlags));
#else /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
while (oldFlags != MM_AtomicOperations::lockCompareExchange(flagsPtr, (uintptr_t)oldFlags, (uintptr_t)newFlags));
#endif /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */

return result;
}
Expand Down Expand Up @@ -633,11 +633,11 @@ class GC_ObjectModelBase : public MM_BaseVirtual
break;
}
}
#if defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined(OMR_GC_COMPRESSED_POINTERS)
while (oldFlags != MM_AtomicOperations::lockCompareExchangeU32(flagsPtr, oldFlags, newFlags));
#else /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
while (oldFlags != MM_AtomicOperations::lockCompareExchange(flagsPtr, (uintptr_t)oldFlags, (uintptr_t)newFlags));
#endif /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */

/* check to verify that this thread and no other thread atomically set flags -> toState */
return result ? (0 == (oldFlags & rememberedMask)) : false;
Expand Down Expand Up @@ -677,11 +677,11 @@ class GC_ObjectModelBase : public MM_BaseVirtual
}
newFlags = (oldFlags & ~rememberedMask) | to;
}
#if defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined(OMR_GC_COMPRESSED_POINTERS)
while (oldFlags != MM_AtomicOperations::lockCompareExchangeU32(flagsPtr, oldFlags, newFlags));
#else /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
while (oldFlags != MM_AtomicOperations::lockCompareExchange(flagsPtr, (uintptr_t)oldFlags, (uintptr_t)newFlags));
#endif /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */

return result;
}
Expand Down
4 changes: 2 additions & 2 deletions gc/base/standard/Scavenger.cpp
Expand Up @@ -3416,7 +3416,7 @@ MM_Scavenger::backoutFixupAndReverseForwardPointersInSurvivor(MM_EnvironmentStan
}
}

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
GC_MemorySubSpaceRegionIteratorStandard evacuateRegionIterator1(_activeSubSpace);
while(NULL != (rootRegion = evacuateRegionIterator1.nextRegion())) {
if (isObjectInEvacuateMemory((omrobjectptr_t )rootRegion->getLowAddress())) {
Expand Down Expand Up @@ -3446,7 +3446,7 @@ MM_Scavenger::backoutFixupAndReverseForwardPointersInSurvivor(MM_EnvironmentStan
}
}
}
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
}

#if defined(OMR_GC_CONCURRENT_SCAVENGER)
Expand Down
26 changes: 13 additions & 13 deletions gc/structs/ForwardedHeader.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2018 IBM Corp. and others
* Copyright (c) 2015, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -41,11 +41,11 @@ MM_ForwardedHeader::Assert(bool condition, const char *assertion, const char *fi
void
MM_ForwardedHeader::ForwardedHeaderDump(omrobjectptr_t destinationObjectPtr)
{
#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
fprintf(stderr, "MM_ForwardedHeader@%p[%p(%p):%x:%x] -> %p(%p)\n", this, _objectPtr, (uintptr_t*)(*_objectPtr), _preserved.slot, _preserved.overlap, destinationObjectPtr, (uintptr_t*)(*destinationObjectPtr));
#else /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#else /* defined (OMR_GC_COMPRESSED_POINTERS) */
fprintf(stderr, "MM_ForwardedHeader@%p[%p(%p):%x] -> %p(%p)\n", this, _objectPtr, (uintptr_t*)(*_objectPtr), _preserved.slot, destinationObjectPtr, (uintptr_t*)(*destinationObjectPtr));
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
}
#endif /* defined(FORWARDEDHEADER_DEBUG) */

Expand All @@ -66,13 +66,13 @@ MM_ForwardedHeader::setForwardedObjectInternal(omrobjectptr_t destinationObjectP
uintptr_t oldValue = *(uintptr_t *)&_preserved.slot;

/* Forwarded tag should be in low bits of the pointer and at the same time be in forwarding slot */
#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN)
#if defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN)
/* To get it for compressed big endian just swap halves of pointer */
uintptr_t newValue = (((uintptr_t)destinationObjectPtr | forwardedTag) << 32) | (((uintptr_t)destinationObjectPtr >> 32) & 0xffffffff);
#else /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN) */
#else /* defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN) */
/* For little endian or not compressed write uintptr_t bytes straight */
uintptr_t newValue = (uintptr_t)destinationObjectPtr | forwardedTag;
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN) */

if (MM_AtomicOperations::lockCompareExchange((volatile uintptr_t*)&objectHeader->slot, oldValue, newValue) != oldValue) {
/* If we lost forwarding it, return where we are really forwarded. Another thread could raced us to forward on another location
Expand Down Expand Up @@ -102,15 +102,15 @@ MM_ForwardedHeader::getForwardedObject()
uintptr_t forwardedTag = _forwardedTag;
if (isForwardedPointer()) {
#endif
#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN)
#if defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN)
/* Compressed big endian - read two halves separately */
uint32_t hi = (uint32_t)_preserved.overlap;
uint32_t lo = (uint32_t)_preserved.slot & ~forwardedTag;
uintptr_t restoredForwardingSlotValue = (((uintptr_t)hi) <<32 ) | ((uintptr_t)lo);
#else /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN) */
#else /* defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN) */
/* Little endian or not compressed - read all uintptr_t bytes at once */
uintptr_t restoredForwardingSlotValue = *(uintptr_t *)(&_preserved.slot) & ~forwardedTag;
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN) */

forwardedObject = (omrobjectptr_t)(restoredForwardingSlotValue);
}
Expand All @@ -131,15 +131,15 @@ MM_ForwardedHeader::getNonStrictForwardedObject()
uintptr_t forwardedTag = _forwardedTag;
if (isForwardedPointer()) {
#endif /* OMR_GC_CONCURRENT_SCAVENGER */
#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN)
#if defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN)
/* Compressed big endian - read two halves separately */
uint32_t hi = (uint32_t)_preserved.overlap;
uint32_t lo = (uint32_t)_preserved.slot & ~forwardedTag;
uintptr_t restoredForwardingSlotValue = (((uintptr_t)hi) <<32 ) | ((uintptr_t)lo);
#else /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN) */
#else /* defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN) */
/* Little endian or not compressed - read all uintptr_t bytes at once */
uintptr_t restoredForwardingSlotValue = *(uintptr_t *)(&_preserved.slot) & ~forwardedTag;
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) && !defined(OMR_ENV_LITTLE_ENDIAN) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) && !defined(OMR_ENV_LITTLE_ENDIAN) */

forwardedObject = (omrobjectptr_t)(restoredForwardingSlotValue);
}
Expand Down
28 changes: 14 additions & 14 deletions gc/structs/ForwardedHeader.hpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2018 IBM Corp. and others
* Copyright (c) 2015, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -33,9 +33,9 @@
#include "HeapLinkedFreeHeader.hpp"


#if defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) != defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) != defined(OMR_GC_COMPRESSED_POINTERS)
#error "MutableHeaderFields requires sizeof(fomrobject_t) == sizeof(j9objectclass_t)"
#endif /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) != defined(OMR_GC_COMPRESSED_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) != defined(OMR_GC_COMPRESSED_POINTERS) */

/* Source object header bits */
#define OMR_FORWARDED_TAG 4
Expand Down Expand Up @@ -97,10 +97,10 @@ class MM_ForwardedHeader
/* first slot must be always aligned as for an object slot */
fomrobject_t slot;

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
/* this field must be here to reserve space if slots are 4 bytes long (extend to 8 bytes starting from &MutableHeaderFields.clazz) */
uint32_t overlap;
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
};

omrobjectptr_t _objectPtr; /**< the object on which to act */
Expand All @@ -124,11 +124,11 @@ class MM_ForwardedHeader
MMINLINE_DEBUG static fomrobject_t
lockCompareExchangeObjectHeader(volatile fomrobject_t *address, fomrobject_t oldValue, fomrobject_t newValue)
{
#if defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined(OMR_GC_COMPRESSED_POINTERS)
return MM_AtomicOperations::lockCompareExchangeU32((volatile uint32_t*)address, oldValue, newValue);
#else /* OMR_INTERP_COMPRESSED_OBJECT_HEADER */
#else /* OMR_GC_COMPRESSED_POINTERS */
return MM_AtomicOperations::lockCompareExchange((volatile uintptr_t*)address, oldValue, newValue);
#endif /* OMR_INTERP_COMPRESSED_OBJECT_HEADER */
#endif /* OMR_GC_COMPRESSED_POINTERS */
}

/**
Expand Down Expand Up @@ -253,9 +253,9 @@ class MM_ForwardedHeader
/* copy preserved flags, and keep the rest (which should be all 0s) */
newHeader->slot = (_preserved.slot & ~_copyProgressInfoMask) | _beingCopiedTag;

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
newHeader->overlap = _preserved.overlap;
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
}

/**
Expand Down Expand Up @@ -333,7 +333,7 @@ class MM_ForwardedHeader
return _preserved.slot;
}

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
/**
* This method will assert if the object has been forwarded. Use isForwardedPointer() to test before calling.
*
Expand Down Expand Up @@ -368,7 +368,7 @@ class MM_ForwardedHeader
{
restoreDestroyedOverlap(((MutableHeaderFields *)((fomrobject_t *)getForwardedObject() + _forwardingSlotOffset))->overlap);
}
#endif /* defined(OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */

/**
* Update the new version of this object after it has been copied. This undoes any damaged caused
Expand All @@ -384,9 +384,9 @@ class MM_ForwardedHeader
{
MutableHeaderFields* newHeader = (MutableHeaderFields *)((fomrobject_t *)destinationObjectPtr + _forwardingSlotOffset);
newHeader->slot = _preserved.slot;
#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
newHeader->overlap = _preserved.overlap;
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
}

/**
Expand Down
4 changes: 2 additions & 2 deletions glue/ScavengerDelegate.cpp
Expand Up @@ -156,7 +156,7 @@ MM_ScavengerDelegate::reverseForwardedObject(MM_EnvironmentBase *env, MM_Forward
*/
}

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
void
MM_ScavengerDelegate::fixupDestroyedSlot(MM_EnvironmentBase *env, MM_ForwardedHeader *forwardedHeader, MM_MemorySubSpaceSemiSpace *subSpaceNew)
{
Expand All @@ -166,5 +166,5 @@ MM_ScavengerDelegate::fixupDestroyedSlot(MM_EnvironmentBase *env, MM_ForwardedHe
*/
Assert_MM_unimplemented();
}
#endif /* defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
#endif /* defined(OMR_GC_MODRON_SCAVENGER) */
4 changes: 2 additions & 2 deletions glue/ScavengerDelegate.hpp
Expand Up @@ -209,7 +209,7 @@ class MM_ScavengerDelegate : public MM_BaseVirtual {
*/
void reverseForwardedObject(MM_EnvironmentBase *env, MM_ForwardedHeader *forwardedObject);

#if defined (OMR_INTERP_COMPRESSED_OBJECT_HEADER)
#if defined (OMR_GC_COMPRESSED_POINTERS)
/**
* This method is similar to reverseForwardedObject() but is called from a different context. The implementation
* must first determine whether or not the compressed slot adjacent to the scavenger forwarding slot may contain an object
Expand All @@ -227,7 +227,7 @@ class MM_ScavengerDelegate : public MM_BaseVirtual {
* @param[in] subSpaceNew Pointer to new space
*/
void fixupDestroyedSlot(MM_EnvironmentBase *env, MM_ForwardedHeader *forwardedObject, MM_MemorySubSpaceSemiSpace *subSpaceNew);
#endif /* OMR_INTERP_COMPRESSED_OBJECT_HEADER */
#endif /* OMR_GC_COMPRESSED_POINTERS */

#if defined(OMR_GC_CONCURRENT_SCAVENGER)
/**
Expand Down

0 comments on commit 7b85a65

Please sign in to comment.