eric-milles opened a new pull request #1557: URL: https://github.com/apache/groovy/pull/1557
https://issues.apache.org/jira/browse/GROOVY-10029 I have verified that the end result no longer passes through `DefaultTypeTransformation#castToType`. However there are more total bytecode instructions in the after state due to safe method call handling and cast of `toArray` result to the target type. I suspect the new sequence is faster but I have no direct evidence of that. Is that a concern? **Before** ``` public static void main(java.lang.String... args); 0 ldc <Class C> [2] 2 invokedynamic 0 invoke(java.lang.Class) : java.lang.Object [53] 7 invokedynamic 1 cast(java.lang.Object) : java.lang.String[] [59] 12 astore_1 [strings] 13 aload_1 [strings] 14 pop 15 return ``` **After** _I have edited because GROOVY-10031 and GROOVY-10034 have reduced the sequence at offset 10_ ``` public static void main(java.lang.String... args); 0 invokestatic C.m() : java.util.List [42] 3 dup 4 astore_1 5 ifnull 27 8 aload_1 9 iconst_0 10 anewarray java.lang.String [44] xx invokeinterface java.util.List.toArray(java.lang.Object[]) : java.lang.Object[] [64] [nargs: 2] xx goto xx xx aconst_null xx invokedynamic 0 cast(java.lang.Object[]) : java.lang.String[] [67] xx astore_2 [strings] xx aload_2 [strings] xx pop xx return ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
