[Soot-list] Re: [abc] Basic Jimple question...

Ondrej Lhotak olhotak at sable.mcgill.ca
Sat Nov 27 10:05:12 EST 2004


On Sat, Nov 27, 2004 at 12:25:36PM +0000, Damien Sereni wrote:
> Hi all [in particular the Soot gang],
> 
> while implementing the new CflowCounter stuff I've found something
> weird going on with Jimple->Baf conversion... I'm trying to generate
> the test "x > 0" for some local x, and using:
> 
> Jimple.v().newGtExpr(countLoc, IntConstant.v(0));  // res := (countLoc > 0)
> 
> to do that (countLoc is a local). The code is fine when the output is
> dava, but if this is used to compile a program to bytecode, I get an
> exception from soot.jimple.internal.JGtExpr.makeBafInst. Upon closer
> inspection it is triggered by the following strange code (in
> JGtExpr):
> 
> Object makeBafInst(Type opType)
>  { throw new RuntimeException("unsupported conversion: "+this); }
>    //    Object makeBafInst(Type opType) 
>    // { return Baf.v().newGtInst(this.getOp1().getType()); }
> 
> I assume this means that GtExpr should not in fact be used... Am now a
> bit wary of such surprises, so if anyone knows why that is and if
> there is a general principle for what should / shouldn't be used...

Hi Damien...

Jimple is heavily based on Java bytecode. I am not sure of the details,
but I suspect that the GtExpr corresponds to the ifge bytecode
instruction, and therefore is only allowed to appear inside an IfStmt.

I have forwarded your message to the soot-list so that some of the
people more familiar with this part of Jimple can confirm this. In
general, I think it would be useful for the abc gang to subscribe to the
soot-list and send Soot-related questions there instead of the abc list.
This helps to get them answered promptly, especially when the people who
happen to be on both lists are travelling or busy.

Also, when generating Jimple, I have found Raja Vallee-Rai's masters
thesis quite helpful for determining what is and isn't valid Jimple.
It is available from the Sable publications web page.

If it is the case that GtExpr and other related things are only allowed
inside IfStmts, we should add a check for this to the Jimple validator.

Ondrej



More information about the Soot-list mailing list