Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] CHA inline #773

Merged
merged 7 commits into from
Jan 18, 2024

Conversation

lusou-zhangquan
Copy link
Collaborator

@lusou-zhangquan lusou-zhangquan commented Jan 9, 2024

Introduction

With this backport, interface call could be inlined if there is only one implementation of the invoked method after class hierarchy analysis, as shown in the following case.

interface I1 {
    public int m();
}
    
abstract class C1 implements I1 {}

class C2 extends C1 {
    public int m() {
        return 0;
    }
}

class Test {
    public static void main(String[] args) {
    	run(new C2());
    }

    public static void run(C1 c1) {
        c1.m(); // will inline C2.m because only class C2 implements method m after Class Hierarchy Analysis
    }
}

Test results

benchmark: renaissance
platform: x86
config:4C8G
image

benchmark: renaissance
platform: aarch64
config:4C8G
image

There isn't any change for SPECjbb on x86 and aarch64 platform.

Corresponding upstream commit

6986483CHA: optimize calls through interfaces
8223171Redundant nmethod dependencies for effectively final methods
8261954Dependencies: Improve iteration over class hierarchy under context class
8264548Dependencies: ClassHierarchyWalker::is_witness() cleanups
8266074 Vtable-based CHA implementation
8065760 CHA: Improve abstract method support
8036580 CHA: improve default method support

Others

  1. Because the absence of JDK-8264873 Dependencies: Split ClassHierarchyWalker in JDK11, the implementation of class LinkedConcreteMethodFinder in backported JDK-8266074 is little different with upstream, but keeps functionality consistent.
  2. Total number of new lines of this backport is about 2400, including 1500 lines for test cases and 900 lines for feature code.

Vladimir Ivanov added 2 commits January 10, 2024 16:40
@lusou-zhangquan lusou-zhangquan force-pushed the port-cha branch 2 times, most recently from 33e743b to 7442d79 Compare January 11, 2024 05:00
@lusou-zhangquan lusou-zhangquan changed the title Backport CHA [Backport] CHA inline Jan 11, 2024
Vladimir Ivanov added 3 commits January 17, 2024 17:39
Summary: Only analysis hierarchy for linked classes when trying to
inline

Testing: test/hotspot/jtreg/compiler/cha/StrengthReduceInterfaceCall.java

Reviewers: kuaiwei.kw, yulei, yuede.lin

Issue: dragonwell-project#774
Summary: CHA inline supports abstract method

Testing: test/hotspot/jtreg/compiler/cha/AbstractRootMethod.java

Reviewers: kuaiwei.kw, yulei, yude.lin

Issue: dragonwell-project#774
Summary: CHA inline supports interface default method

Testing: test/hotspot/jtreg/compiler/cha/DefaultRootMethod.java

Reviewers: kuaiwei.kw, yulei, yude.lin

Issue: dragonwell-project#774
@lusou-zhangquan lusou-zhangquan merged commit 4d61024 into dragonwell-project:master Jan 18, 2024
50 checks passed
@lusou-zhangquan lusou-zhangquan deleted the port-cha branch June 21, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants