Skip to content

Commit

Permalink
Set _compressObjectReferences if mixed build override not defined
Browse files Browse the repository at this point in the history
`_compressObjectReferences` should only be defined if
`OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES` is not defined.
Otherwise, when mixed mode is enabled and the override is defined,
`_compressObjectReferences` is considered a private field that is
declared, but never used, which the compiler may complain about.

Signed-off-by: Sharon Wang <sharon-wang-cpsc@outlook.com>
  • Loading branch information
sharon-wang committed Nov 18, 2020
1 parent 70484c4 commit 61a4993
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions gc/base/EnvironmentBase.hpp
Expand Up @@ -76,9 +76,9 @@ typedef enum {
class MM_EnvironmentBase : public MM_BaseVirtual
{
private:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
uintptr_t _workerID;
uintptr_t _environmentId;

Expand Down Expand Up @@ -675,9 +675,9 @@ class MM_EnvironmentBase : public MM_BaseVirtual
*/
MM_EnvironmentBase(OMR_VMThread *omrVMThread) :
MM_BaseVirtual()
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
, _compressObjectReferences(OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(omrVMThread))
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
,_workerID(0)
,_environmentId(0)
,_omrVM(omrVMThread->_vm)
Expand Down Expand Up @@ -733,9 +733,9 @@ class MM_EnvironmentBase : public MM_BaseVirtual

MM_EnvironmentBase(OMR_VM *omrVM) :
MM_BaseVirtual()
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
, _compressObjectReferences(OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM))
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
,_workerID(0)
,_environmentId(0)
,_omrVM(omrVM)
Expand Down
4 changes: 2 additions & 2 deletions gc/base/GCExtensionsBase.cpp
Expand Up @@ -68,9 +68,9 @@ MM_GCExtensionsBase::initialize(MM_EnvironmentBase* env)
uintptr_t *pageSizes = NULL;
uintptr_t *pageFlags = NULL;

#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
_compressObjectReferences = env->compressObjectReferences();
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */

_omrVM = env->getOmrVM();

Expand Down
8 changes: 4 additions & 4 deletions gc/base/GCExtensionsBase.hpp
Expand Up @@ -190,9 +190,9 @@ class MM_ConfigurationOptions : public MM_BaseNonVirtual
class MM_GCExtensionsBase : public MM_BaseVirtual {
/* Data Members */
private:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#if defined(OMR_GC_MODRON_SCAVENGER)
void* _guaranteedNurseryStart; /**< lowest address guaranteed to be in the nursery */
void* _guaranteedNurseryEnd; /**< highest address guaranteed to be in the nursery */
Expand Down Expand Up @@ -1343,9 +1343,9 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {

MM_GCExtensionsBase()
: MM_BaseVirtual()
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
, _compressObjectReferences(false)
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#if defined(OMR_GC_MODRON_SCAVENGER)
, _guaranteedNurseryStart(NULL)
, _guaranteedNurseryEnd(NULL)
Expand Down
14 changes: 7 additions & 7 deletions gc/base/MemoryPool.hpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2015 IBM Corp. and others
* Copyright (c) 1991, 2020 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 @@ -64,9 +64,9 @@ class MM_MemoryPool : public MM_BaseVirtual
* Data members
*/
private:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
MM_MemoryPool *_next;
MM_MemoryPool *_previous;
MM_MemoryPool *_children;
Expand Down Expand Up @@ -368,9 +368,9 @@ class MM_MemoryPool : public MM_BaseVirtual
*/
MM_MemoryPool(MM_EnvironmentBase *env, uintptr_t minimumFreeEntrySize) :
MM_BaseVirtual(),
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
_compressObjectReferences(env->compressObjectReferences()),
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
_next(NULL),
_previous(NULL),
_children(NULL),
Expand Down Expand Up @@ -400,9 +400,9 @@ class MM_MemoryPool : public MM_BaseVirtual
*/
MM_MemoryPool(MM_EnvironmentBase *env, uintptr_t minimumFreeEntrySize, const char *name) :
MM_BaseVirtual(),
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
_compressObjectReferences(env->compressObjectReferences()),
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
_next(NULL),
_previous(NULL),
_children(NULL),
Expand Down
8 changes: 4 additions & 4 deletions gc/base/ObjectModelBase.hpp
Expand Up @@ -61,9 +61,9 @@ class GC_ObjectModelBase : public MM_BaseVirtual
* Member data and types
*/
private:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
GC_ObjectModelDelegate _delegate; /**< instance of object model delegate class */

protected:
Expand Down Expand Up @@ -330,9 +330,9 @@ class GC_ObjectModelBase : public MM_BaseVirtual
MMINLINE void
setObjectAlignment(OMR_VM *omrVM)
{
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
_compressObjectReferences = OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM);
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
_objectAlignmentInBytes = OMR_MAX((uintptr_t)1 << omrVM->_compressedPointersShift, OMR_MINIMUM_OBJECT_ALIGNMENT);
_objectAlignmentShift = OMR_MAX(omrVM->_compressedPointersShift, OMR_MINIMUM_OBJECT_ALIGNMENT_SHIFT);

Expand Down
8 changes: 4 additions & 4 deletions gc/base/ObjectScanner.hpp
Expand Up @@ -62,9 +62,9 @@ class GC_ObjectScanner : public MM_BaseVirtual
fomrobject_t *_scanPtr; /**< Pointer to base of object slots mapped by current _scanMap */
GC_SlotObject _slotObject; /**< Create own SlotObject class to provide output */
uintptr_t _flags; /**< Scavenger context flags (scanRoots, scanHeap, ...) */
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */

public:
/**
Expand Down Expand Up @@ -104,9 +104,9 @@ class GC_ObjectScanner : public MM_BaseVirtual
, _scanPtr(scanPtr)
, _slotObject(env->getOmrVM(), NULL)
, _flags(flags | headObjectScanner)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
, _compressObjectReferences(env->compressObjectReferences())
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
{
_typeId = __FUNCTION__;
}
Expand Down
12 changes: 6 additions & 6 deletions gc/base/SlotObject.hpp
Expand Up @@ -38,10 +38,10 @@ class GC_SlotObject
volatile fomrobject_t* _slot; /**< stored slot address (volatile, because in concurrent GC the mutator can change the value in _slot) */
#if defined (OMR_GC_COMPRESSED_POINTERS)
uintptr_t _compressedPointersShift; /**< the number of bits to shift by when converting between the compressed pointers heap and real heap */
#if defined (OMR_GC_FULL_POINTERS)
#if defined (OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool _compressObjectReferences;
#endif /* OMR_GC_FULL_POINTERS */
#endif /* OMR_GC_COMPRESSED_POINTERS */
#endif /* defined (OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */

protected:
public:
Expand Down Expand Up @@ -252,10 +252,10 @@ class GC_SlotObject
: _slot(slot)
#if defined (OMR_GC_COMPRESSED_POINTERS)
, _compressedPointersShift(omrVM->_compressedPointersShift)
#if defined (OMR_GC_FULL_POINTERS)
#if defined (OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
, _compressObjectReferences(OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM))
#endif /* OMR_GC_FULL_POINTERS */
#endif /* OMR_GC_COMPRESSED_POINTERS */
#endif /* defined (OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
{}
};
#endif /* SLOTOBJECT_HPP_ */
8 changes: 4 additions & 4 deletions gc/structs/ForwardedHeader.hpp
Expand Up @@ -81,9 +81,9 @@ class MM_ForwardedHeader
private:
omrobjectptr_t _objectPtr; /**< the object on which to act */
uintptr_t _preserved; /**< a backup copy of the header fields which may be modified by this class */
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */

static const uintptr_t _forwardedTag = OMR_FORWARDED_TAG; /**< bit mask used to mark forwarding slot value as forwarding pointer */
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
Expand Down Expand Up @@ -548,9 +548,9 @@ class MM_ForwardedHeader
MM_ForwardedHeader(omrobjectptr_t objectPtr, bool compressed)
: _objectPtr(objectPtr)
, _preserved(*(volatile uintptr_t *)_objectPtr)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
, _compressObjectReferences(compressed)
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
{
}

Expand Down

0 comments on commit 61a4993

Please sign in to comment.