harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Egor Pasko <egor.pa...@gmail.com>
Subject Re: verification of unreachable code
Date Sun, 01 Apr 2007 21:57:39 GMT
On the 0x2AB day of Apache Harmony Alexei Fedotov wrote:
> Hello, Pavel, community,
> 
> Could you here help me to understand the following issue? Consider the
> following example:
> ;
> ; test method
> .method public test([Ljava/lang/String;)I
>    .limit stack 3
>    .limit locals 2
> 
> 
>    sipush 555
>    iconst_1 ; push int 1
>    iconst_2 ; push int 2
>    if_icmplt Next
> Next:
>    sipush 555
>    if_icmpne Fail
>    ; pass
>    sipush 104
>    ireturn
> 
>  Fail:
>    sipush 105
>    ireturn // <<<<<< look here
> 
> 
>    return // <<<<<< look here
> .end method
> 
> In VM validation test suite we have a big number of tests like this
> which have several different return instructions one method. JVM spec
> says about this: "Each return instruction must match its method's
> return type." Strangely, Sun's verifier allows this code to pass
> verification, probably due to the fact that invalid "return" statement
> is unreachable.
> 
> Do you think we should be compatible with Sun on this issue?

I think, skipping analysis of unreachable code pieces would make
verification easier and faster not sacrificing JVM security, real apps
and such. JIT does not touch unreachable code too. So, let's decide if
real TCK/compat issues appear and forget unreachable code until then.

-- 
Egor Pasko


Mime
View raw message