You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ko...@apache.org on 2005/10/03 07:26:38 UTC
svn commit: r293254 -
/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java
Author: kohsuke
Date: Sun Oct 2 22:26:35 2005
New Revision: 293254
URL: http://svn.apache.org/viewcvs?rev=293254&view=rev
Log:
fixed a bug where the instrumentation failed to expand the stack size to the necessary size.
This problem happens when instrumenting a code like:
Object foo(Object a,Object b) {
return new Something(a,b);
}
Modified:
jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java
Modified: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java?rev=293254&r1=293253&r2=293254&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java (original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/bcel/BcelClassTransformer.java Sun Oct 2 22:26:35 2005
@@ -476,6 +476,11 @@
}
method.setMaxLocals(localVarsSize[0]);
+ // make room for additional 'null' we push on the stack to clear
+ // the local variables that are used during the constructor invocation instrumentation.
+ // ideally we should be able to determine when we need to add +1, but for now just to be
+ // safe and let's always add this.
+ method.setMaxStack(method.getMaxStack() + 1);
// remove LocalVariableTypeTable attribute until BCEL #33549 is fixed,
// so that JDK 5.0 classes can be instrumented correctly.
@@ -487,6 +492,9 @@
}
}
+ /**
+ * Used to instrument the constructor invocation.
+ */
private InstructionList duplicateStack(MethodGen method, InvokeInstruction invoke, ObjectType objecttype, int[] localVarsSize) {
// reconstruction of an uninitialed object to call the constructor.
final InstructionFactory insFactory = new InstructionFactory(method.getConstantPool());
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org