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

Fix discrepancy in GC Extensions Base functions #6715

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

dmitripivkine
Copy link
Contributor

@dmitripivkine dmitripivkine commented Sep 20, 2022

There is a number of functions in the GC Extensions Base defined under
the OMR_GC_MODRON_SCAVENGER flag. However, there are many places where
these functions are called unconditionally without checking this flag.
This flag is always enabled in our compilation environment, which
allows the code to compile. If it is disabled, the code fails to
compile. The solution is to always define these functions and wrap
Scavenger related content inside them.

Signed-off-by: Dmitri Pivkine [email protected]

@@ -217,7 +217,6 @@ MM_ConfigurationGenerational::createHeapWithManager(MM_EnvironmentBase *env, UDA
MM_GCExtensionsBase *extensions = env->getExtensions();
MM_Heap *heap = NULL;

#if defined(OMR_GC_MODRON_SCAVENGER)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one was removed because it is done at the beginning of the file

#endif /* OMR_GC_MODRON_SCAVENGER */
}

MMINLINE bool isRememberedSetInOverflowState()
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that these 3 RS methods are exposed outside of Scavenger compile fla, it would nice that method names are more explicit what kind of RS we are talking (since there is more then just Scavenger RS in our code base).
So, I recommend we expand these names to:
isScavengerRememberedSetInOverflowState
and similarly for 2 others related.
Since this is being used by dependent projects, you'll have keep the exisiting APIs, till depended projects get updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

new functions have added

@dmitripivkine
Copy link
Contributor Author

I did not realize I can change OMR code to use new functions now without waiting for cleanup PR. Adding more code

@dmitripivkine
Copy link
Contributor Author

@0xdaryl @babsingh Would you please proceed?
I believe failures in Mac OS build are unrelated

*start = _guaranteedNurseryStart;
*end = _guaranteedNurseryEnd;
#elif /* OMR_GC_MODRON_SCAVENGER */
Copy link
Contributor

@babsingh babsingh Sep 21, 2022

Choose a reason for hiding this comment

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

All#elifs will need to be replaced with #else or #elif defined(MACRO_NAME). Otherwise, the code may not work as expected.

Suggested change
#elif /* OMR_GC_MODRON_SCAVENGER */
#else /* OMR_GC_MODRON_SCAVENGER */

@babsingh
Copy link
Contributor

babsingh commented Sep 21, 2022

Does this PR completely resolve the issue described in #6702 (comment) and allow OMR to be built without OMR_GC_MODRON_SCAVENGER?

@babsingh
Copy link
Contributor

Locally built without OMR_GC_MODRON_SCAVENGER. Got the following errors:

/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp:1123:36: error: #elif with no expression
 #elif /* OMR_GC_MODRON_SCAVENGER */
                                    ^
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp:1133:36: error: #elif with no expression
 #elif /* OMR_GC_MODRON_SCAVENGER */
                                    ^
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp:1156:36: error: #elif with no expression
 #elif /* OMR_GC_MODRON_SCAVENGER */
                                    ^
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp:1179:36: error: #elif with no expression
 #elif /* OMR_GC_MODRON_SCAVENGER */
                                    ^
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp: In member function ‘bool MM_GCExtensionsBase::isRememberedSetInOverflowState()’:
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp:1136:2: error: no return statement in function returning non-void [-Werror=return-type]
  }
  ^
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp: In member function ‘bool MM_GCExtensionsBase::isScavengerRememberedSetInOverflowState()’:
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp:1159:2: error: no return statement in function returning non-void [-Werror=return-type]
  }
  ^
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp: In member function ‘bool MM_GCExtensionsBase::isScavengerBackOutFlagRaised()’:
/root/openj9-openjdk-jdk17/omr/gc/base/GCExtensionsBase.hpp:1182:2: error: no return statement in function returning non-void [-Werror=return-type]
  }
  ^

@dmitripivkine
Copy link
Contributor Author

Does this PR completely resolve the issue described in #6702 (comment) and allow OMR to be built without OMR_GC_MODRON_SCAVENGER?

The goal of this PR is cleanup usage of scavenger related functions in MM_GCExtensionsBase.
I have not check complete rebuild without OMR_GC_MODRON_SCAVENGER
If you have setup for local standalone OMR compilation would you please try it?
I thought there is more time consuming work to do (so prepared this partial fix) but maybe you are right and we can complete it now.

@babsingh
Copy link
Contributor

babsingh commented Sep 21, 2022

If you have setup for local standalone OMR compilation would you please try it?

Setup is pretty easy. If an OpenJ9 or OMR setup already exists, then you only need the following cmds to build OMR standalone:

cd $OMR_REPO
mkdir build
cd build
cmake ..             // Configure will build without OMR_GC_MODRON_SCAVENGER
make -j8             // Compile
ctest -V             // Test

If a setup does not exist, then the following dependencies need to be installed before running the above cmds: https://github.com/eclipse/omr/blob/f27ffa9b7e747c1f316240c5ec2335543b48aec6/buildenv/docker/x86_64/ubuntu20/Dockerfile#L28-L48

Configure alternate:

// Configure will build with OMR_GC_MODRON_SCAVENGER
cmake -Wdev -C ../cmake/caches/Travis.cmake ..

@babsingh
Copy link
Contributor

babsingh commented Sep 27, 2022

With #6525 merged, we can disable OMR_GC_MODRON_SCAVENGER and dependent/related flags in PR builds to test these changes.

Example:
jenkins build xlinux(cmake:'-DOMR_GC_MODRON_SCAVENGER=OFF -DOMR_GC_MODRON_CONCURRENT_MARK=OFF -DOMR_GC_SEGREGATED_HEAP=OFF')

@dmitripivkine
Copy link
Contributor Author

@babsingh Would you please review again? OMR compiles with OMR_GC_MODRON_SCAVENGER set OFF. Surprisingly, internal testing passed too (with exception of porttest failed in original build too)

@babsingh
Copy link
Contributor

jenkins build all(cmake:'-DOMR_GC_MODRON_SCAVENGER=OFF')

@babsingh
Copy link
Contributor

jenkins build arm(cmake:'--disable-OMR_GC_MODRON_SCAVENGER'),aarch64(cmake:'--disable-OMR_GC_MODRON_SCAVENGER'),zos(cmake:'-DOMR_GC_MODRON_SCAVENGER=OFF')

@babsingh
Copy link
Contributor

jenkins build arm(cmake:'EXTRA_CONFIGURE_ARGS=--disable-OMR_GC_MODRON_SCAVENGER'),aarch64(cmake:'EXTRA_CONFIGURE_ARGS=--disable-OMR_GC_MODRON_SCAVENGER'),zos(cmake:'-DOMR_GC_MODRON_SCAVENGER=OFF')

@babsingh
Copy link
Contributor

jenkins build arm(cmake:'EXTRA_CONFIGURE_ARGS=--disable-OMR_GC_MODRON_SCAVENGER')

@babsingh
Copy link
Contributor

jenkins build zos(cmake:'-DOMR_GC_MODRON_SCAVENGER=OFF')

Copy link
Contributor

@babsingh babsingh left a comment

Choose a reason for hiding this comment

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

functionally changes look good. minor formatting nitpicks.

gc/base/GCExtensionsBase.hpp Outdated Show resolved Hide resolved
gc/base/GCExtensionsBase.hpp Outdated Show resolved Hide resolved
@babsingh
Copy link
Contributor

Suggested rephrase of the commit message:

Fix discrepancy in GC Extensions Base functions

There are a number of functions in the GC Extensions Base defined under
the OMR_GC_MODRON_SCAVENGER flag. However, there are many places where
these functions are called unconditionally without checking this flag.
This flag is always enabled in our compilation environment, which
allows the code to compile. If it is disabled, the code fails to
compile. The solution is to always define these functions and wrap
Scavenger related content inside them.

Signed-off-by: Dmitri Pivkine <[email protected]>

There is a number of functions in the GC Extensions Base defined under
the OMR_GC_MODRON_SCAVENGER flag. However, there are many places where
these functions are called unconditionally without checking this flag.
This flag is always enabled in our compilation environment, which
allows the code to compile. If it is disabled, the code fails to
compile. The solution is to always define these functions and wrap
Scavenger related content inside them.

Signed-off-by: Dmitri Pivkine <[email protected]>
@dmitripivkine dmitripivkine changed the title Fix discrepancy in definition of functions in GC Extensions Fix discrepancy in GC Extensions Base functions Sep 28, 2022
@dmitripivkine
Copy link
Contributor Author

@babsingh ready for review

@babsingh
Copy link
Contributor

jenkins build all(cmake:'-DOMR_GC_MODRON_SCAVENGER=OFF')

@babsingh
Copy link
Contributor

jenkins build arm(cmake:'EXTRA_CONFIGURE_ARGS=--disable-OMR_GC_MODRON_SCAVENGER')

@babsingh
Copy link
Contributor

jenkins build aarch64(cmake:'EXTRA_CONFIGURE_ARGS=--disable-OMR_GC_MODRON_SCAVENGER')

@babsingh
Copy link
Contributor

jenkins build arm(cmake:'EXTRA_CONFIGURE_ARGS=--disable-OMR_GC_MODRON_SCAVENGER')

@babsingh
Copy link
Contributor

babsingh commented Sep 29, 2022

All builds, with OMR_GC_MODRON_SCAVENGER disabled, have passed. Starting jobs with the flag enabled:

jenkins build all

@babsingh
Copy link
Contributor

jenkins build zos

4 similar comments
@babsingh
Copy link
Contributor

jenkins build zos

@babsingh
Copy link
Contributor

jenkins build zos

@babsingh
Copy link
Contributor

jenkins build zos

@babsingh
Copy link
Contributor

jenkins build zos

Copy link
Contributor

@babsingh babsingh left a comment

Choose a reason for hiding this comment

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

In addition to #6715 (comment), all builds, with OMR_GC_MODRON_SCAVENGER enabled, have passed.

@babsingh babsingh merged commit 9260611 into eclipse-omr:master Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants