Eric Milles created GROOVY-10031:
------------------------------------

             Summary: 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


{{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)

Reply via email to