On Tue, 9 Feb 2021 09:20:45 GMT, Aleksey Shipilev <[email protected]> wrote:
>> $ 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 > > Anyone? :) Having two `@test` blocks makes the maintenance more difficult. I had to do a diff to find out the difference between the two blocks. There's an existing test that explicitly tests both `-XX:+CompactStrings` and `-XX:-CompactStrings`. Maybe we can do the same thing? https://github.com/openjdk/jdk/blob/8f4c15f6417e471b372f74460fa94b9d84c4811d/test/hotspot/jtreg/runtime/CompactStrings/TestMethodNames.java#L29 * @run main/othervm -Xms5G -Xmx5G -XX:+CompactStrings HugeCapacity true * @run main/othervm -Xms5G -Xmx5G -XX:-CompactStrings HugeCapacity false ------------- PR: https://git.openjdk.java.net/jdk/pull/2355
