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

The output result of OpenJ9-JDK8 will vary depending on whether - XX:+CompactStrings is used #15954

Closed
ayuan0828 opened this issue Sep 23, 2022 · 5 comments

Comments

@ayuan0828
Copy link

Description:

As shown in the following test case,when OpenJ9-jdk8 (using the CompactStrings parameter) calls the "insert (int index, String str)" function to insert, if the character array assigned to "str" contains "Character. MAX_VALUE", the last part of characters in the result will be discarded.

I don't know the reason for this result. I applied the same parameter to OpenJ9-jdk-11, but the same result did not appear.

Environment

Ubuntu 18.04 x86_64

JVM Information:
jdk8:

OpenJDK Runtime Environment (build 1.8.0_332-internal-_2022_02_17_10_23-b00)
Eclipse OpenJ9 VM (build master-39c490eaf, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20220217_000000 (JIT enabled, AOT enabled)
OpenJ9   - 39c490eaf
OMR      - b63287860
JCL      - 301202f49f based on jdk8u332-b02)

jdk11:

OpenJDK Runtime Environment (build 11.0.15-internal+0-adhoc..openj9-openjdk-jdk11)
Eclipse OpenJ9 VM (build master-39c490eaf, JRE 11 Linux amd64-64-Bit Compressed References 20220217_000000 (JIT enabled, AOT enabled)
OpenJ9   - 39c490eaf
OMR      - b63287860
JCL      - 24e7209ed4 based on jdk-11.0.15+1)

Testcase:

    public class Test {
    public static void main(String[] args) throws Exception {
        char[] stra = { '1',Character.MAX_VALUE};
        StringBuilder sb = new StringBuilder("12345");
        sb.insert(0, stra);
        System.out.println(sb.toString());
    }
}

Output of JDK8(with -XX:+CompactStrings):

1?123

Output of JDK8(default):

1?12345

Output of JDK11(default)/JDK11(with -XX:+CompactStrings):

1?12345
@pshipton
Copy link
Member

@mikezhang1234567890 pls take a look.

@mikezhang1234567890
Copy link
Contributor

This one is fixed in master, probably by #15618.

Doesn't look like it's in the 0.33 release though.

@pshipton
Copy link
Member

@mikezhang1234567890 pls confirm it's fixed in 0.35, which contains the mentioned fix. If so we can close this.

Builds:
https://openj9-jenkins.osuosl.org/job/Pipeline-Release-0.35.0-Build8/
https://openj9-jenkins.osuosl.org/job/Pipeline-Release-0.35.0-Build11/

@mikezhang1234567890
Copy link
Contributor

Yes, it's fixed in 0.35:

$ ./macjdk8/j2sdk-image/bin/java -version
openjdk version "1.8.0_352-internal"
OpenJDK Runtime Environment (build 1.8.0_352-internal-jenkins_2022_09_24_05_02-b00)
Eclipse OpenJ9 VM (build v0.35.0-release-d8f6fe2f5fd, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20220924_42 (JIT enabled, AOT enabled)
OpenJ9   - d8f6fe2f5fd
OMR      - 447afc0f036
JCL      - 330bf23488c based on jdk8u352-b05)

$ ./macjdk8/j2sdk-image/bin/java -XX:+CompactStrings CompStrTest
1�12345

JDK11+ uses the openjdk implementation, so it wasn't affected by this issue.

@pshipton
Copy link
Member

Closing as fixed in the next release, due out around Oct 21 or in the next week.

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

No branches or pull requests

3 participants