ASF Bugzilla – Attachment 28127 Details for
Bug 52441
InstructionTargeters not being properly cleaned up.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
New method to InstructionTargeter for target cleanup.
patch.diff (text/plain), 4.76 KB, created by
Thiago
on 2012-01-09 16:30:23 UTC
(
hide
)
Description:
New method to InstructionTargeter for target cleanup.
Filename:
MIME Type:
Creator:
Thiago
Created:
2012-01-09 16:30:23 UTC
Size:
4.76 KB
patch
obsolete
>Index: src/main/java/org/apache/bcel/generic/InstructionTargeter.java >=================================================================== >--- src/main/java/org/apache/bcel/generic/InstructionTargeter.java (revision 1227384) >+++ src/main/java/org/apache/bcel/generic/InstructionTargeter.java (working copy) >@@ -29,8 +29,26 @@ > */ > public interface InstructionTargeter { > >+ /** >+ * Checks whether this targeter targets this instruction handle. >+ * >+ * @param ih >+ * @return >+ */ > boolean containsTarget( InstructionHandle ih ); > >- >+ /** >+ * Replaces the target of this targeter from this old handle to the new handle. >+ * >+ * This method will throw an exception if old_ih is not targeted by this object. >+ * >+ * @param old_ih >+ * @param new_ih >+ */ > void updateTarget( InstructionHandle old_ih, InstructionHandle new_ih ); >+ >+ /** >+ * Removes all targets of this targeter. >+ */ >+ void removeTargets(); > } >Index: src/main/java/org/apache/bcel/generic/CodeExceptionGen.java >=================================================================== >--- src/main/java/org/apache/bcel/generic/CodeExceptionGen.java (revision 1227384) >+++ src/main/java/org/apache/bcel/generic/CodeExceptionGen.java (working copy) >@@ -103,7 +103,12 @@ > this.handler_pc = handler_pc; > } > >- >+ public void removeTargets() { >+ setStartPC(null); >+ setEndPC(null); >+ setHandlerPC(null); >+ } >+ > /** > * @param old_ih old target, either start or end > * @param new_ih new target >Index: src/main/java/org/apache/bcel/generic/Select.java >=================================================================== >--- src/main/java/org/apache/bcel/generic/Select.java (revision 1227384) >+++ src/main/java/org/apache/bcel/generic/Select.java (working copy) >@@ -158,7 +158,13 @@ > targets[i] = target; > } > >- >+ public void removeTargets() { >+ setTarget(null); >+ for (int i = 0; i < targets.length; i++) { >+ setTarget(i, null); >+ } >+ } >+ > /** > * @param old_ih old target > * @param new_ih new target >Index: src/main/java/org/apache/bcel/generic/BranchInstruction.java >=================================================================== >--- src/main/java/org/apache/bcel/generic/BranchInstruction.java (revision 1227384) >+++ src/main/java/org/apache/bcel/generic/BranchInstruction.java (working copy) >@@ -202,7 +202,10 @@ > } > } > >- >+ public void removeTargets() { >+ setTarget(null); >+ } >+ > /** > * @param old_ih old target > * @param new_ih new target >Index: src/main/java/org/apache/bcel/generic/MethodGen.java >=================================================================== >--- src/main/java/org/apache/bcel/generic/MethodGen.java (revision 1227384) >+++ src/main/java/org/apache/bcel/generic/MethodGen.java (working copy) >@@ -21,6 +21,7 @@ > import java.util.Hashtable; > import java.util.List; > import java.util.Stack; >+ > import org.apache.bcel.Constants; > import org.apache.bcel.classfile.AnnotationEntry; > import org.apache.bcel.classfile.Annotations; >@@ -179,6 +180,9 @@ > ((m.getAccessFlags() & (Constants.ACC_ABSTRACT | Constants.ACC_NATIVE)) == 0) > ? new InstructionList(m.getCode().getCode()) > : null, cp); >+ // remove dummy variables created with regular constructor >+ this.removeLocalVariables(); >+ > Attribute[] attributes = m.getAttributes(); > for (int i = 0; i < attributes.length; i++) { > Attribute a = attributes[i]; >@@ -345,6 +349,8 @@ > * Remove all local variables. > */ > public void removeLocalVariables() { >+ for (LocalVariableGen var : variable_vec) >+ var.removeTargets(); > variable_vec.clear(); > } > >Index: src/main/java/org/apache/bcel/generic/LineNumberGen.java >=================================================================== >--- src/main/java/org/apache/bcel/generic/LineNumberGen.java (revision 1227384) >+++ src/main/java/org/apache/bcel/generic/LineNumberGen.java (working copy) >@@ -53,7 +53,10 @@ > return this.ih == ih; > } > >- >+ public void removeTargets() { >+ setInstruction(null); >+ } >+ > /** > * @param old_ih old target > * @param new_ih new target >Index: src/main/java/org/apache/bcel/generic/LocalVariableGen.java >=================================================================== >--- src/main/java/org/apache/bcel/generic/LocalVariableGen.java (revision 1227384) >+++ src/main/java/org/apache/bcel/generic/LocalVariableGen.java (working copy) >@@ -142,7 +142,11 @@ > this.end = end; > } > >- >+ public void removeTargets() { >+ setStart(null); >+ setEnd(null); >+ } >+ > /** > * @param old_ih old target, either start or end > * @param new_ih new target
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 52441
: 28127