[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bcel-dev
Subject:    Re: [patch] documentation fix for RET instruction
From:       Enver Haase <ehaase () inf ! fu-berlin ! de>
Date:       2004-02-22 22:27:26
Message-ID: 40392CCE.9040907 () inf ! fu-berlin ! de
[Download RAW message or body]


Thanks!

Enver


Ed Price wrote:
> the BCEL javadocs for RET instruction (.../generic/RET.java)
> describe its effect on the operand stack like this:
> 
>   ... -> ..., address
> 
> but that is wrong in two ways:
> 
> (1) if it affected the stack it would pop the return address off
>     the stack, not push it on the stack (JSR does that).
> 
> (2) it actually doesn't affect the stack at all!
> 
> as the JVM spec says:
> 
>  "Note that jsr pushes the address onto the operand stack and ret
>  gets it out of a local variable. This asymmetry is intentional."
> 
> Finally note that the code is correct (eg RET does not implement
> StackConsumer or StackProducer).
> 
> Anyway here's the patch:
> 
> --- jakarta-bcel/src/java/org/apache/bcel/generic/RET.java.~1.2.~
> 2003-05-23 03:55:17.000000000 -0400
> +++ jakarta-bcel/src/java/org/apache/bcel/generic/RET.java	2004-02-22
> 13:36:32.000000000 -0500
> @@ -59,7 +59,7 @@
>  /** 
>   * RET - Return from subroutine
>   *
> - * <PRE>Stack: ..., -&gt; ..., address</PRE>
> + * <PRE>Stack: ... -&gt; ...</PRE>
>   *
>   * @version $Id: RET.java,v 1.2 2003/05/23 07:55:17 mdahm Exp $
>   * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic