[8u] RFR (XS) 8166046: [TESTBUG] compiler/stringopts/TestStringObjectInitialization.java fails with OOME

Zhengyu Gu zgu at redhat.com
Wed Apr 21 11:52:19 UTC 2021


Looks good.

-Zhengyu

On 4/20/21 5:02 AM, Aleksey Shipilev wrote:
> Original test bug:
>    https://bugs.openjdk.java.net/browse/JDK-8166046
>    https://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/d288db38d1aa
> 
> This is a part of larger effort to improve JDK 8 testing. This patch is 
> very simple, yet it does not apply cleanly, because "8132919: Put 
> compiler tests in packages" is missing. 8u patch is otherwise the same:
> 
> diff -r b4de82aff831 
> test/compiler/stringopts/TestStringObjectInitialization.java
> --- a/test/compiler/stringopts/TestStringObjectInitialization.java      
> Wed Dec 10 13:58:30 2014 +0000
> +++ b/test/compiler/stringopts/TestStringObjectInitialization.java      
> Tue Apr 20 10:59:56 2021 +0200
> @@ -57,10 +57,15 @@
> 
>       public void run(String s, String[] sArray) {
>           // Trigger C2's string concatenation optimization
>           add(s + Arrays.toString(sArray) + " const ");
>       }
> +
> +    public void reset() {
> +        // Reset string to avoid OOMEs
> +        myString = "";
> +    }
>   }
> 
>   class Runner implements Runnable {
>       private TestStringObjectInitialization test;
> 
> @@ -68,11 +73,12 @@
>           test = t;
>       }
> 
>       public void run(){
>           String[] array = {"a", "b", "c"};
> -        for (int i = 0; i < 10000; ++i) {
> +        for (int i = 0; i < 100_000; ++i) {
>               test.run("a", array);
> +            test.reset();
>           }
>       }
>   }
> 
> Testing: tier1
> 



More information about the jdk8u-dev mailing list