[Soot-list] incoherent stack height

Khilan Gudka khilan at doc.ic.ac.uk
Sun Jul 11 12:05:59 EDT 2010


Hi Eric,

Thanks for your reply. I found out what the problem was: I recently
changed m to take another argument but i was still instrumenting calls
to the one argument version while still passing two arguments. I
changed it to use the two argument version and it's now working.

Cheers,
Khilan

On 11 July 2010 17:02, Eric Bodden <bodden at st.informatik.tu-darmstadt.de> wrote:
> Hi Khilan.
>
> Did you try using -validate?
>
> This may be a bug in Jimple-to-Jasmin conversion. But it's hard to say
> without having a complete .jimple file that exposes this error. It's
> more likely that there's something wrong with your code generation.
>
> 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 11 July 2010 17:22, Khilan Gudka <khilan at doc.ic.ac.uk> wrote:
>> Hi,
>>
>> I apologise for the previous email. The example was too complicated. I
>> now have a much simpler example:
>>
>> Exception in thread "main" java.lang.RuntimeException:
>> <test.StaticFieldLoad1: void main(java.lang.String[])>: incoherent
>> stack height at block merge point Block 1:
>> [preds: 0 2 ] [succs: 2 4 ]
>> nop;
>> push class "test/StaticFieldLoad1";
>> store.r _p1;
>> load.r _p1;
>> ifnull nop;
>> Block 2:
>> [preds: 1 ] [succs: 3 1 ]
>> load.r _p1;
>> push 1;
>> staticinvoke <MyClass: boolean m(java.lang.Object)>;
>> ifeq nop;
>>
>> computed blockHeight == 1 recorded blockHeight = 0
>>        at soot.baf.JasminClass.calculateStackHeight(JasminClass.java:1845)
>>        at soot.baf.JasminClass.calculateStackHeight(JasminClass.java:1850)
>>
>> The corresponding jimple code is:
>>
>>     label0:
>>        nop;
>>        _p1 = class "test/StaticFieldLoad1";
>>        if _p1 == null goto label1;
>>
>>        _locked1 = staticinvoke <MyClass: boolean m(java.lang.Object)>(_p1, 1);
>>        if _locked1 == 0 goto label0;
>>
>>        nop;
>>
>>     label1:
>>        nop;
>>
>> One thing that I'm not sure about is the instruction "ifeq nop;"
>> Looking at the jimple, this corresponds to "if _locked1 == 0 goto
>> label0;" However, in the bytecode there is no instruction that pushes
>> 0 onto the stack for the comparison (the only predecessor for block 2
>> is block 1 and block 1 doesn't have an instruction that pushes 0 onto
>> the stack). Am I missing something here?
>>
>> Thanks,
>> Khilan
>>
>> On 11 July 2010 15:27, Khilan Gudka <khilan at doc.ic.ac.uk> wrote:
>>> Hi,
>>>
>>> I'm instrumenting code but jasmin is throwing the following exception
>>> for one particular class:
>>>
>>>        Exception in thread "main" java.lang.RuntimeException:
>>> <org.hsqldb.jdbc.jdbcConnection: java.util.Map getTypeMap()>:
>>> incoherent stack height at block merge point Block 193:
>>>        [preds: 192 196 ] [succs: 194 197 ]
>>>                Block 196:
>>>        [preds: 194 195 ] [succs: 193 ]
>>>        inc.i $elem235 1;
>>>        goto load.i $elem235;
>>>
>>>        computed blockHeight == 18 recorded blockHeight = 17
>>>                at soot.baf.JasminClass.calculateStackHeight(JasminClass.java:1842)
>>>                at soot.baf.JasminClass.calculateStackHeight(JasminClass.java:1847)
>>>                ...
>>>
>>> The corresponding jimple code (i think) is:
>>>
>>>        $p213 = $c213.<java.util.HashMap:
>>> java.util.HashMap$HashEntry[] buckets>;
>>>        if $p213 == null goto label58;
>>>
>>>        $locked213 = staticinvoke <MyClass: boolean
>>> m(java.lang.Object)>($p213, 1);
>>>        if $locked213 == 0 goto label0;
>>>
>>>        $idx235 = 0;
>>>
>>>     label55:
>>>        $len235 = lengthof $p213;
>>>        if $idx235 >= $len235 goto label57;
>>>
>>>        $elem235 = $p213[$idx235];
>>>        if $elem235 == null goto label56;
>>>
>>>        $locked235 = staticinvoke < MyClass: boolean
>>> m(java.lang.Object)>($elem235, 1);
>>>        if $locked235 == 0 goto label0;
>>>
>>>     label56:
>>>        $idx235 = $idx235 + 1;
>>>        goto label55;
>>>
>>>     label57:
>>>        nop;
>>>
>>> However, I don't understand why $elem235 is being incremented and not
>>> $idx235 (as is being done in the jimple?). All the $ variables are
>>> local variables.
>>>
>>> Thanks,
>>> Khilan
>>>
>> _______________________________________________
>> 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