You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/04/12 13:53:00 UTC

[jira] [Resolved] (GROOVY-10031) Compiler writes multianewarray instruction for all non-initializer array allocations

     [ https://issues.apache.org/jira/browse/GROOVY-10031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles resolved GROOVY-10031.
----------------------------------
    Fix Version/s: 4.0.0-alpha-3
       Resolution: Fixed

> Compiler writes multianewarray instruction for all non-initializer array allocations
> ------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10031
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10031
>             Project: Groovy
>          Issue Type: Improvement
>          Components: bytecode
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.0-alpha-3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {{AsmClassGenerator#visitArrayExpression}} chooses the [multianewarray|https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.multianewarray] instruction for all size-based array allocations.  The [anewarray|https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.anewarray] instruction is available for one-dimensional arrays.
> {code:groovy}
> String[] strings = new String[0]
> //     n  iconst_0
> //   n+1  multianewarray java.lang.String[]
> // vs.
> //     n  iconst_0
> //   n+1  anewarray java.lang.String
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)