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

read/write sets for a Unit



Hello,

I'm curious as to what the correct way to access read/write sets for a given Unit is from within a BodyTransformer. I'm assuming that what I'm doing is violating some precondition on the SideEffectTester code, because it's not working. (Therefore, the rest of this message, which explains what I am doing now, can probably be skimmed or skipped if it's clearly wrong.)

Right now, what I'm doing is pretty convoluted (and I'm pretty sure that it's wrong -- both a priori and because I get occasional ClassCastExceptions from deep within soot code). My basic approach is to override PASideEffectTester with a class that will let me access the fields in readSet() and writeSet(), instantiate that class in my BodyTransformer and invoke its newMethod method with the Method corresponding to the current Body, and then invoking the methods on my SideEffectTester-derived class that return the getFields() set from the RWSets returned by readSet and writeSet. I then run soot in whole-program mode, enabling spark (my transformation is in the jtp pack).

Occasionally, I'll get exceptions like the following. These occur when analyzing method invocations. It's not clear to me that a particular class of method invocations (i.e. special, static, or virtual) is the culprit; if I catch these exceptions, I can see that some will fail and some will not. Overall, it appears that between 5-45% of attempts to analyze method invocations fail, depending on what program I'm analyzing.

Exception in thread "main" java.lang.ClassCastException
at soot.jimple.toolkits.pointer.SideEffectAnalysis.findNTRWSets(SideEffectA nalysis.java:44)
at soot.jimple.toolkits.pointer.SideEffectAnalysis.nonTransitiveReadSet(Sid eEffectAnalysis.java:57)
at soot.jimple.toolkits.pointer.SideEffectAnalysis.readSet(SideEffectAnalys is.java:90)
at soot.jimple.toolkits.pointer.PASideEffectTester.readSet(PASideEffectTest er.java:65)
at com.willbenton.sootPasses.wbSideEffectMarker$csssemSideEffectTester.read Fields(wbSideEffectMarker.java:13)
at com.willbenton.sootPasses.wbSideEffectMarker.actualTransform(wbSideEffec tMarker.java:90)
at com.willbenton.sootPasses.cwsBaseBodyTransformer.internalTransform(cwsBa seBodyTransformer.java:32)
at soot.BodyTransformer.transform(BodyTransformer.java:51)
at soot.Transform.apply(Transform.java:88)
at soot.BodyPack.internalApply(BodyPack.java:44)
at soot.Pack.apply(Pack.java:110)
at soot.PackManager.runBodyPacks(PackManager.java:423)
at soot.PackManager.runBodyPacks(PackManager.java:282)
at soot.PackManager.runPacks(PackManager.java:241)
at soot.Main.run(Main.java:172)
at soot.Main.main(Main.java:152)
at com.willbenton.sootPasses.wbSideEffectMarker.main(wbSideEffectMarker.jav a:125)


Thanks for any help!




wb


---
Will Benton <willb@cs.wisc.edu>
"Wir sind Bettler, das ist wahr"
recently updated (11/1/03) contact info at: http://www.cs.wisc.edu/~willb/willb.vcf