[Soot-list] Add Expression works strange.

Roman Petriev vvpiroman at gmail.com
Wed Feb 4 02:51:14 EST 2015


I try to initialize, and after this I have:

iconst_0
istore_1
iinc_w        #1,  1

So, it isn't help.


2015-02-04 2:08 GMT+03:00 Elena Sherman <elenasherman at boisestate.edu>:

> Roman,
>
> Shouldn't you first initialize intLocal before using it in the addition
> expression?
> For example to 0 :
>
> AssignStmt as1 = Jimple.v().newAssignStmt(intLocal, IntConstant.v(0));
> units.add(as1);
> AssignStmt as2 = Jimple.v().newAssignStmt(intLocal,
> Jimple.v().newAddExpr(intLocal, IntConstant.v(500)));
> units.add(as2);
>
> On Tue, Feb 3, 2015 at 2:38 PM, Roman Petriev <vvpiroman at gmail.com> wrote:
>
>> Hello everybody!
>> I have code:
>>
>> Local intLocal = Jimple.v().newLocal("myInt", IntType.v());
>> body.getLocals().add(intLocal);
>> AssignStmt as2 = Jimple.v().newAssignStmt(intLocal,
>> Jimple.v().newAddExpr(intLocal, IntConstant.v(500)));
>> units.add(as2);
>>
>> So I want to increase local variable on 500.
>> In byte code after transformation I see:
>>
>> iinc_w        #5,  1
>>
>> Why 1 instead of 500? Where I mistake?
>>
>> Thanks for any help.
>>
>> Best regards,
>> Roman.
>>
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at CS.McGill.CA
>> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150204/e6c19a30/attachment-0001.html 


More information about the Soot-list mailing list