You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Alexei Fedotov <al...@gmail.com> on 2007/04/01 17:00:13 UTC
verification of unreachable code
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?
--
With best regards,
Alexei,
ESSD, Intel
Re: verification of unreachable code
Posted by Alexei Fedotov <al...@gmail.com>.
Pavel,
> If yes, this code should be eliminted and should not affect later stages of verification.
Where this statement is written? The word "dead" is absent in the JVM spec.
Thanks!
P.S. Anyway, I already restored compatibility.
On 4/2/07, Pavel Pervov <pm...@gmail.com> wrote:
> I don't think I'm not the Pavel you've been addressing to, but let me ask a
> question.
>
> Does 'unreachable code' == 'dead code'? If yes, this code should be
> eliminted and should not affect later stages of verification.
>
> WBR,
> --
> Pavel Pervov,
> Intel Enterprise Solutions Software Division
>
--
With best regards,
Alexei,
ESSD, Intel
Re: verification of unreachable code
Posted by Pavel Pervov <pm...@gmail.com>.
I don't think I'm not the Pavel you've been addressing to, but let me ask a
question.
Does 'unreachable code' == 'dead code'? If yes, this code should be
eliminted and should not affect later stages of verification.
WBR,
--
Pavel Pervov,
Intel Enterprise Solutions Software Division
Re: verification of unreachable code
Posted by Mikhail Loenko <ml...@gmail.com>.
missed example?
2007/4/5, Alexei Fedotov <al...@gmail.com>:
> Folks,
> Thank you for expressing your thoughts - this is very useful. I agree
> with performance reasoning to skip dead code verification.
>
> Here is one more example:
>
>
>
> On 4/2/07, Mikhail Loenko <ml...@gmail.com> wrote:
> > 02 Apr 2007 01:57:39 +0400, Egor Pasko <eg...@gmail.com>:
> > > 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.
> >
> > +1
> >
> > Thanks,
> > Mikhail
> >
> >
> > >
> > > --
> > > Egor Pasko
> > >
> > >
> >
>
>
> --
> With best regards,
> Alexei,
> ESSD, Intel
>
Re: verification of unreachable code
Posted by Alexei Fedotov <al...@gmail.com>.
Folks,
Thank you for expressing your thoughts - this is very useful. I agree
with performance reasoning to skip dead code verification.
Here is one more example:
On 4/2/07, Mikhail Loenko <ml...@gmail.com> wrote:
> 02 Apr 2007 01:57:39 +0400, Egor Pasko <eg...@gmail.com>:
> > 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.
>
> +1
>
> Thanks,
> Mikhail
>
>
> >
> > --
> > Egor Pasko
> >
> >
>
--
With best regards,
Alexei,
ESSD, Intel
Re: verification of unreachable code
Posted by Mikhail Loenko <ml...@gmail.com>.
02 Apr 2007 01:57:39 +0400, Egor Pasko <eg...@gmail.com>:
> 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.
+1
Thanks,
Mikhail
>
> --
> Egor Pasko
>
>
Re: verification of unreachable code
Posted by Egor Pasko <eg...@gmail.com>.
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