Skip to content

Commit

Permalink
Merge pull request #5763 from keithc-ca/compress
Browse files Browse the repository at this point in the history
Consolidate tests for whether to compress pointers
  • Loading branch information
mstoodle committed Jan 27, 2021
2 parents a13e13e + 87fcaa3 commit 31da53a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 116 deletions.
14 changes: 1 addition & 13 deletions gc/base/EnvironmentBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,7 @@ class MM_EnvironmentBase : public MM_BaseVirtual
* @return true, if object references are compressed
*/
MMINLINE bool compressObjectReferences() {
#if defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
return (bool)OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES;
#else /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
return _compressObjectReferences;
#endif /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#else /* defined(OMR_GC_FULL_POINTERS) */
return true;
#endif /* defined(OMR_GC_FULL_POINTERS) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
return false;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */
return OMR_COMPRESS_OBJECT_REFERENCES(_compressObjectReferences);
}

/**
Expand Down
14 changes: 1 addition & 13 deletions gc/base/GCExtensionsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,19 +880,7 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
* @return true, if object references are compressed
*/
MMINLINE bool compressObjectReferences() {
#if defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
return (bool)OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES;
#else /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
return _compressObjectReferences;
#endif /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#else /* defined(OMR_GC_FULL_POINTERS) */
return true;
#endif /* defined(OMR_GC_FULL_POINTERS) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
return false;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */
return OMR_COMPRESS_OBJECT_REFERENCES(_compressObjectReferences);
}

MMINLINE uintptr_t getRememberedCount()
Expand Down
14 changes: 1 addition & 13 deletions gc/base/MemoryPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,7 @@ class MM_MemoryPool : public MM_BaseVirtual
* @return true, if object references are compressed
*/
MMINLINE bool const compressObjectReferences() {
#if defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
return (bool)OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES;
#else /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
return _compressObjectReferences;
#endif /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#else /* defined(OMR_GC_FULL_POINTERS) */
return true;
#endif /* defined(OMR_GC_FULL_POINTERS) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
return false;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */
return OMR_COMPRESS_OBJECT_REFERENCES(_compressObjectReferences);
}

/**
Expand Down
14 changes: 1 addition & 13 deletions gc/base/ObjectModelBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,7 @@ class GC_ObjectModelBase : public MM_BaseVirtual
MMINLINE bool
compressObjectReferences()
{
#if defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
return (bool)OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES;
#else /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
return _compressObjectReferences;
#endif /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#else /* defined(OMR_GC_FULL_POINTERS) */
return true;
#endif /* defined(OMR_GC_FULL_POINTERS) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
return false;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */
return OMR_COMPRESS_OBJECT_REFERENCES(_compressObjectReferences);
}

/**
Expand Down
14 changes: 1 addition & 13 deletions gc/base/ObjectScanner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,7 @@ class GC_ObjectScanner : public MM_BaseVirtual
* @return true, if object references are compressed
*/
MMINLINE bool compressObjectReferences() {
#if defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
return (bool)OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES;
#else /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
return _compressObjectReferences;
#endif /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#else /* defined(OMR_GC_FULL_POINTERS) */
return true;
#endif /* defined(OMR_GC_FULL_POINTERS) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
return false;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */
return OMR_COMPRESS_OBJECT_REFERENCES(_compressObjectReferences);
}

/**
Expand Down
14 changes: 1 addition & 13 deletions gc/base/SlotObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,7 @@ class GC_SlotObject
* @return true, if object references are compressed
*/
MMINLINE bool compressObjectReferences() {
#if defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
return (bool)OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES;
#else /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
return _compressObjectReferences;
#endif /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#else /* defined(OMR_GC_FULL_POINTERS) */
return true;
#endif /* defined(OMR_GC_FULL_POINTERS) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
return false;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */
return OMR_COMPRESS_OBJECT_REFERENCES(_compressObjectReferences);
}

/**
Expand Down
14 changes: 1 addition & 13 deletions gc/structs/ForwardedHeader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,19 +255,7 @@ class MM_ForwardedHeader
* @return true, if object references are compressed
*/
MMINLINE bool compressObjectReferences() {
#if defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_FULL_POINTERS)
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
return (bool)OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES;
#else /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
return _compressObjectReferences;
#endif /* defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES) */
#else /* defined(OMR_GC_FULL_POINTERS) */
return true;
#endif /* defined(OMR_GC_FULL_POINTERS) */
#else /* defined(OMR_GC_COMPRESSED_POINTERS) */
return false;
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */
return OMR_COMPRESS_OBJECT_REFERENCES(_compressObjectReferences);
}

