Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace J9VM_MODRON_SCAVENGER_CACHE_* to OMR_COPYSCAN_CACHE_* #16820

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

dmitripivkine
Copy link
Contributor

@dmitripivkine dmitripivkine commented Mar 3, 2023

This is non-functional change: Remove usage of J9VM_MODRON_SCAVENGER_CACHE_* defined names, use new OMR_COPYSCAN_CACHE_* defined names instead.

Depends on eclipse/omr#6921.

@@ -52,7 +52,7 @@ class MM_CopyScanCacheVLHGC : public MM_CopyScanCache
UDATA _objectSize; /**< sum of objects sizes copied to this copy cache */
U_64 _lowerAgeBound; /**< lowest possible age of any object in this copy cache */
U_64 _upperAgeBound; /**< highest possible age of any object in this copy cache */
UDATA _arraySplitIndex; /**< The index within the array in scanCurrent to start scanning from (meaningful is J9VM_MODRON_SCAVENGER_CACHE_TYPE_SPLIT_ARRAY is set) */
UDATA _arraySplitIndex; /**< The index within the array in scanCurrent to start scanning from (meaningful is OMR_SCAVENGER_CACHE_TYPE_SPLIT_ARRAY is set) */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While touching this, I recommend to replace UDATA with uintptr_t, and similar ones, too. Base MM_CopyScanCache already uses uintptr_t.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for other smaller files you touched

