[Soot-list] generating java code for generating jimple?

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Mon Jun 21 14:21:01 EDT 2010


Hi Lonnie.

I am not currently aware of such a tool for Jimple. I think this would
be great to have, though. Obviously the input would have to be Jimple
code then, not bytecode. I will try to advertise this as a Bachelors
thesis project. Maybe we will have it in the future, then...

The best solution for now would be to look at the javaToJimple code
within Soot itself or at the JastAdd-generated code in Soot"s Java 5
frontend.

Eric

--
Dr. Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



On 21 June 2010 19:30, Lonnie Princehouse <lonnie.princehouse at gmail.com> wrote:
> Hi,
>
> I've just started using Soot, and I like it a lot so far, so thanks.
>
> ASM has the ability to input bytecode and output ASM API calls to generate
> the bytecode, like this:
>
> Input:
>
>   L4
>     LINENUMBER 84 L4
>     ALOAD 2: k
>     INVOKEVIRTUAL Class.getFields() : Field[]
>     DUP
>     ASTORE 6
>     ARRAYLENGTH
>     ISTORE 5
>     ICONST_0
>     ISTORE 4
>
>
> Output:
>
> Label l4 = new Label();
> mv.visitLabel(l4);
> mv.visitLineNumber(84, l4);
> mv.visitVarInsn(ALOAD, 2);
> mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getFields",
> "()[Ljava/lang/reflect/Field;");
> mv.visitInsn(DUP);
> mv.visitVarInsn(ASTORE, 6);
> mv.visitInsn(ARRAYLENGTH);
> mv.visitVarInsn(ISTORE, 5);
> mv.visitInsn(ICONST_0);
> mv.visitVarInsn(ISTORE, 4);
>
>
> I'm wondering, is there an equivalent of this for Jimple?  I'm doing some
> code generation using the Soot API, and it would really help me to learn
> that API if I could generate my own examples.
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>


More information about the Soot-list mailing list