Skip to content

-XX:-UseCompressedOops doesn't work #13561

Closed

Description

@pshipton

-XX:-UseCompressedOops should be equivalent to -Xnocompressedrefs, and I see there is some code in the redirector which looks at it, but it doesn't work. Guessing it's been broken since mixed refs.

java -XX:-UseCompressedOops -version

semeru version "11.0.12" 2021-07-20
Semeru Runtime Environment 11.0.12.0-m2 (build 11.0.12+6)
Eclipse OpenJ9 VM 11.0.12.0-m2 (build v0.27.0-release-5b9d76f56, JRE 11 Linux amd64-64-Bit Compressed References 20210716_218 (JIT enabled, AOT enabled)

Activity

  1. pshipton commented on Sep 23, 2021

    @pshipton
    MemberAuthor

    Works fine for IBM Java 8. @dmitripivkine fyi in case you know why it's not working.

  2. gacholio commented on Sep 24, 2021

    @gacholio
    Contributor

    The -XX variants are not understood by the VM itself, so perhaps the internal redirector is translating them into the J9-specific ones. Probably adding a MAPOPT for the XX versions in the VM would solve this (and any handling can be removed from the redirector).

  3. pshipton commented on Oct 7, 2021

    @pshipton
    MemberAuthor

    @tajila I'm setting this as a blocker, as it means all testing running with -XX:-UseCompressedOops isn't testing what it's supposed to be testing, which could be letting problems escape.

  4. llxia commented on Oct 7, 2021

    @llxia
    Contributor

    Created an issue for adding cmdlinetests for -XX:[+/-]UseCompressedOops #13660

  5. tajila commented on Oct 8, 2021

    @tajila
    Contributor

    @JasonFengJ9 Please take a look at this

  6. tajila commented on Oct 8, 2021

    @tajila
    Contributor

    I would start with this approach: Probably adding a MAPOPT for the XX versions in the VM would solve this (and any handling can be removed from the redirector).

  7. pshipton commented on Oct 8, 2021

    @pshipton
    MemberAuthor

    any handling can be removed from the redirector

    I think it needs to stay, we can't break non-mixed refs builds i.e. IBM Java 8.

  8. JasonFengJ9 commented on Oct 8, 2021

    @JasonFengJ9
    Member

    Following code snippet setting J9_EXTENDED_RUNTIME2_COMPRESS_OBJECT_REFERENCES need to be skipped when -XX:-UseCompressedOops is specified, i.e., command line or user environment option should overwrite automatic switching to compressedrefs.
    Edit: The issue was introduced by Mixedrefs work which only considered -Xcompressedrefs & -Xnocompressedrefs, -XX:+UseCompressedOops & -XX:-UseCompressedOops are ignored when setting J9_EXTENDED_RUNTIME2_COMPRESS_OBJECT_REFERENCES.

    openj9/runtime/vm/jvminit.c

    Lines 3686 to 3712 in 3201c84

    IDATA compressed = FIND_AND_CONSUME_ARG(EXACT_MATCH, VMOPT_XCOMPRESSEDREFS, NULL);
    IDATA nocompressed = FIND_AND_CONSUME_ARG(EXACT_MATCH, VMOPT_XNOCOMPRESSEDREFS, NULL);
    /* Compressed refs by default */
    if (compressed >= nocompressed) {
    /* switching to nocompressedrefs based on -Xmx, similar logic as redirector.c:chooseJVM() */
    const char* option = "-Xmx";
    UDATA requestedHeapSize = 0;
    U_64 maxHeapForCR = 0;
    IDATA element = FIND_AND_CONSUME_ARG2(EXACT_MEMORY_MATCH, option, NULL);
    if (element >= 0) {
    GET_MEMORY_VALUE(element, option, requestedHeapSize);
    }
    if (requestedHeapSize > 0) {
    #if defined(J9ZOS39064)
    maxHeapForCR = zosGetMaxHeapSizeForCR();
    #else /* defined(J9ZOS39064) */
    maxHeapForCR = MAXIMUM_HEAP_SIZE_RECOMMENDED_FOR_COMPRESSEDREFS;
    #endif /* defined(J9ZOS39064) */
    /* Sizes Table for Segregated heap does not support 4-bit shift so do not use it for Metronome */
    if ((maxHeapForCR > 0) && (J9_GC_POLICY_METRONOME == isGCPolicyMetronome(vm))) {
    maxHeapForCR = MAXIMUM_HEAP_SIZE_RECOMMENDED_FOR_3BIT_SHIFT_COMPRESSEDREFS;
    }
    }
    if (requestedHeapSize <= maxHeapForCR) {
    vm->extendedRuntimeFlags2 |= J9_EXTENDED_RUNTIME2_COMPRESS_OBJECT_REFERENCES;
    }
    }

    On the other hand, -Xnocompressedrefs behaves as expected.

  9. gacholio commented on Oct 9, 2021

    @gacholio
    Contributor

    any handling can be removed from the redirector

    I think it needs to stay, we can't break non-mixed refs builds i.e. IBM Java 8.

    I really mean that the redirector need not fiddle with any options in mixed mode - let the targetted VM handle it.

  10. gacholio commented on Oct 9, 2021

    @gacholio
    Contributor

    -XX:+UseCompressedOops & -XX:-UseCompressedOops are ignored

    I was hoping the MAPOPT would address this.

  11. pshipton commented on Oct 13, 2021

    @pshipton
    MemberAuthor

    Fix merged to 0.29 #13691

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions