Skip to content

Commit

Permalink
Fix DDR field inconsistency in mixed refs builds
Browse files Browse the repository at this point in the history
Remove !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) from
preprocessor guard of _compressObjectReferences field

Make _compressObjectReferences a protected field

Signed-off-by: Sharon Wang <sharon-wang-cpsc@outlook.com>
  • Loading branch information
sharon-wang committed Jan 19, 2021
1 parent f38780c commit 4752253
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 57 deletions.
20 changes: 10 additions & 10 deletions gc/base/EnvironmentBase.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 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 @@ -76,13 +76,13 @@ typedef enum {
class MM_EnvironmentBase : public MM_BaseVirtual
{
private:
#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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
uintptr_t _workerID;
uintptr_t _environmentId;

protected:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
OMR_VM *_omrVM;
OMR_VMThread *_omrVMThread;
OMRPortLibrary *_portLibrary; /**< the port library associated with the environment */
Expand Down Expand Up @@ -675,11 +675,11 @@ class MM_EnvironmentBase : public MM_BaseVirtual
*/
MM_EnvironmentBase(OMR_VMThread *omrVMThread) :
MM_BaseVirtual()
#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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
,_workerID(0)
,_environmentId(0)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
, _compressObjectReferences(OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(omrVMThread))
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
,_omrVM(omrVMThread->_vm)
,_omrVMThread(omrVMThread)
,_portLibrary(omrVMThread->_vm->_runtime->_portLibrary)
Expand Down Expand Up @@ -733,11 +733,11 @@ class MM_EnvironmentBase : public MM_BaseVirtual

MM_EnvironmentBase(OMR_VM *omrVM) :
MM_BaseVirtual()
#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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
,_workerID(0)
,_environmentId(0)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
, _compressObjectReferences(OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM))
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
,_omrVM(omrVM)
,_omrVMThread(NULL)
,_portLibrary(omrVM->_runtime->_portLibrary)
Expand Down
6 changes: 3 additions & 3 deletions gc/base/GCExtensionsBase.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 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 @@ -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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
_compressObjectReferences = env->compressObjectReferences();
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */

_omrVM = env->getOmrVM();

Expand Down
14 changes: 7 additions & 7 deletions gc/base/GCExtensionsBase.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 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 @@ -190,9 +190,6 @@ 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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool _compressObjectReferences;
#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 All @@ -209,6 +206,9 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
#endif /* OMR_GC_MODRON_SCAVENGER */

protected:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
bool _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
OMR_VM* _omrVM;
OMR::GC::Forge _forge;
MM_GlobalCollector* _globalCollector; /**< The global collector for the system */
Expand Down Expand Up @@ -1343,9 +1343,6 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {

MM_GCExtensionsBase()
: MM_BaseVirtual()
#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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#if defined(OMR_GC_MODRON_SCAVENGER)
, _guaranteedNurseryStart(NULL)
, _guaranteedNurseryEnd(NULL)
Expand All @@ -1358,6 +1355,9 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
, concurrentScavengerPageStartAddress((void *)UDATA_MAX)
#endif /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
#endif /* OMR_GC_MODRON_SCAVENGER */
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
, _compressObjectReferences(false)
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
, _omrVM(NULL)
,_forge()
, _globalCollector(NULL)
Expand Down
21 changes: 11 additions & 10 deletions gc/base/MemoryPool.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 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,16 +64,17 @@ class MM_MemoryPool : public MM_BaseVirtual
* Data members
*/
private:
#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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
MM_MemoryPool *_next;
MM_MemoryPool *_previous;
MM_MemoryPool *_children;

const char *_poolName;

protected:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */

MM_MemoryPool *_parent;

MM_MemorySubSpace *_memorySubSpace; /**< Owning memory subspace */
Expand Down Expand Up @@ -368,13 +369,13 @@ 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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
_compressObjectReferences(env->compressObjectReferences()),
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
_next(NULL),
_previous(NULL),
_children(NULL),
_poolName("Unknown"),
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
_compressObjectReferences(env->compressObjectReferences()),
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
_parent(NULL),
_memorySubSpace(NULL),
_minimumFreeEntrySize(minimumFreeEntrySize),
Expand All @@ -400,13 +401,13 @@ 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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
_compressObjectReferences(env->compressObjectReferences()),
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
_next(NULL),
_previous(NULL),
_children(NULL),
_poolName(name),
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
_compressObjectReferences(env->compressObjectReferences()),
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
_parent(NULL),
_memorySubSpace(NULL),
_minimumFreeEntrySize(minimumFreeEntrySize),
Expand Down
12 changes: 6 additions & 6 deletions gc/base/ObjectModelBase.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 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 @@ -61,12 +61,12 @@ class GC_ObjectModelBase : public MM_BaseVirtual
* Member data and types
*/
private:
#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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
GC_ObjectModelDelegate _delegate; /**< instance of object model delegate class */

protected:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
bool _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
uintptr_t _objectAlignmentInBytes; /**< cached copy of heap object alignment factor, in bytes */
uintptr_t _objectAlignmentShift; /**< cached copy of heap object alignment shift, must be log2(_objectAlignmentInBytes) */

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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
_compressObjectReferences = OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM);
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
_objectAlignmentInBytes = OMR_MAX((uintptr_t)1 << omrVM->_compressedPointersShift, OMR_MINIMUM_OBJECT_ALIGNMENT);
_objectAlignmentShift = OMR_MAX(omrVM->_compressedPointersShift, OMR_MINIMUM_OBJECT_ALIGNMENT_SHIFT);

Expand Down
12 changes: 6 additions & 6 deletions gc/base/ObjectScanner.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2020 IBM Corp. and others
* Copyright (c) 2015, 2021 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 @@ -62,10 +62,10 @@ 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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */

public:
/**
* Instantiation flags used to specialize scanner for specific scavenger operations
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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
, _compressObjectReferences(env->compressObjectReferences())
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
{
_typeId = __FUNCTION__;
}
Expand Down
16 changes: 8 additions & 8 deletions gc/base/SlotObject.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 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 @@ -36,14 +36,14 @@ class GC_SlotObject
{
private:
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)
#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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool _compressObjectReferences;
#endif /* defined (OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */

protected:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
public:

private:
Expand Down Expand Up @@ -252,9 +252,9 @@ class GC_SlotObject
: _slot(slot)
#if defined (OMR_GC_COMPRESSED_POINTERS)
, _compressedPointersShift(omrVM->_compressedPointersShift)
#if defined (OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#if defined (OMR_GC_FULL_POINTERS)
, _compressObjectReferences(OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM))
#endif /* defined (OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined (OMR_GC_FULL_POINTERS) */
#endif /* defined (OMR_GC_COMPRESSED_POINTERS) */
{}
};
Expand Down
16 changes: 9 additions & 7 deletions gc/structs/ForwardedHeader.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2020 IBM Corp. and others
* Copyright (c) 2015, 2021 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 @@ -77,13 +77,10 @@ class MM_ForwardedHeader
* Data members
*/
public:
protected:

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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
bool const _compressObjectReferences;
#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 All @@ -96,6 +93,11 @@ class MM_ForwardedHeader
static const uintptr_t _minIncrement = (131072 & _remainingSizeMask); /**< min size of copy section; does not have to be a power of 2, but it has to be aligned with _copySizeAlignement */
#endif /* OMR_GC_CONCURRENT_SCAVENGER */

protected:
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
bool const _compressObjectReferences;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */

/*
* Function members
*/
Expand Down Expand Up @@ -548,9 +550,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) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#if defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS)
, _compressObjectReferences(compressed)
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) && !defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) && defined(OMR_GC_FULL_POINTERS) */
{
}

Expand Down

0 comments on commit 4752253

Please sign in to comment.