[foreign-memaccess+abi] RFR: 8298532: Declare private constructors for FFM internal Architecture implementations

Jorn Vernee jvernee at openjdk.org
Tue Dec 13 11:31:30 UTC 2022


On Tue, 13 Dec 2022 11:24:21 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposes declaring AArch64Architecture and X86_64Architecture final and creating a private constructor so that this redundant byte code can be eliminated:
> 
> 
>  public jdk.internal.foreign.abi.x64.X86_64Architecture(); 
>     Code: 
>        0: aload_0 
>        1: invokespecial #1 // Method java/lang/Object."<init>":()V 
>        4: return 
> 
>  public jdk.internal.foreign.abi.aarch64.AArch64Architectur(); 
>     Code: 
>        0: aload_0 
>        1: invokespecial #1 // Method java/lang/Object."<init>":()V 
>        4: return 
> 
> 
> and other potential optimizations can be unlocked.

Marked as reviewed by jvernee (Committer).

src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/AArch64Architecture.java line 43:

> 41: 
> 42:     // Suppresses default constructor, ensuring non-instantiability.
> 43:     public AArch64Architecture() {}

Suggestion:

    private AArch64Architecture() {}

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

PR: https://git.openjdk.org/panama-foreign/pull/760


More information about the panama-dev mailing list