You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by en...@apache.org on 2004/02/22 23:27:30 UTC
cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic RET.java
enver 2004/02/22 14:27:30
Modified: src/java/org/apache/bcel/generic RET.java
Log:
PR: Correct dok on RET which does not affect the stack.
Obtained from: BCEL-list
Submitted by: Ed Price
Reviewed by: Enver Haase
Revision Changes Path
1.3 +2 -2 jakarta-bcel/src/java/org/apache/bcel/generic/RET.java
Index: RET.java
===================================================================
RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/generic/RET.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RET.java 23 May 2003 07:55:17 -0000 1.2
+++ RET.java 22 Feb 2004 22:27:30 -0000 1.3
@@ -59,7 +59,7 @@
/**
* RET - Return from subroutine
*
- * <PRE>Stack: ..., -> ..., address</PRE>
+ * <PRE>Stack: ... -> ...</PRE>
*
* @version $Id$
* @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
InstructionList move to end bug (was RE: cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic RET.java)
Posted by Ed Price <ed...@panix.com>.
> Maybe the the fixes contained in bugs 26532 and 26533 could also be
> committed? They are extremely trivial fixes for fairly seroius bugs in
> core BCEL classes (InstructionList and IINC), so I would think they
> should get some attention.
Hi, I looked at 26532, and I agree it is a bug.
I submitted a test case and a corrected patch to bugzilla.
Andrew, your suggested fix was not correct. It set "this.end" to null,
because -- assuming I read it right! -- it was in the else block of an
if on "next != null" which means setting "this.end = next" would set it
to null... You can verify this with the test case :)
HTH!
-Ed
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org
RE: widening bug in IINC (was RE: cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic RET.java)
Posted by Ed Price <ed...@panix.com>.
I wrote:
> wide = (n > MAX_BYTE) || (c < MIN_BYTE) || (c > MAX_BYTE)
Not quite... Make that:
wide = (n > MAX_UNSIGNED_BYTE) || (c < MIN_BYTE) || (c > MAX_BYTE)
Corrected patch:
--- jakarta-bcel/src/java/org/apache/bcel/generic/IINC.java.~1.3.~
2003-05-23 03:55:17.000000000 -0400
+++ jakarta-bcel/src/java/org/apache/bcel/generic/IINC.java 2004-02-22
21:47:58.000000000 -0500
@@ -106,8 +106,8 @@
}
private final void setWide() {
- if(wide = ((n > org.apache.bcel.Constants.MAX_SHORT) ||
- (Math.abs(c) > Byte.MAX_VALUE)))
+ if(wide = ((n > org.apache.bcel.Constants.MAX_BYTE) ||
+ (c < Byte.MIN_VALUE) || (c > Byte.MAX_VALUE)))
length = 6; // wide byte included
else
length = 3;
Sorry for the confusion.
-Ed
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org
widening bug in IINC (was RE: cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic RET.java)
Posted by Ed Price <ed...@panix.com>.
> Maybe the the fixes contained in bugs 26532 and 26533 could also be
> committed? They are extremely trivial fixes for fairly seroius bugs in
> core BCEL classes (InstructionList and IINC), so I would think they
> should get some attention.
I agree, this is a bug. And the suggested fix looks correct to me.
However, here is a slightly improved patch:
--- jakarta-bcel/src/java/org/apache/bcel/generic/IINC.java.~1.3.~
2003-05-23 03:55:17.000000000 -0400
+++ jakarta-bcel/src/java/org/apache/bcel/generic/IINC.java 2004-02-22
21:47:58.000000000 -0500
@@ -106,8 +106,8 @@
}
private final void setWide() {
- if(wide = ((n > org.apache.bcel.Constants.MAX_SHORT) ||
- (Math.abs(c) > Byte.MAX_VALUE)))
+ if(wide = ((n > Byte.MAX_VALUE) ||
+ (c < Byte.MIN_VALUE) || (c > Byte.MAX_VALUE)))
length = 6; // wide byte included
else
length = 3;
The current logic is clearly broken:
wide = (n > MAX_UNSIGNED_SHORT) || (abs(c) > MAX_BYTE)
Andrew's patch changes that (correctly) to:
wide = (n > MAX_BYTE) || (abs(c) > MAX_BYTE)
but the optimal logic is this:
wide = (n > MAX_BYTE) || (c < MIN_BYTE) || (c > MAX_BYTE)
-Ed
PS testing just to make sure ... javac on this:
public class tmp { int foo (int x) { return x += -128; } }
produces this:
0: iinc 1, -128
3: iload_1
4: ireturn
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic RET.java
Posted by Andrew Huntwork <as...@huntwork.net>.
Maybe the the fixes contained in bugs 26532 and 26533 could also be
committed? They are extremely trivial fixes for fairly seroius bugs in
core BCEL classes (InstructionList and IINC), so I would think they
should get some attention.
enver@apache.org wrote:
> enver 2004/02/22 14:27:30
>
> Modified: src/java/org/apache/bcel/generic RET.java
> Log:
> PR: Correct dok on RET which does not affect the stack.
> Obtained from: BCEL-list
> Submitted by: Ed Price
> Reviewed by: Enver Haase
>
> Revision Changes Path
> 1.3 +2 -2 jakarta-bcel/src/java/org/apache/bcel/generic/RET.java
>
> Index: RET.java
> ===================================================================
> RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/generic/RET.java,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- RET.java 23 May 2003 07:55:17 -0000 1.2
> +++ RET.java 22 Feb 2004 22:27:30 -0000 1.3
> @@ -59,7 +59,7 @@
> /**
> * RET - Return from subroutine
> *
> - * <PRE>Stack: ..., -> ..., address</PRE>
> + * <PRE>Stack: ... -> ...</PRE>
> *
> * @version $Id$
> * @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