commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r358963 [2/2] - in /jakarta/commons/sandbox/javaflow/trunk: ./ lib/ src/java/org/apache/commons/javaflow/ src/java/org/apache/commons/javaflow/ant/ src/java/org/apache/commons/javaflow/bytecode/ src/java/org/apache/commons/javaflow/bytecode...
Date Sun, 25 Dec 2005 04:10:28 GMT
Added: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationMethodAnalyzer.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationMethodAnalyzer.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationMethodAnalyzer.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationMethodAnalyzer.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,191 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.tree.AbstractInsnNode;
+import org.objectweb.asm.tree.InsnNode;
+import org.objectweb.asm.tree.MethodInsnNode;
+import org.objectweb.asm.tree.MethodNode;
+import org.objectweb.asm.tree.VarInsnNode;
+import org.objectweb.asm.tree.analysis.Analyzer;
+import org.objectweb.asm.tree.analysis.AnalyzerException;
+import org.objectweb.asm.tree.analysis.DataflowInterpreter;
+import org.objectweb.asm.tree.analysis.DataflowValue;
+import org.objectweb.asm.tree.analysis.Frame;
+import org.objectweb.asm.tree.analysis.SimpleVerifier;
+
+
+/**
+ * ContinuationMethodAdapter
+ * 
+ * @author Evgueni Koulechov
+ */
+public class ContinuationMethodAnalyzer extends MethodNode implements Opcodes {
+    protected final String className;
+    protected final ClassVisitor cv;
+    protected final MethodVisitor mv;
+    
+    protected final List labels = new ArrayList();
+    protected final List nodes = new ArrayList();
+    protected final List methods = new ArrayList();
+    
+    protected Analyzer analyzer;
+    
+    
+    public ContinuationMethodAnalyzer(String className, ClassVisitor cv, 
+            MethodVisitor mv, int access, String name, String desc, String signature, String[] exceptions) {
+        super( access, name, desc, signature, exceptions);
+        this.className = className;
+        this.cv = cv;
+        this.mv = mv;
+    }
+    
+    public void visitMethodInsn( int opcode, String owner, String name, String desc) {
+      MethodInsnNode mnode = new MethodInsnNode(opcode, owner, name, desc);
+      if(opcode == INVOKESPECIAL || "<init>".equals(name)) {
+          methods.add(mnode);
+      }
+      if (needsFrameGuard(opcode, owner, name, desc) /* && transformer.inScope(owner, name)*/) {
+        Label label = new Label();
+        super.visitLabel(label);
+        labels.add(label);
+        nodes.add(mnode);
+      }
+      instructions.add(mnode);
+    }
+    
+    public void visitEnd() {
+        if(instructions.size()==0 || labels.size()==0) {
+          accept(mv);
+          return;
+        }
+
+        try {
+          moveNew();
+
+          analyzer = new Analyzer(new SimpleVerifier());
+          analyzer.analyze(className, this);
+          accept(new ContinuationMethodAdapter(this));
+        
+        } catch(AnalyzerException ex) {
+          // TODO log the error or fail?
+          ex.printStackTrace();
+          accept(mv);
+
+        }
+    }
+
+    void moveNew() throws AnalyzerException {
+      DataflowInterpreter i = new DataflowInterpreter();
+      Analyzer a = new Analyzer(i);
+      a.analyze(className, this);
+      
+      HashMap movable = new HashMap();
+      
+      Frame[] frames = a.getFrames();
+      for( int j = 0; j < methods.size(); j++) {
+          MethodInsnNode mnode = (MethodInsnNode) methods.get(j);
+          // require to move NEW instruction
+          int n = a.getIndex(mnode);
+          Frame f = frames[n];
+          Type[] args = Type.getArgumentTypes(mnode.desc);
+          
+          DataflowValue v = (DataflowValue) f.getStack(f.getStackSize()-args.length-1);
+          Set insns = v.insns;
+          for( Iterator it = insns.iterator(); it.hasNext();) {
+            AbstractInsnNode ins = (AbstractInsnNode) it.next();
+            if(ins.getOpcode()==NEW) {
+                movable.put(ins, mnode);
+            } else if(ins.getOpcode()==DUP) {
+                int n1 = a.getIndex(ins);
+                AbstractInsnNode ins1 = (AbstractInsnNode) instructions.get(n1-1);
+                if(ins1.getOpcode()==NEW) {
+                    movable.put(ins1, mnode);
+                }
+            }
+          }
+      }
+      
+      for( Iterator it = movable.entrySet().iterator(); it.hasNext();) {
+          Map.Entry e = (Map.Entry) it.next();            
+          AbstractInsnNode node1 = (AbstractInsnNode) e.getKey(); 
+          int n1 = instructions.indexOf(node1);
+          AbstractInsnNode node2 = (AbstractInsnNode) instructions.get(n1+1);
+          boolean hasCopy = node2.getOpcode()==DUP;
+          
+          instructions.remove(node1);  // NEW              
+          if(hasCopy) {
+              instructions.remove(node2);  // DUP
+          }
+          
+          MethodInsnNode mnode = (MethodInsnNode) e.getValue();
+          int nm = instructions.indexOf(mnode);
+
+          int varOffset = maxLocals+1;
+          Type[] args = Type.getArgumentTypes(mnode.desc);
+
+          // save stack
+          for (int j = args.length - 1; j >= 0; j--) {
+              Type type = args[j];
+              instructions.add(nm++, new VarInsnNode(type.getOpcode(ISTORE), varOffset));
+              varOffset += type.getSize();
+          }
+          maxLocals = varOffset;
+          
+          instructions.add(nm++, node1);  // NEW
+          if(hasCopy) {
+              instructions.add(nm++, node2);  // DUP
+          }
+
+          // restore stack
+          for( int j = 0; j < args.length; j++) {
+              Type type = args[j];
+              varOffset -= type.getSize();
+              instructions.add(nm++, new VarInsnNode(type.getOpcode(ILOAD), varOffset));
+              // clean up store to avoid memory leak?
+              if(type.getSort()==Type.OBJECT || type.getSort()==Type.ARRAY) {
+                  instructions.add(nm++, new InsnNode(ACONST_NULL));
+                  instructions.add(nm++, new VarInsnNode(type.getOpcode(ISTORE), varOffset));
+              }
+          }
+      }
+    }
+    
+    // TODO
+    boolean needsFrameGuard( int opcode, String owner, String name, String desc ) {
+      if (opcode == Opcodes.INVOKEINTERFACE ||
+          (opcode == Opcodes.INVOKESPECIAL && !"<init>".equals(name)) ||
+          opcode == Opcodes.INVOKESTATIC ||
+          opcode == Opcodes.INVOKEVIRTUAL ) {
+          return true;
+      }
+      return false;
+    }
+
+}
\ No newline at end of file

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationMethodAnalyzer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/java/org/apache/commons/javaflow/bytecode/transformation/asm/ContinuationMethodAnalyzer.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/TestClassLoader.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/TestClassLoader.java?rev=358963&r1=358962&r2=358963&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/TestClassLoader.java (original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/TestClassLoader.java Sat Dec 24 20:09:27 2005
@@ -1,71 +1,71 @@
-package org.apache.commons.javaflow;
-
-import org.apache.commons.javaflow.bytecode.transformation.ResourceTransformer;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
-import org.apache.commons.io.IOUtils;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-/**
- * @author Kohsuke Kawaguchi
- */
-public class TestClassLoader extends ClassLoader {
-    private ResourceTransformer transformer = new BcelClassTransformer();
-
-    private final String prefix;
-
-    /**
-     * Creates a new instance.
-     *
-     * @param parent
-     *      parent class loader. Can be null, in which case it delegates
-     *      to the application class loader.
-     * @param prefix
-     *      prefix of the classes that will be instrumented by this class loader.
-     *      for example, if this parameter is "org.acme.foo.", then classes like
-     *      "org.acme.foo.Abc" or "org.acme.foo.bar.Zot" will be instrumented,
-     *      but not "org.acme.Joe" or "org.acme.foobar.Zot".
-     */
-    public TestClassLoader(ClassLoader parent, String prefix) {
-        super(parent);
-        this.prefix = prefix;
-        if(prefix==null)
-            throw new IllegalArgumentException();
-    }
-
-    private boolean shouldBeRewritten(String s) {
-        return s.startsWith(prefix);
-    }
-
-    protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
-
-        Class c = findLoadedClass(name);
-
-        if(c==null && shouldBeRewritten(name)) {
-            InputStream is = super.getResourceAsStream(name.replace('.', '/') + ".class");
-            if(is!=null) {
-                try {
-                    byte[] buf = IOUtils.toByteArray(is);
-                    buf = transformer.transform(buf);
-                    c = defineClass(name, buf, 0, buf.length);
-                } catch (IOException e) {
-                    throw new ClassNotFoundException("failed to read the class file", e);
-                }
-            }
-        }
-
-        if(c==null) {
-            // delegate
-            final ClassLoader parent = getParent();
-            if (parent != null)
-                c = parent.loadClass(name);
-            else
-                throw new ClassNotFoundException(name);
-        }
-
-        if (resolve)
-            resolveClass(c);
-        return c;
-    }
-}
+package org.apache.commons.javaflow;
+
+import org.apache.commons.javaflow.bytecode.transformation.ResourceTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
+import org.apache.commons.io.IOUtils;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * @author Kohsuke Kawaguchi
+ */
+public class TestClassLoader extends ClassLoader {
+    private ResourceTransformer transformer = new BcelClassTransformer();
+
+    private final String prefix;
+
+    /**
+     * Creates a new instance.
+     *
+     * @param parent
+     *      parent class loader. Can be null, in which case it delegates
+     *      to the application class loader.
+     * @param prefix
+     *      prefix of the classes that will be instrumented by this class loader.
+     *      for example, if this parameter is "org.acme.foo.", then classes like
+     *      "org.acme.foo.Abc" or "org.acme.foo.bar.Zot" will be instrumented,
+     *      but not "org.acme.Joe" or "org.acme.foobar.Zot".
+     */
+    public TestClassLoader(ClassLoader parent, String prefix) {
+        super(parent);
+        this.prefix = prefix;
+        if(prefix==null)
+            throw new IllegalArgumentException();
+    }
+
+    private boolean shouldBeRewritten(String s) {
+        return s.startsWith(prefix);
+    }
+
+    protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+
+        Class c = findLoadedClass(name);
+
+        if(c==null && shouldBeRewritten(name)) {
+            InputStream is = super.getResourceAsStream(name.replace('.', '/') + ".class");
+            if(is!=null) {
+                try {
+                    byte[] buf = IOUtils.toByteArray(is);
+                    buf = transformer.transform(buf);
+                    c = defineClass(name, buf, 0, buf.length);
+                } catch (IOException e) {
+                    throw new ClassNotFoundException("failed to read the class file", e);
+                }
+            }
+        }
+
+        if(c==null) {
+            // delegate
+            final ClassLoader parent = getParent();
+            if (parent != null)
+                c = parent.loadClass(name);
+            else
+                throw new ClassNotFoundException(name);
+        }
+
+        if (resolve)
+            resolveClass(c);
+        return c;
+    }
+}

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformerClassLoader.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformerClassLoader.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformerClassLoader.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformerClassLoader.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,60 @@
+
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import java.io.InputStream;
+import org.objectweb.asm.ClassReader;
+
+
+public class AsmClassTransformerClassLoader extends ClassLoader {
+  private final AsmClassTransformer transformer = new AsmClassTransformer();
+//  private final BcelClassTransformer transformer = new BcelClassTransformer();
+
+  private final String prefix;
+  private final ClassLoader cl;
+
+
+  public AsmClassTransformerClassLoader(String prefix) {
+    this.prefix = prefix;
+    this.cl = getClass().getClassLoader();
+  }
+
+  public Class loadClass(String name) throws ClassNotFoundException {
+    if(name.startsWith(prefix)) {
+      System.err.println("Loading: " + name);
+      try {
+        InputStream is = getClass().getResourceAsStream("/" + name.replace( '.', '/') + ".class");
+        byte[] bytecode;
+        if(name.startsWith(prefix+".data")) {
+          // bytecode = DefaultConstructorDump.dump();
+          bytecode = transformer.transform(is);
+          
+          /*
+          FileOutputStream os = new FileOutputStream(name+".class");
+          os.write(bytecode);
+          os.flush();
+          os.close();
+          */
+          
+          // CheckClassAdapter.verify(new ClassReader(bytecode), true);
+          
+        } else {
+          ClassReader cr = new ClassReader(is);
+          bytecode = cr.b;
+        }
+        return super.defineClass(name, bytecode, 0, bytecode.length);
+
+//      } catch( Error ex) {
+//        new ClassReader(bytecode).accept(new TraceClassVisitor(new PrintWriter(System.err)), false);
+//        throw ex;
+        
+      } catch( Throwable ex) {
+        System.err.println("Load error: " + ex.toString());
+        ex.printStackTrace();
+        throw new ClassNotFoundException(name+" "+ex.getMessage(), ex);
+  
+      }
+    }
+    return cl.loadClass( name);
+  }
+
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformerClassLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/AsmClassTransformerClassLoader.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,31 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.BlackRed;
+
+
+public class BlackRedTestCase extends TransformerTestCase {
+
+  public static Test suite() throws Exception {
+    Class test = BlackRedTestCase.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader( test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  public void testBlackRed() {
+    final Runnable r = new BlackRed();
+    final Continuation c1 = Continuation.startWith(r);
+    assertTrue(c1 != null);
+    final Continuation c2 = Continuation.continueWith(c1);
+    assertTrue(c2 == null);
+  }
+
+  protected String getData() {
+    return "org.apache.commons.javaflow.bytecode.transformation.asm.data.BlackRed";
+  }
+
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccess2TestClass.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccess2TestClass.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccess2TestClass.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccess2TestClass.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,28 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.ClassAccess2;
+
+
+public class ClassAccess2TestClass extends TransformerTestCase {
+
+  public static Test suite() throws Exception {
+    Class test = ClassAccess2TestClass.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader( test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  public void testClassAccess2() throws Exception {
+      final ClassAccess2 r = new ClassAccess2();
+      // final Continuation c = Continuation.startWith(r);
+      // assertTrue(c != null);
+  }
+
+  protected String getData() {
+    return "org.apache.commons.javaflow.bytecode.transformation.asm.data.ClassAccess2";
+  }
+
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccess2TestClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccess2TestClass.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,29 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.ClassAccess1;
+
+
+public class ClassAccessTestCase extends TransformerTestCase {
+
+  public static Test suite() throws Exception {
+    Class test = ClassAccessTestCase.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader( test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  public void testClassAccess() throws Exception {
+    final ClassAccess1 r = new ClassAccess1();
+    final Continuation c = Continuation.startWith(r);
+    assertTrue(c != null);
+  }
+
+  protected String getData() {
+    return "org.apache.commons.javaflow.bytecode.transformation.asm.data.ClassAccess1";
+  }
+  
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,37 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.CounterFlow;
+
+
+public class CounterTestCase extends TransformerTestCase {
+
+  public static Test suite() throws Exception {
+    Class test = CounterTestCase.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader( test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  public void testCounter() {
+    final int count = 5;
+    final Runnable r = new CounterFlow( count);
+
+    int i = 0;
+    Continuation c = Continuation.startWith( r);
+    while( c != null) {
+      c = Continuation.continueWith( c);
+      i++;
+    }
+
+    assertTrue( i == count);
+  }
+  
+  protected String getData() {
+    return "org.apache.commons.javaflow.bytecode.transformation.asm.data.CounterFlow";
+  }
+  
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorDump.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorDump.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorDump.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorDump.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,107 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+
+public class DefaultConstructorDump implements Opcodes {
+
+  public static byte[] dump() throws Exception {
+    FieldVisitor fv;
+    MethodVisitor mv;
+    AnnotationVisitor av0;
+
+    ClassWriter cw = new ClassWriter(true);
+    cw.visit( V1_2, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, "org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor", null, "java/lang/Thread", null);
+
+    cw.visitSource( "DefaultConstructor.java", null);
+
+    {
+      mv = cw.visitMethod( ACC_PUBLIC, "<init>", "()V", null, null);
+      mv.visitCode();
+      
+      Label l0 = new Label();
+      mv.visitLabel( l0);
+      
+      mv.visitVarInsn( ALOAD, 0);
+      mv.visitMethodInsn( INVOKESPECIAL, "java/lang/Thread", "<init>", "()V");
+
+      mv.visitMethodInsn( INVOKESTATIC, "org/apache/commons/javaflow/bytecode/StackRecorder", "get", "()Lorg/apache/commons/javaflow/bytecode/StackRecorder;");
+      mv.visitInsn( DUP);
+      mv.visitVarInsn( ASTORE, 1);
+      Label l1 = new Label();
+      mv.visitJumpInsn( IFNULL, l1);
+      mv.visitVarInsn( ALOAD, 1);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "isRestoring", "()Z");
+      mv.visitJumpInsn( IFEQ, l1);
+      mv.visitVarInsn( ALOAD, 1);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "popInt", "()I");
+      Label l2 = new Label();
+      mv.visitTableSwitchInsn( 0, 0, l1, new Label[] { l2});
+      
+      mv.visitLabel( l2);
+      mv.visitLdcInsn( "restore locals");
+      mv.visitInsn( POP);
+      mv.visitVarInsn( ALOAD, 1);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "popObject", "()Ljava/lang/Object;");
+      mv.visitTypeInsn( CHECKCAST, "org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor");
+      mv.visitVarInsn( ASTORE, 0);
+      mv.visitLdcInsn( "restore stack");
+      mv.visitInsn( POP);
+      mv.visitLdcInsn( "restore reference");
+      mv.visitInsn( POP);
+      mv.visitVarInsn( ALOAD, 1);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "popReference", "()Ljava/lang/Object;");
+      mv.visitTypeInsn( CHECKCAST, "java/io/PrintStream");
+      mv.visitLdcInsn( "restore params");
+      mv.visitInsn( POP);
+      mv.visitInsn( ACONST_NULL);
+      mv.visitTypeInsn( CHECKCAST, "java/lang/String");
+      Label l3 = new Label();
+      mv.visitJumpInsn( GOTO, l3);
+      
+      mv.visitLabel( l1);
+      
+      mv.visitFieldInsn( GETSTATIC, "java/lang/System", "err", "Ljava/io/PrintStream;");
+      mv.visitLdcInsn( "aaa");
+      mv.visitLabel( l3);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V");
+      mv.visitVarInsn( ALOAD, 1);
+      Label l5 = new Label();
+      mv.visitJumpInsn( IFNULL, l5);
+      mv.visitVarInsn( ALOAD, 1);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "isCapturing", "()Z");
+      mv.visitJumpInsn( IFEQ, l5);
+      mv.visitVarInsn( ALOAD, 1);
+      mv.visitVarInsn( ALOAD, 0);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "pushReference",
+          "(Ljava/lang/Object;)V");
+      mv.visitVarInsn( ALOAD, 1);
+      mv.visitVarInsn( ALOAD, 0);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "pushObject",
+          "(Ljava/lang/Object;)V");
+      mv.visitVarInsn( ALOAD, 1);
+      mv.visitIntInsn( BIPUSH, 0);
+      mv.visitMethodInsn( INVOKEVIRTUAL, "org/apache/commons/javaflow/bytecode/StackRecorder", "pushInt", "(I)V");
+      mv.visitInsn( RETURN);
+      
+      mv.visitLabel( l5);
+      mv.visitInsn( RETURN);
+      
+      Label l6 = new Label();
+      mv.visitLabel( l6);
+      mv.visitLocalVariable( "this", "Lorg/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor;", null, l1, l6, 0);
+      mv.visitLocalVariable( "__stackRecorder", "Lorg/apache/commons/javaflow/bytecode/StackRecorder;", null, l0, l6, 1);
+      mv.visitMaxs( 2, 2);
+      mv.visitEnd();
+    }
+    cw.visitEnd();
+
+    return cw.toByteArray();
+  }
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorDump.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorDump.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,28 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.DefaultConstructor;
+
+
+public class DefaultConstructorTestCase extends TestCase {
+
+    public static Test suite() throws Exception {
+        Class test = DefaultConstructorTestCase.class;
+        AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader(test.getPackage().getName());
+        Class c = cl.loadClass(test.getName());
+        return new TestSuite(c);
+    }
+    
+    
+    public void testInvoker() {
+        Runnable o = new DefaultConstructor();
+        Continuation c = Continuation.startWith(o);
+        
+        assertTrue(c == null);
+    }
+    
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,29 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.Invoker;
+
+
+public class InvokerTestCase extends TestCase {
+
+    public static Test suite() throws Exception {
+        Class test = InvokerTestCase.class;
+        AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader(test.getPackage().getName());
+        Class c = cl.loadClass(test.getName());
+        return new TestSuite(c);
+    }
+    
+    
+    public void testInvoker() {
+        Runnable r = new Thread();
+        Runnable o = new Invoker(r);
+        Continuation c = Continuation.startWith(o);
+        
+        assertTrue(c == null);
+    }
+    
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,26 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.NewObject;
+
+
+public class NewObjectTestCase extends TestCase {
+
+  public static Test suite() throws Exception {
+    Class test = NewObjectTestCase.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader( test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  
+  public void testNewObject() throws Exception {
+    final Runnable r = new NewObject();
+    final Continuation c = Continuation.startWith( r);
+    assertTrue( c == null);
+  }
+
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,29 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.NoReference;
+
+
+public class NoReferenceTestCase extends TransformerTestCase {
+
+  public static Test suite() throws Exception {
+    Class test = NoReferenceTestCase.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader( test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  public void testNoReference() throws Exception {
+    final Runnable r = new NoReference();
+    final Continuation c = Continuation.startWith( r);
+    assertTrue( c != null);
+  }
+
+  protected String getData() {
+    return "org.apache.commons.javaflow.bytecode.transformation.asm.data.NoReference";
+  }
+  
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleSerializableTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleSerializableTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleSerializableTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleSerializableTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,73 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.SimpleSerializable;
+
+
+public class SimpleSerializableTestCase extends TransformerTestCase {
+
+  public static Test suite() throws Exception {
+    Class test = SimpleSerializableTestCase.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader(test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  
+  public void testSimpleSuspendResume() throws Exception {
+    final SimpleSerializable r = new SimpleSerializable();
+
+    assertTrue( r.g == -1);
+    assertTrue( r.l == -1);
+
+    Continuation c1 = Continuation.startWith( r);
+
+    assertTrue( r.g == 0);
+    assertTrue( r.l == 0);
+
+    Continuation c2 = Continuation.continueWith( c1);
+
+    assertTrue( r.g == 1);
+    assertTrue( r.l == 1);
+
+    Continuation c3 = Continuation.continueWith( c2);
+
+    assertTrue( r.g == 2);
+    assertTrue( r.l == 2);
+  }
+
+  public void testContinuationBranching() throws Exception {
+    final SimpleSerializable r = new SimpleSerializable();
+
+    assertTrue( r.g == -1);
+    assertTrue( r.l == -1);
+
+    Continuation c1 = Continuation.startWith( r);
+
+    assertTrue( r.g == 0);
+    assertTrue( r.l == 0);
+
+    Continuation c2 = Continuation.continueWith( c1);
+
+    assertTrue( r.g == 1);
+    assertTrue( r.l == 1);
+
+    Continuation c31 = Continuation.continueWith( c2);
+
+    assertTrue( r.g == 2);
+    assertTrue( r.l == 2);
+
+    Continuation c32 = Continuation.continueWith( c2);
+
+    assertTrue( r.g == 3);
+    assertTrue( r.l == 2);
+  }
+
+
+  protected String getData() {
+    return "org.apache.commons.javaflow.bytecode.transformation.asm.data.SimpleSerializable";
+  }
+
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleSerializableTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleSerializableTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,29 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.bytecode.transformation.asm.data.Simple;
+
+
+public class SimpleTestCase extends TransformerTestCase {
+
+  public static Test suite() throws Exception {
+    Class test = SimpleTestCase.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader( test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  public void testNoReferenceBug() throws Exception {
+    final Runnable r = new Simple();
+    final Continuation c = Continuation.startWith( r);
+    assertTrue( c != null);
+  }
+
+  protected String getData() {
+    return "org.apache.commons.javaflow.bytecode.transformation.asm.data.Simple";
+  }
+
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,26 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import org.apache.commons.javaflow.Continuation;
+import org.apache.commons.javaflow.flow.StackBugFlow;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+public class StackTestCase extends TestCase {
+
+  public static Test suite() throws Exception {
+    Class test = StackTestCase.class;
+    AsmClassTransformerClassLoader cl = new AsmClassTransformerClassLoader(test.getPackage().getName());
+    Class c = cl.loadClass( test.getName());
+    return new TestSuite( c);
+  }
+
+  public void testStackBug() throws Exception {
+    final Runnable r = new StackBugFlow();
+    final Continuation c = Continuation.startWith( r);
+    assertTrue( c == null);
+  }
+
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/TransformerTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/TransformerTestCase.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/TransformerTestCase.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/TransformerTestCase.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,48 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm;
+
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer;
+import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.util.CheckClassAdapter;
+import org.objectweb.asm.util.TraceClassVisitor;
+
+import junit.framework.TestCase;
+
+
+public abstract class TransformerTestCase extends TestCase {
+
+  protected void runTest() throws Throwable {
+    try {
+      super.runTest();
+      
+    } catch( Throwable e) {
+      InputStream is = getStream(getData());
+      ClassReader cr = new ClassReader(is);
+      
+      AsmClassTransformer t1 = new AsmClassTransformer();
+      BcelClassTransformer t2 = new BcelClassTransformer();
+      
+      byte[] bytecode = t1.transform(cr.b);
+      CheckClassAdapter.verify(new ClassReader(bytecode), true);
+
+      StringWriter sw1 = new StringWriter();
+      new ClassReader(bytecode).accept(new TraceClassVisitor(new PrintWriter(sw1)), false);
+
+      StringWriter sw2 = new StringWriter();
+      new ClassReader(t2.transform(cr.b)).accept(new TraceClassVisitor(new PrintWriter(sw2)), false);
+      
+      assertEquals(e.getMessage(), sw2.toString(), sw1.toString());
+    }
+  }
+
+  private InputStream getStream( String name) {
+    return getClass().getResourceAsStream("/" + name.replace( '.', '/') + ".class");
+  }
+
+  protected abstract String getData();
+  
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/TransformerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/TransformerTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/BlackRed.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/BlackRed.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/BlackRed.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/BlackRed.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,57 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+import org.apache.commons.javaflow.Continuation;
+
+import java.io.Serializable;
+
+
+/**
+ * Test for making sure that rstack works correctly. For this test we need to
+ * have a stack frame that goes through multiple objects of different types.
+ * 
+ * @author Kohsuke Kawaguchi
+ */
+public final class BlackRed implements Runnable, Serializable {
+
+  public void run() {
+    // new Black( new Red( new Black( new Suspend()))).run();
+    new Black( new Suspend()).run();
+  }
+
+  
+  class Black implements Runnable {
+    final Runnable r;
+
+    public Black( Runnable r) {
+      this.r = r;
+    }
+
+    public void run() {
+      String s = "foo"; // have some random variable
+      r.run();
+    }
+  }
+
+  
+  class Red implements Runnable {
+    final Runnable r;
+
+    public Red( Runnable r) {
+      this.r = r;
+    }
+
+    public void run() {
+      int i = 5; // have some random variable
+      r.run();
+    }
+  }
+
+  
+  class Suspend implements Runnable {
+    public void run() {
+      Continuation.suspend();
+    }
+  }
+
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/BlackRed.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/BlackRed.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess1.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess1.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess1.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess1.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,14 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+import org.apache.commons.javaflow.Continuation;
+
+public final class ClassAccess1 implements Runnable {
+
+    public void run() {
+        final Class clazz1 = ClassAccess1.class;
+        final Class clazz2 = this.getClass();
+        
+        Continuation.suspend();
+    }
+
+}
\ No newline at end of file

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess1.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess2.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess2.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess2.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess2.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,10 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+
+public final class ClassAccess2 {
+
+    public void run() throws Throwable {
+        Object o = ClassAccess2.class;
+    }
+    
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess2.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess3.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess3.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess3.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess3.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,58 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+import org.apache.commons.javaflow.Continuation;
+
+public final class ClassAccess3 implements Runnable {
+
+    /*
+       L0 (0)
+        GETSTATIC ClassAccess2.class$0 : Class
+        DUP
+        IFNONNULL L1
+        POP
+       
+       L2 (5)
+        LDC "asm.data.ClassAccess2"
+        INVOKESTATIC Class.forName(String) : Class
+       
+       L3 (8)
+        DUP
+        PUTSTATIC ClassAccess2.class$0 : Class
+        GOTO L1
+       
+       L4 (12)
+        NEW NoClassDefFoundError
+        DUP_X1
+        SWAP
+        INVOKEVIRTUAL Throwable.getMessage() : String
+        INVOKESPECIAL NoClassDefFoundError.<init>(String) : void
+        ATHROW
+       
+       L1 (19)
+        ASTORE 1: clazz1
+       L5 (21)
+        INVOKESTATIC Continuation.suspend() : void
+       L6 (23)
+        RETURN
+
+       L7 (25)
+        TRYCATCHBLOCK L2 L3 L4 ClassNotFoundException
+     */
+  
+    static Class class$0;
+  
+    public void run() {
+        // final Class clazz1 = ClassAccess2.class;
+        // final Class clazz2 = this.getClass();
+        // if(class$0==null) {
+          try {
+            class$0 = Class.forName("asm.data.ClassAccess2");
+          } catch(ClassNotFoundException ex) {
+            throw new NoClassDefFoundError(ex.getMessage());
+          }
+        // }
+        
+        Continuation.suspend();
+    }
+
+}
\ No newline at end of file

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/ClassAccess3.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/CounterFlow.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/CounterFlow.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/CounterFlow.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/CounterFlow.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,24 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+import org.apache.commons.javaflow.Continuation;
+
+
+/**
+ * @author Kohsuke Kawaguchi
+ */
+public final class CounterFlow implements Runnable {
+
+  final int up;
+
+  public CounterFlow( int up) {
+    this.up = up;
+  }
+
+  public void run() {
+    for( int i = 0; i < up; i++) {
+      System.err.println(i);
+      Continuation.suspend();
+    }
+  }
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/CounterFlow.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/CounterFlow.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,13 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+
+public final class DefaultConstructor implements Runnable {
+
+    public DefaultConstructor() {
+    }
+    
+    public void run() {
+      System.err.println("aaa");
+    }
+    
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/DefaultConstructor.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Invoker.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Invoker.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Invoker.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Invoker.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,16 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+
+public final class Invoker implements Runnable {
+
+    private Runnable runnable;
+    
+    public Invoker(Runnable runnable) {
+        this.runnable = runnable;
+    }
+    
+    public void run() {
+        runnable.run();
+    }
+    
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Invoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Invoker.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NewObject.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NewObject.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NewObject.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NewObject.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,25 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+import junit.framework.Assert;
+
+
+/**
+ * Test that allocates a lot of new objects. Javaflow performs some tricky
+ * instrumentation on new object allocations, especially when it has arguments.
+ * Nesting object allocations makes it even more interesting.
+ * 
+ * @author Kohsuke Kawaguchi
+ */
+public final class NewObject implements Runnable {
+  static char[] ch = { 'a', 'b', 'c'};
+  
+  public void run() {
+
+    String s = new String( new String( new String( ch, 0, ch.length).toCharArray(), 0, ch.length));
+    // String s = new String( new String( ch).toCharArray());
+
+    Assert.assertEquals( s, "abc");
+  }
+
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NewObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NewObject.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NoReference.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NoReference.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NoReference.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NoReference.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,13 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+import org.apache.commons.javaflow.Continuation;
+
+
+public final class NoReference implements Runnable {
+
+  public void run() {
+    new Object();
+    Continuation.suspend();
+  }
+
+}
\ No newline at end of file

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NoReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/NoReference.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Simple.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Simple.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Simple.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Simple.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,22 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+import org.apache.commons.javaflow.Continuation;
+
+public final class Simple implements Runnable {
+
+    public int g = -1; // global count throughout all continuations
+    public int l = -1; // local count mapped to a global variable so
+                       // we can access is
+    
+    public void run() {
+        int local = -1;
+        ++g; l=++local;
+        Continuation.suspend();
+        ++g; l=++local;
+        Continuation.suspend();
+        ++g; l=++local;
+        Continuation.suspend();
+        ++g; l=++local;
+    }
+
+}
\ No newline at end of file

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Simple.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Simple.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/SimpleSerializable.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/SimpleSerializable.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/SimpleSerializable.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/SimpleSerializable.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,26 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+import java.io.Serializable;
+import org.apache.commons.javaflow.Continuation;
+
+
+public final class SimpleSerializable implements Runnable, Serializable {
+    private static final long serialVersionUID = 1L;
+    
+    public int g = -1; // global count throughout all continuations
+    public int l = -1; // local count mapped to a global variable so
+                       // we can access is
+    
+    public void run() {
+        int local = -1;
+        ++g; l=++local;
+        Continuation.suspend();
+        ++g; l=++local;
+        Continuation.suspend();
+        ++g; l=++local;
+        Continuation.suspend();
+        ++g; l=++local;
+    }
+
+}
+

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/SimpleSerializable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/SimpleSerializable.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Stack.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Stack.java?rev=358963&view=auto
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Stack.java (added)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Stack.java Sat Dec 24 20:09:27 2005
@@ -0,0 +1,35 @@
+package org.apache.commons.javaflow.bytecode.transformation.asm.data;
+
+/**
+ * Regression test case.
+ *
+ * <p>
+ * When the stack size reaches the maximum in a constructor method invocation,
+ * there was a bug where we failed to expand the stack size appropriately.
+ *
+ * This is a regression test for that case.
+ *
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public final class Stack implements Runnable {
+    public void run() {
+        final Object o = foo("abc","def");
+    }
+
+    private Object foo(String a, String b) {
+        return new StrStr(a,b);
+    }
+
+    private static final class StrStr {
+        private final String value;
+
+        public StrStr(String a, String b) {
+            value = a+b;
+        }
+
+        public String toString() {
+            return value;
+        }
+    }
+}

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Stack.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/data/Stack.java
------------------------------------------------------------------------------
    svn:keywords = Id



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


Mime
View raw message