RFR: 8260934: java/lang/StringBuilder/HugeCapacity.java fails without Compact Strings [v2]

Aleksey Shipilev shade at openjdk.java.net
Tue Feb 9 19:48:07 UTC 2021


> $ CONF=linux-x86_64-server-fastdebug make run-test TEST=java/lang/StringBuilder/HugeCapacity.java TEST_VM_OPTS=-XX:-CompactStrings
> 
> STDERR:
> java.lang.OutOfMemoryError: Required length exceeds implementation limit
> at java.base/java.lang.AbstractStringBuilder.newCapacity(AbstractStringBuilder.java:259)
> at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:229)
> at java.base/java.lang.AbstractStringBuilder.ensureCapacity(AbstractStringBuilder.java:213)
> at java.base/java.lang.StringBuilder.ensureCapacity(StringBuilder.java:87)
> at HugeCapacity.testLatin1(HugeCapacity.java:49)
> at HugeCapacity.main(HugeCapacity.java:37)
> 
> I went back and forth in fixing this test, and I think the best we can do is sense the current setting on `CompactStrings` and choose the test configuration based on that. The alternative is to use `WhiteBox` within the test (tried, it is quite a bit ugly). Note that this test deliberately does not run `-XX:-CompactStrings` even when `vm.opt.final.CompactStrings` returns true (= "available"), because that might mean `TEST_VM_OPTS=-XX:+CompactStrings` is in effect, and we have the VM option conflict.
> 
> Additional testing:
>  - [x] Linux x86_64, affected test (default), passes
>  - [x] Linux x86_64, affected test (`-XX:-CompactStrings`), passes
>  - [x] Linux x86_64, affected test (`-XX:+CompactStrings`), passes

Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - Remove non-essentials
 - Simplify
 - Merge branch 'master' into JDK-8260934-hugecapacity-cs
 - 8260934: java/lang/StringBuilder/HugeCapacity.java fails without Compact Strings

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2355/files
  - new: https://git.openjdk.java.net/jdk/pull/2355/files/a4b0323c..856676d5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2355&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2355&range=00-01

  Stats: 28245 lines in 981 files changed: 16385 ins; 7685 del; 4175 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2355.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2355/head:pull/2355

PR: https://git.openjdk.java.net/jdk/pull/2355


More information about the core-libs-dev mailing list