@@ -143,7 +143,7 @@ MM_CopyScanCacheListVLHGC::removeAllHeapAllocatedChunks(MM_EnvironmentVLHGC *env
MM_CopyScanCacheVLHGC *cache = cacheList->_cacheHead;

while(cache != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to fix some formatting too, in nearby code - missing spacing between 'while' and '('

@@ -31,9 +31,9 @@
UDATA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed this one

if(0 == (cache->flags & J9VM_MODRON_SCAVENGER_CACHE_TYPE_COPY)) {
if(0 == (cache->flags & J9VM_MODRON_SCAVENGER_CACHE_TYPE_CLEARED)) {
if(0 == (cache->flags & OMR_SCAVENGER_CACHE_TYPE_COPY)) {
if(0 == (cache->flags & OMR_SCAVENGER_CACHE_TYPE_CLEARED)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after 'if'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it should use OMR_ARE_NO_BITS_SET().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it should use OMR_ARE_NO_BITS_SET().

Bit functions like this are not used in GC code. I am not sure we should start to use them now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are even used in this file, see line 2622, for example.

Copy link
Contributor

@amicic amicic Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already stated our current view on when to use these macros in a previous comment (#16820 (comment)) and you said you'd respect that.

The example you refer to now fits within VM flags, while this PR deals with a GC specific flag.

Being unified within a file is also important, but of a secondary priority (relative to the criteria I mentioned)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still disappointed, but I did say that.

@@ -2906,7 +2906,7 @@ MM_CopyForwardScheme::bestCacheForScanning(MM_CopyScanCacheVLHGC* copyCache, MM_
if (!copyCache->isScanWorkAvailable()) {
return false;
}
if (!((*scanCache)->flags & J9VM_MODRON_SCAVENGER_CACHE_TYPE_COPY)) {
if (!((*scanCache)->flags & OMR_SCAVENGER_CACHE_TYPE_COPY)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably not a style that conforms with coding standard.
we should compare it with 0 (which Scavenger.cpp) uses, or even use some of bitwise macros (common in core VM code, but no so in GC)

Copy link
Contributor

@keithc-ca keithc-ca Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests like this should use OMR_ARE_NO_BITS_SET().

@@ -3266,7 +3266,7 @@ MM_CopyForwardScheme::incrementalScanCacheBySlot(MM_EnvironmentVLHGC *env)
* if deferred cache is occupied, then queue current scan cache on scan list
*/
scanCache->clearCurrentlyBeingScanned();
if (!(scanCache->flags & J9VM_MODRON_SCAVENGER_CACHE_TYPE_COPY)) {
if (!(scanCache->flags & OMR_SCAVENGER_CACHE_TYPE_COPY)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another one that should compare with 0, rather than treating as a bool

return false;
}

memset((void *)_reservedRegionList, 0, sizeof(MM_ReservedRegionListHeader) * _compactGroupMaxCount);
for(UDATA index = 0; index < _compactGroupMaxCount; index++) {
for (UDATA index = 0; index < _compactGroupMaxCount; index++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, now that you fixed spacing in this huge file (which I did not expect), you could go and fix UDATA, too :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I afraid such update might hide original change, Spaces can be filtered out from view. I suggest to do update of types in separate PR

@dmitripivkine dmitripivkine changed the title Replace J9VM_MODRON_SCAVENGER_CACHE_* to OMR_SCAVENGER_CACHE_* Replace J9VM_MODRON_SCAVENGER_CACHE_* to OMR_COPYSCAN_CACHE_* Mar 8, 2023
@dmitripivkine dmitripivkine changed the title Replace J9VM_MODRON_SCAVENGER_CACHE_* to OMR_COPYSCAN_CACHE_* WIP:Replace J9VM_MODRON_SCAVENGER_CACHE_* to OMR_COPYSCAN_CACHE_* Mar 8, 2023
@dmitripivkine
Copy link
Contributor Author

Depends eclipse/omr#6921

@dmitripivkine dmitripivkine changed the title WIP:Replace J9VM_MODRON_SCAVENGER_CACHE_* to OMR_COPYSCAN_CACHE_* Replace J9VM_MODRON_SCAVENGER_CACHE_* to OMR_COPYSCAN_CACHE_* Mar 8, 2023
@dmitripivkine
Copy link
Contributor Author

@keithc-ca Would you please review DDR part? These constants haven't been used in DDR code. With removing them everywhere there is no need to keep them around. The old set of constants has been replaced to a new one. I think there is no need to add new set to DDR.

@keithc-ca
Copy link
Contributor

The DDR changes look fine to me.

@amicic
Copy link
Contributor

amicic commented Mar 13, 2023

need to squash the commits

@amicic
Copy link
Contributor

amicic commented Mar 13, 2023

The DDR changes look fine to me.

@keithc-ca, could you formally approve?

runtime/gc_vlhgc/CopyForwardScheme.cpp Outdated Show resolved Hide resolved
@@ -4371,15 +4371,15 @@ MM_CopyForwardScheme::scanRoots(MM_EnvironmentVLHGC* env)

while (NULL != (classLoader = classLoaderIterator.nextSlot())) {
if (0 == (classLoader->gcFlags & J9_GC_CLASS_LOADER_DEAD)) {
if(J9_ARE_ANY_BITS_SET(classLoader->flags, J9CLASSLOADER_ANON_CLASS_LOADER)) {
if (J9_ARE_ANY_BITS_SET(classLoader->flags, J9CLASSLOADER_ANON_CLASS_LOADER)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this code already uses J9_ARE_ANY_BITS_SET(), it should do so consistently (although I think the OMR equivalents should be preferred). The test here and similar ones on lines 1771,1772, 1786, 2909, 3269, etc., for example should be updated.

runtime/gc_vlhgc/CopyScanCacheVLHGC.hpp Outdated Show resolved Hide resolved
@amicic
Copy link
Contributor

amicic commented Mar 15, 2023

@keithc-ca While we, in GC code, are not completely consistent with use of macros of *_BITS_SET(), we tend not to use them.

Exceptions for the most part is code that deals with bits that are imposed by core VM structs (public/private flags in J9VMThread, flags in J9Class, etc) while still in GC code, although there are some other minor exceptions.

To stay consistent with this state:

  • I do not want to introduce these macros in pure GC code, that does not Interact with VM structures, what all of OMR code is (although there are actually a few usages of these macros), and some part of J9 GC code is, too. In fact, in future, I may ask them to be removed, if fit within this category.
  • For the code that deals with VM specific flags, but in GC specific files, we should continue to use those macros to stay consistent with the rest of core VM code. I don't have a preference if they should be J9_ or OMR_ variant.

@keithc-ca
Copy link
Contributor

In my opinion use of those macros has nothing to do with any particular data structure: they're really only about managing bit sets or masks. I'm disappointed you don't agree that their use would improve GC code, but I will respect your position.

This is non-functional change:
Remove usage of J9VM_MODRON_SCAVENGER_CACHE_* defined names, use
neutral OMR_COPYSCAN_CACHE_* defined names instead. Usage of Copy Scan
Caches is not limited to Scavenger and can be used by other Collectors,
Balance for instanse. Also replace variables types according standards
for modified files and fix formatting

Signed-off-by: Dmitri Pivkine <Dmitri_Pivkine@ca.ibm.com>
@amicic
Copy link
Contributor

amicic commented Apr 17, 2023

jenkins test sanity aix,win jdk11

@amicic amicic merged commit 8c3b2e2 into eclipse-openj9:master Apr 24, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants