JDK-8160548 : Inconsistent inlining behavior with CompileOnly
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-06-29
  • Updated: 2024-07-11
  • Resolved: 2017-11-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10 b34Fixed
Related Reports
Relates :  
Relates :  
Description
With the testcase below, executed with latest hs-comp with:

java -XX:CompileOnly=TestCompileCommand::m1 -XX:CompileOnly=TestCompileCommand::m2 -XX:CompileCommand=quiet -XX:-BackgroundCompilation -XX:+PrintCompilation -XX:+PrintInlining -XX:-TieredCompilation TestCompileCommand

I get the following output:

    170    1    b        TestCompileCommand::m1 (4 bytes)
                            @ 0   TestCompileCommand::m1_notinlined (1 bytes)   not compilable (disabled)
    170    2    b        TestCompileCommand::m2 (8 bytes)
                            @ 4   TestCompileCommand::m2_notinlined (1 bytes)   inline (hot)

Either both m1_notinlined & m2_notinlined should be inlined or neither should be.


public class TestCompileCommand {

    static void m1_notinlined() {
    }

    static void m1() {
        m1_notinlined();
    }

    static void m2_notinlined() {
    }

    static void m2(boolean flag) {
        if (flag) {
            m2_notinlined();
        }
    }

    static public void main(String[] args) {
        for (int i = 0; i < 20000; i++) {
            m1_notinlined();
            m1_notinlined();
            m1();
            m2((i%2) == 0);
        }
    }
}
Comments
URL: http://hg.openjdk.java.net/jdk/jdk/rev/0c88cd009b5f User: jwilhelm Date: 2017-11-30 06:07:04 +0000
30-11-2017

Yes, it should.
22-11-2017

For completeness, should GraphBuilder::check_can_parse() be changed as well, so c1 inlining behavior matches that of c2?
21-11-2017

URL: http://hg.openjdk.java.net/jdk/hs/rev/0c88cd009b5f User: neliasso Date: 2017-11-20 14:13:20 +0000
20-11-2017

http://cr.openjdk.java.net/~neliasso/8160548/webrev.01/
10-11-2017

Expected behaviour is that the compileonly command shouldn't affect inlining. The bug is that the first time a method is submitted for compilation a _is_c*_compilable flag is set in ciMethod. That flag is picked up by the inlining heuristics.
10-11-2017

Request deferral to 10, SQE ok: only debug option is affected
11-08-2016

Request deferal to 10: This is a bug in a debug option. The flag is used in our testing but the bug doesn't affect it. (Multiple compileonly-flags is not used because multiple patterns can be supplied to the same flag.) ILW = CompileOnly inconsistent behavior; CompileOnly usage; Use a single CompileOnly with multiple arguments, or use several "-XX:CompileCommand=compileonly,..." = MLL = P5
11-08-2016

Hi Nils, this seems to be related to compiler control. I'll assign it to you so that you keep track of it. Thank you! Best regards, Zoltan
10-08-2016

ILW = CompileOnly inconsistent behavior; CompileOnly usage; none = MLH = P4
30-06-2016

For reference, discussion on hotspot-compiler-dev: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2016-June/023575.html
29-06-2016