RFR: JDK-8293978: Duplicate simple loop back-edge will crash the vm [v3]

Christian Hagedorn chagedorn at openjdk.org
Mon Sep 19 12:38:22 UTC 2022


On Mon, 19 Sep 2022 08:42:40 GMT, 王超 <duke at openjdk.org> wrote:

>> Duplicate back-edge of the following simple loop will make jvm crash.
>> 
>> <img width="458" alt="image" src="https://user-images.githubusercontent.com/25214855/190945327-ebce5342-bede-4fad-b940-088753034fa6.png">
>
> 王超 has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   Move the condition ahead

Otherwise, the fix itself looks good.

test/hotspot/jtreg/compiler/c2/TestDuplicateSimpleLoopBackedge.java line 37:

> 35: 
> 36: class Foo {
> 37:     static void c(Byte[] a, Byte d) {

Method can be moved to `TestDuplicateSimpleLoopBackedge`.

test/hotspot/jtreg/compiler/c2/TestDuplicateSimpleLoopBackedge.java line 43:

> 41: }
> 42: 
> 43: public class TestDuplicateSimpleLoopBackedge {

There are a lot of unused variables which could probably be removed and it would still trigger the crash. Also, I recommend to give methods a name different from single letters even though it's just a test.

test/hotspot/jtreg/compiler/c2/TestDuplicateSimpleLoopBackedge.java line 74:

> 72:         thread.start();
> 73:         Thread.sleep(Utils.adjustTimeout(4000));
> 74:     }

Can be simplified to just:


                    TestDuplicateSimpleLoopBackedge n = new TestDuplicateSimpleLoopBackedge();
                    for (int i = 0; i < 10000; ++i) {
                        n.j(args);
                    }

and then you can run the test with `-Xbatch` which disabled background compilation and waits until the compilation is complete.

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

Changes requested by chagedorn (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10329


More information about the hotspot-compiler-dev mailing list