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

Add support for mixed references mode in CMake builds #11166

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

sharon-wang
Copy link
Contributor

@sharon-wang sharon-wang commented Nov 12, 2020

Mixed references mode is enabled by specifying --with-mixedrefs=[static|dynamic] in the configure options. If --with-mixedrefs is provided without indicating static or dynamic, static is assumed by default.

In static mixed references mode, OMR_MIXED_REFERENCES_MODE_STATIC is enabled in OMR. When this is enabled, two GC libraries will be built:

  • j9gc/omrgc, where OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES=1 , and
  • j9gc_full/omrgc_full, where OMR_OVERRIDE_COMPRESS_OBJECT_REFERENCES=0

The other GC libraries are also split into regular and _full in static mode.

In full, compressed or mixed dynamic mode, the original "unsplit" libraries will continue to be built (i.e. j9gc/omrgc and related GC libraries).

Summary of Changes

  • New CMake SPEC files have been created for each platform/OS to support mixed references mode
  • Existing GC library CMakeLists files have been updated for mixed references static mode (build separate _full GC libraries)
  • GC library selection has been updated to support the new _full GC libraries when in mixed references static mode
  • Documentation has been added to note --with-mixedrefs=[static|dynamic] is now available (only with CMake)
  • Jenkins pipeline changes have been added to support building CMake Mixed References mode

Note: GC libraries related to Verbose have not been updated. Investigation is ongoing by the GC team (cc @dmitripivkine). This means that verbose is not supported for the full references GC library in mixed references static mode.

These changes only enable mixed references mode with CMake. Once this work is all merged, the equivalent UMA changes will be made.


When using a mixedrefs build, you can specify JVM options -Xcompressedrefs or -Xnocompressedrefs to choose between compressed and full pointers.


Here's a list of all the jenkins shortnames to run mixed refs CMake builds. These will run builds with extra configure options --with-mixedrefs and --with-cmake. (This list is up to date with changes from #11459)

aixmxd: ppc64_aix_mixed
zlinuxmxd: s390x_linux_mixed
plinuxmxd: ppc64le_linux_mixed
xlinuxmxd: x86-64_linux_mixed
winmxd: x86-64_windows_mixed
osxmxd: x86-64_mac_mixed
alinux64mxd: aarch64_linux_mixed
zosmxd: s390x_zos_mixed // CMake is not currently available for ZOS


Issue Discussion: #8878
Related Issue "Merge compressedrefs and non-compressedrefs tests builds into one": #9231

OMR Changes

Extensions Changes

@sharon-wang
Copy link
Contributor Author

Please review @gacholio @keithc-ca @dnakamura

buildenv/jenkins/variables/defaults.yml Outdated Show resolved Hide resolved
runtime/gc_modron_startup/CMakeLists.txt Outdated Show resolved Hide resolved
runtime/gc_modron_startup/mminit.cpp Outdated Show resolved Hide resolved
runtime/gc_modron_startup/mminit.cpp Outdated Show resolved Hide resolved
runtime/include/j9lib.h.in Show resolved Hide resolved
@fjeremic
Copy link
Contributor

Is the plan to eventually switch Adopt builds to build with --with-mixedrefs=dynamic by default?

@gacholio
Copy link
Contributor

Is the plan to eventually switch Adopt builds to build with --with-mixedrefs=dynamic by default?

Static for now - dynamic doesn't perform well.

runtime/gc/dllinit.c Outdated Show resolved Hide resolved
@gacholio
Copy link
Contributor

Is GC check linked with the GC? Is that why it needs splitting? If it's just a performance concern, I'd leave it dynamic.

@sharon-wang
Copy link
Contributor Author

Is GC check linked with the GC? Is that why it needs splitting? If it's just a performance concern, I'd leave it dynamic.

Yes, j9gccheck and j9gcchk both link against omrgc

@gacholio
Copy link
Contributor

OK - I guess the ideal would be to have a dynamic OMR for GC check, but that's for later on (if ever).

runtime/gc/dllinit.c Outdated Show resolved Hide resolved
@sharon-wang
Copy link
Contributor Author

@gacholio What's the expected behaviour of using -Xcompressedrefs/-Xnocompressedrefs with a mixedrefs build? Are there restrictions I should document when using those options with a static or dynamic mixedrefs build?

@gacholio
Copy link
Contributor

The expectation is that they will function exactly the same as the dual-VM builds.

@gacholio
Copy link
Contributor

The redirector will need to be updated to always select the "default" directory for compressed and not.

@sharon-wang
Copy link
Contributor Author

There's one more change I need to add, which I'm planning to add to mxdptrs.cmake. Currently OMR_MIXED_REFERENCES_MODE_STATIC is getting set as a cache variable in the omr changes eclipse/omr#5657, but it's not occurring early enough. As such, make all would need to be run twice for the build to succeed after a make clean.

If those changes are approved, I'll squash the commits.

@sharon-wang
Copy link
Contributor Author

@gacholio Do we want to add pipeline changes to allow builds using --with-mixedrefs=dynamic?

@gacholio
Copy link
Contributor

@gacholio Do we want to add pipeline changes to allow builds using --with-mixedrefs=dynamic?

Eventually perhaps, but we're going to be building the static version for the forseable future.

Create new CMake spec files for mixed references mode

Update CMakeLists.txt for GC libs to support mixed refs mode

Update GC library selection to support mixed references static

Add configure documentation for --with-mixedrefs=[static|dynamic]

Add pipeline changes to build CMake mixed references mode

