Hi Torsten, How do I use BCEL from javaflow, or how do I get the BCEL based javaflow?
Thanks, Hiroshi On Sun, Aug 23, 2009 at 10:10 AM, Torsten Curdt<[email protected]> wrote: > In the latest trunk javaflow switched to use the ASM engine instead of > the BCEL one by default. There is still some work to do. But maybe > give the BCEL one a try. > > cheers > -- > Torsten > > On Tue, Aug 18, 2009 at 02:15, Hiroshi Yamauchi<[email protected]> wrote: >> Hi, >> >> I'm trying to run a javaflow example code. But it's been unsuccessful so far. >> >> I'm basically following this blog post: >> http://blogs.sun.com/sundararajan/entry/continuations_for_java >> >> I built javaflow-1.0-SNAPSHOT.jar using maven and downloaded >> commons-logging-1.1.1.jar and asm-all-3.2.jar. >> >> Here's what I did: >> >> $ cat Test.java >> import org.apache.commons.javaflow.*; >> >> class Test { >> static class MyRunnable implements Runnable { >> public void run() { >> System.out.println("run started!"); >> for( int i=0; i < 10; i++ ) { >> echo(i); >> } >> } >> >> private void echo(int x) { >> System.out.println("echo " + x); >> Continuation.suspend(); >> } >> } >> >> public static void main(String[] args) { >> System.out.println("main started"); >> Continuation c = Continuation.startWith(new MyRunnable()); >> System.out.println("in main after continuation return"); >> while (c != null) { >> c = Continuation.continueWith(c); >> System.out.println("in main"); >> } >> } >> } >> $ javac -cp ../target/javaflow-1.0-SNAPSHOT.jar Test.java >> $ jar cvf Test.jar Test.class Test\$MyRunnable.class >> added manifest >> adding: Test.class(in = 882) (out= 516)(deflated 41%) >> adding: Test$MyRunnable.class(in = 903) (out= 563)(deflated 37%) >> $ java -cp >> ../target/javaflow-1.0-SNAPSHOT.jar:../lib/commons-logging-1.1.1.jar:../lib/asm-all-3.2.jar >> org.apache.commons.javaflow.utils.RewritingUtils Test.jar >> Test-instrumented.jar >> rewriting Test.jar >> org.objectweb.asm.tree.analysis.AnalyzerException: Error at >> instruction 8: Cannot pop operand off an empty stack. >> at org.objectweb.asm.tree.analysis.Analyzer.analyze(Unknown Source) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer$2.analyze(ContinuationMethodAnalyzer.java:124) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer.visitEnd(ContinuationMethodAnalyzer.java:135) >> at org.objectweb.asm.ClassReader.accept(Unknown Source) >> at org.objectweb.asm.ClassReader.accept(Unknown Source) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:53) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:40) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.rewriteJar(RewritingUtils.java:108) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.rewriteJar(RewritingUtils.java:71) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.main(RewritingUtils.java:181) >> Caused by: java.lang.IndexOutOfBoundsException: Cannot pop operand off >> an empty stack. >> at org.objectweb.asm.tree.analysis.Frame.pop(Unknown Source) >> at org.objectweb.asm.tree.analysis.Frame.execute(Unknown Source) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.MonitoringFrame.execute(MonitoringFrame.java:70) >> ... 10 more >> org.objectweb.asm.tree.analysis.AnalyzerException: Error at >> instruction 8: Cannot pop operand off an empty stack. >> at org.objectweb.asm.tree.analysis.Analyzer.analyze(Unknown Source) >> at org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd(Unknown Source) >> at org.objectweb.asm.util.CheckMethodAdapter.visitEnd(Unknown Source) >> at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer.visitEnd(ContinuationMethodAnalyzer.java:141) >> at org.objectweb.asm.ClassReader.accept(Unknown Source) >> at org.objectweb.asm.ClassReader.accept(Unknown Source) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:53) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:40) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.rewriteJar(RewritingUtils.java:108) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.rewriteJar(RewritingUtils.java:71) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.main(RewritingUtils.java:181) >> Caused by: java.lang.IndexOutOfBoundsException: Cannot pop operand off >> an empty stack. >> at org.objectweb.asm.tree.analysis.Frame.pop(Unknown Source) >> at org.objectweb.asm.tree.analysis.Frame.execute(Unknown Source) >> ... 12 more >> Exception in thread "main" java.lang.RuntimeException: Error at >> instruction 8: Cannot pop operand off an empty stack. >> main([Ljava/lang/String;)V >> 00000 R . : : L0 >> 00001 R . : : LINENUMBER 19 L0 >> 00002 R . : : GETSTATIC java/lang/System.out : Ljava/io/PrintStream; >> 00003 R . : R : LDC "main started" >> 00004 R . : R R : L1 >> 00005 R . : R R : INVOKEVIRTUAL java/io/PrintStream.println >> (Ljava/lang/String;)V >> 00006 R . : : L2 >> 00007 R . : : LINENUMBER 20 L2 >> 00008 R . : : INVOKESPECIAL Test$MyRunnable.<init> ()V >> 00009 ? : NEW Test$MyRunnable >> 00010 ? : DUP >> 00011 ? : L3 >> 00012 ? : INVOKESTATIC >> org/apache/commons/javaflow/Continuation.startWith >> (Ljava/lang/Runnable;)Lorg/apache/commons/javaflow/Continuation; >> 00013 ? : ASTORE 1 >> 00014 ? : L4 >> 00015 ? : LINENUMBER 21 L4 >> 00016 ? : GETSTATIC java/lang/System.out : Ljava/io/PrintStream; >> 00017 ? : LDC "in main after continuation return" >> 00018 ? : L5 >> 00019 ? : INVOKEVIRTUAL java/io/PrintStream.println >> (Ljava/lang/String;)V >> 00020 ? : L6 >> 00021 ? : LINENUMBER 22 L6 >> 00022 ? : FRAME APPEND [org/apache/commons/javaflow/Continuation] >> 00023 ? : ALOAD 1 >> 00024 ? : IFNULL L7 >> 00025 ? : L8 >> 00026 ? : LINENUMBER 23 L8 >> 00027 ? : ALOAD 1 >> 00028 ? : L9 >> 00029 ? : INVOKESTATIC >> org/apache/commons/javaflow/Continuation.continueWith >> (Lorg/apache/commons/javaflow/Continuation;)Lorg/apache/commons/javaflow/Continuation; >> 00030 ? : ASTORE 1 >> 00031 ? : L10 >> 00032 ? : LINENUMBER 24 L10 >> 00033 ? : GETSTATIC java/lang/System.out : Ljava/io/PrintStream; >> 00034 ? : LDC "in main" >> 00035 ? : L11 >> 00036 ? : INVOKEVIRTUAL java/io/PrintStream.println >> (Ljava/lang/String;)V >> 00037 ? : GOTO L6 >> 00038 ? : L7 >> 00039 ? : LINENUMBER 26 L7 >> 00040 ? : FRAME SAME >> 00041 ? : RETURN >> >> >> at org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd(Unknown Source) >> at org.objectweb.asm.util.CheckMethodAdapter.visitEnd(Unknown Source) >> at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer.visitEnd(ContinuationMethodAnalyzer.java:141) >> at org.objectweb.asm.ClassReader.accept(Unknown Source) >> at org.objectweb.asm.ClassReader.accept(Unknown Source) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:53) >> at >> org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:40) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.rewriteJar(RewritingUtils.java:108) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.rewriteJar(RewritingUtils.java:71) >> at >> org.apache.commons.javaflow.utils.RewritingUtils.main(RewritingUtils.java:181) >> >> Can someone advise how to get this working? >> >> Thanks, >> Hiroshi >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