#if defined(FORWARDEDHEADER_DEBUG)
Expand Down
38 changes: 13 additions & 25 deletions include_core/omr.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013, 2020 IBM Corp. and others
* Copyright (c) 2013, 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 @@ -158,26 +158,6 @@ typedef struct OMR_VM {
#endif /* defined(OMR_GC_REALTIME) */
} OMR_VM;

#if defined(OMR_GC_COMPRESSED_POINTERS)
#if defined(OMR_GC_FULL_POINTERS)
/* Mixed mode - necessarily 64-bit */
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#define OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM) OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES
#else /* OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES */
#define OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM) (0 != (omrVM)->_compressObjectReferences)
#endif /* OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES */
#define OMRVM_REFERENCE_SHIFT(omrVM) (OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM) ? 2 : 3)
#else /* OMR_GC_FULL_POINTERS */
/* Compressed only - necessarily 64-bit */
#define OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM) TRUE
#define OMRVM_REFERENCE_SHIFT(omrVM) 2
#endif /* OMR_GC_FULL_POINTERS */
#else /* OMR_GC_COMPRESSED_POINTERS */
/* Full only - could be 32 or 64-bit */
#define OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM) FALSE
#define OMRVM_REFERENCE_SHIFT(omrVM) OMR_LOG_POINTER_SIZE
#endif /* OMR_GC_COMPRESSED_POINTERS */

typedef struct OMR_VMThread {
struct OMR_VM *_vm;
uint32_t _sampleStackBackoff;
Expand Down Expand Up @@ -226,22 +206,30 @@ typedef struct OMR_VMThread {
#if defined(OMR_GC_FULL_POINTERS)
/* Mixed mode - necessarily 64-bit */
#if defined(OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#define OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(omrVMThread) OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES
/* Mixed mode - static */
#define OMR_COMPRESS_OBJECT_REFERENCES(dynamicValue) (0 != OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES)
#else /* OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES */
#define OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(omrVMThread) (0 != (omrVMThread)->_compressObjectReferences)
/* Mixed mode - dynamic */
#define OMR_COMPRESS_OBJECT_REFERENCES(dynamicValue) (dynamicValue)
#endif /* OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES */
#define OMRVM_REFERENCE_SHIFT(omrVM) (OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM) ? 2 : 3)
#define OMRVMTHREAD_REFERENCE_SHIFT(omrVMThread) (OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(omrVMThread) ? 2 : 3)
#else /* OMR_GC_FULL_POINTERS */
/* Compressed only - necessarily 64-bit */
#define OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(omrVMThread) TRUE
#define OMRVM_REFERENCE_SHIFT(omrVM) 2
#define OMRVMTHREAD_REFERENCE_SHIFT(omrVMThread) 2
#define OMR_COMPRESS_OBJECT_REFERENCES(dynamicValue) TRUE
#endif /* OMR_GC_FULL_POINTERS */
#else /* OMR_GC_COMPRESSED_POINTERS */
/* Full only - could be 32 or 64-bit */
#define OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(omrVMThread) FALSE
#define OMR_COMPRESS_OBJECT_REFERENCES(dynamicValue) FALSE
#define OMRVM_REFERENCE_SHIFT(omrVM) OMR_LOG_POINTER_SIZE
#define OMRVMTHREAD_REFERENCE_SHIFT(omrVMThread) OMR_LOG_POINTER_SIZE
#endif /* OMR_GC_COMPRESSED_POINTERS */

#define OMRVM_COMPRESS_OBJECT_REFERENCES(omrVM) OMR_COMPRESS_OBJECT_REFERENCES(0 != (omrVM)->_compressObjectReferences)
#define OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(omrVMThread) OMR_COMPRESS_OBJECT_REFERENCES(0 != (omrVMThread)->_compressObjectReferences)

/**
* Perform basic structural initialization of the OMR runtime
* (allocating monitors, etc).
Expand Down

0 comments on commit 31da53a

Please sign in to comment.