Set OMR_MIXED_REFERENCES_MODE_STATIC in mxdptrs.cmake

Declare the two glue interface libraries before adding omr

Signed-off-by: Sharon Wang <sharon-wang-cpsc@outlook.com>
@sharon-wang
Copy link
Contributor Author

@dnakamura Ping for your thoughts on the CMake changes here

@sharon-wang
Copy link
Contributor Author

Do we want to run a PR build with these changes? The shortname for the linux mixed refs build is xlinuxmxdcm. We'll need to use the changes from eclipse/omr#5657.

@keithc-ca
Copy link
Contributor

I'd like to hear from @dnakamura on this and eclipse/omr#5657.

# version in gc_glue_java, below, when appropriate.
j9vm_add_library(${OMR_GC_GLUE_TARGET} INTERFACE)
j9vm_add_library(${OMR_GC_GLUE_FULL_TARGET} INTERFACE)

Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason to use a forward declaration instead of just including gc_glue_java ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's because the _full version of the glue library is only built if OMR_MIXED_REFERENCES_MODE_STATIC=ON, but OMR_MIXED_REFERENCES_MODE_STATIC is set as a cache variable later than when the glue libraries are referenced in other libraries. This results in having to run make all twice to get the build working, since on the second run, the cache variable is already set.

Copy link
Contributor

Choose a reason for hiding this comment

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

Like the comment says:

# Declare the GC glue interface libraries that omr might reference,
# including the 'full' version. We'll only add sources to the 'full'
# version in gc_glue_java, below, when appropriate.

Copy link
Contributor

Choose a reason for hiding this comment

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

we could just remove the conditional around gc_glue_java full. Interface libraries are never built on their own. So we can just define it but never reference it anywhere

Copy link
Contributor

Choose a reason for hiding this comment

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

The point is that it must be declared before including the omr.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand. My point is that you could just flush out both interfaces regardless. If you never link against the extra glue, it has no effect on the build system. With either solution, if for some reason you do link against the extra glue (with OMR_MIXED_REFERENCES_MODE_STATIC not set) you would get a link error at compile time.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you have it backward: if we (unconditionally) provide complete library definitions, there would be no link error if the extra glue library were used (unintentionally).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do we want to proceed?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm satisfied with this in it's current form, but I think this should wait until eclipse/omr#5657 is merged in case it evolves in a way that would alter how this handles OMR_GC_POINTER_MODE == "mixed".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me. @dnakamura What are your thoughts?

@sharon-wang
Copy link
Contributor Author

sharon-wang commented Dec 1, 2020

Here's a list of all the jenkins shortnames to run mixed refs CMake builds. These will run builds with extra configure options --with-mixedrefs and --with-cmake.

aixmxdcm: ppc64_aix_mixed_cm
zlinuxmxdcm: s390x_linux_mixed_cm
plinuxmxdcm: ppc64le_linux_mixed_cm
xlinuxmxdcm: x86-64_linux_mixed_cm
winmxdcm: x86-64_windows_mixed_cm
osxmxdcm: x86-64_mac_mixed_cm
alinux64mxdcm: aarch64_linux_mixed_cm
zosmxdcm: s390x_zos_mixed_cm // CMake is not currently available for ZOS

@keithc-ca keithc-ca self-assigned this Dec 4, 2020
@keithc-ca
Copy link
Contributor

Jenkins test sanity zlinuxmxdcm jdk11

@keithc-ca
Copy link
Contributor

Testing is currently only available on x86-64_linux_mixed; to be remedied, at least in part, by adoptium/aqa-tests#2087.

@keithc-ca
Copy link
Contributor

Jenkins test sanity xlinuxmxdcm jdk11

@sharon-wang
Copy link
Contributor Author

The test is still failing because in this PR, only x86-64_linux_mixed_cm is exposed.

I can add x86-64_linux_mixed (and the equivalents for the other platforms), which will use CMake by default for JDK11 builds, or should we update the AdoptOpenJDK platform specs to use the <PLATFORM>_mixed_cm versions instead of <PLATFORM>_mixed?

@keithc-ca
Copy link
Contributor

Let's wait to see how the xlinux tests fair before adjusting anything else.

@llxia
Copy link
Contributor

llxia commented Dec 4, 2020

Test build failed because of Cannot find key PLATFORM: s390x_linux_mixed. Currently, we only added x86-64_linux_mixed, so the above xlinux PR build should work.

I think by default, the suffix _cm and _uma will be removed. That is how the cm test build works now. So there is no change needed for the spec name.

@sharon-wang
Copy link
Contributor Author

sharon-wang commented Dec 4, 2020

Failure message from test build for xlinux

*** DETECTED_SPEC value is linux_x86-64_cmprssptrs, settled SPEC value is linux_x86-64_mxdptrs. SPEC value does not match. Please reset or unset SPEC.

It seems that some additional handling for mixed builds is missing from: https://github.com/AdoptOpenJDK/TKG/blob/master/src/org/openj9/envInfo/JavaInfo.java?

I think these lines end up executing, which is causing the DETECTED_SPEC to be compressed.

        if (cmprssptrs != null && cmprssptrs.contains("Compressed References")) {
            spec += "_cmprssptrs";
        }

@sharon-wang
Copy link
Contributor Author

sharon-wang commented Dec 4, 2020

Ah, I see there's a PR open to address handling mixed refs: adoptium/TKG#124

@keithc-ca
Copy link
Contributor

I'm inclined to merge this even though the test story is incomplete.

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.

None yet

7 participants