[Soot-list] [Negative Stack height ?]
lpxz
lpxz at ust.hk
Mon Sep 14 11:55:33 EDT 2009
Hello:
Can you help me with the transforming problems. I want to make a new
method called getValue_TX(), but as it is a little complex to write, I
would like to reuse other jimple statement with minor modification, for
example, I
read every statement of getXXX_TX using Iterator iterator=units.iterator().
for those identity statment, I provide new version manually.
for those variables used in getXXX_TX, I set a new Type for that Value.
for those variables defined, I add them to my new method's local set.
If I do this using "-f J", it can pass the jimple validate part, and it
did not report "local not declared". but if I use "-f c", it would
report exception like this:
*Exception in thread "main" java.lang.RuntimeException:* Negative Stack
height has been attained in :<dstm2.benchmark.aj.INode: int getValue_TX()>
StackHeight: -1
At instruction:athrow
Block:
Block 1:
[preds: ] [succs: ]
load.r this;
exitmonitor;
athrow;
Method: getValue_TX
<dstm2.benchmark.aj.INode: int getValue_TX()>
at soot.baf.JasminClass.calculateStackHeight(JasminClass.java:1819)
at soot.baf.JasminClass.emitMethodBody(JasminClass.java:274)
at soot.AbstractJasminClass.emitMethod(AbstractJasminClass.java:689)
at soot.AbstractJasminClass.<init>(AbstractJasminClass.java:568)
at soot.baf.JasminClass.<init>(JasminClass.java:44)
at soot.PackManager.writeClass(PackManager.java:877)
at soot.PackManager.writeOutput(PackManager.java:467)
at soot.PackManager.writeOutput(PackManager.java:394)
at aBunchOfTestForBodyPhase.ATTAnalysis.main(ATTAnalysis.java:48)
*and the corresponding jimple code when I use "-f c" is there were an
email in the mailing list asking about "athrow" probelm, and it was said
using sun jvm can avoid the problem, but I did not get the problem
avoided even under sun jvm. and I do not know too much about the
instructions here, So can anybody shed some light for me please:*
public int getValue_TX()
{
word this, j;
this := @this: dstm2.benchmark.aj.INode;
label0:
push 0;
label1:
load.r this;
label2:
dup1.r;
label3:
store.r this;
label4:
entermonitor;
label5:
push 1;
label6:
add.b;
label7:
store.i j;
label8:
load.r this;
label9:
exitmonitor;
label10:
goto label14;
label11:
load.r this;
label12:
exitmonitor;
label13:
athrow;
label14:
load.i j;
label15:
return.i;
}
*I tried to read the jimple generated using "-f J" myself, and I find I
did not succeed to capture
"catch java.lang.Throwable from label0 to label1 with label2;
catch java.lang.Throwable from label3 to label4 with label2;"
Is this the problem ?
and how can I capture those two statements ,as they are not in the
units.iterate.
*
public int getXXX_TX()
{
aolib.adstm.ExampleITX this, l2, $r0;
byte j;
int j#2;
java.lang.Throwable $r1;
this := @this: aolib.adstm.ExampleITX;
j = 0;
$r0 = this;
l2 = $r0;
entermonitor $r0;
label0:
j#2 = j + 1;
exitmonitor l2;
label1:
goto label5;
label2:
$r1 := @caughtexception;
label3:
exitmonitor l2;
label4:
throw $r1;
label5:
return j#2;
catch java.lang.Throwable from label0 to label1 with label2;
catch java.lang.Throwable from label3 to label4 with label2;
}
public int getValue_TX()
{
dstm2.benchmark.aj.INode this, $r0, l2;
byte j;
int j#2;
java.lang.Throwable $r1;
this := @this: dstm2.benchmark.aj.INode;
j = 0;
$r0 = this;
l2 = $r0;
entermonitor $r0;
j#2 = j + 1;
exitmonitor l2;
goto label0;
$r1 := @caughtexception;
exitmonitor l2;
throw $r1;
label0:
return j#2;
}
Thank you for your help !
Regards
Peng
More information about the Soot-list
mailing list