[Soot-list] generating java code for generating jimple?
Lonnie Princehouse
lonnie.princehouse at gmail.com
Mon Jun 21 13:30:23 EDT 2010
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100621/da688d3f/attachment.html
More information about the Soot-list
mailing list