[ 
https://issues.apache.org/jira/browse/GROOVY-7249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17578552#comment-17578552
 ] 

Eric Milles commented on GROOVY-7249:
-------------------------------------

If "indy" is disabled, this code is flagged for optimization by setting the 
type {{int}} for "x[1]" in its {{StatementMeta}}.  Then 
{{BinaryExpressionHelper#evaluateCompareExpression}} delegates to 
{{doPrimitiveCompare}}.

If "indy" is enabled (now default), "x[1]" is INVOKEDYNAMIC "getAt" and no 
optimization for compare.

Is there more to do here?  [~blackdrag]

> primopts failing to optimize in if condition
> --------------------------------------------
>
>                 Key: GROOVY-7249
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7249
>             Project: Groovy
>          Issue Type: Bug
>          Components: primtive opts
>            Reporter: Jochen Theodorou
>            Priority: Major
>
> {code:Java}
>  int[] x = new int[n]
>  if (x[1]==0){}
> {code}
> in this code primopts fail to optimize the array access in the if-condition 
> and does dynamic access instead, even though this is not required



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to