[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extend Jimple keywords





The reason I ask is that, typically in Soot, Jimple would be generated from a class file (ie bytecode) and not the Java source, although the next release will also have JavaToJimple.

In your case, if you can produce valid bytecode from your Extended
Java, you should have nothing left to do for Soot/Jimple.

Out of curiosity, have you (or anyone?) thought about producing jimple fragments from
java fragments (or from another textual representation, like textual jimple?)


The reason I ask is that part of what I'm working on would be simplified by incorporating
various partial code fragments in interesting ways. Currently, I either write code to construct
jimple representation by hand (which is tedious and obfuse) or, if I'm really desperate, I
build a java class with the code fragments I need and then use method inlining to splice the code
together. (The upside is slightly easier readability for large chunks, at the expense of even more
obfuscation of what is really going on)


One approach is what the Jakarta Tool Suite does: which involves some special java syntax (Jak) that is precompiled
into Java code for generating a parse tree. Unfortunately, Jakarta has it's own internal representation and tries to represent
full Java syntax, which results in lots of different syntactic types. It also has complexity with name capture, because
substitution is done lexicographically.


http://www.cs.utexas.edu/users/schwartz/software.html

I guess what I'd like is the ability to do something like:

Body.addUnits(parseFragment(body, "int x= 5+6; y=2*x;..."));
(Resulting in a new local variable named x and a capture of the existing local (or field?) named y.)
SootMethod method = parseMethod(sootClass, "public void dosomething() { ...}");
(Resulting in a method and a body ready to be added to the given class.


Where the body and the class are specified to provide some way of binding variables that are not explicitly declared.

I started trying to see what I could do with the existing jimple parser, but soot.jimple.parser.Parse failed on every complete jimple file I gave it, so I didn't bother trying it on a fragment...

Any thoughts?