[Soot-list] How to obtain the topological graph in the transactional transformation phase (wjtp.tn)?

Richard L. Halpert richardlhalpert at gmail.com
Mon Dec 8 13:38:05 EST 2008


Ok, I checked in a real hackish fix to the runtime exception you were
seeing.  For you example there is a JNopStmt in an unexpected location,
which is of course allowed by the JVM spec but was not allowed by
SynchronizedRegionFinder.  I'll try to give this code more attention in the
next week or two, to bring it in line with what the JVM and Java source
specs say, but in the meantime I think it will work OK.

-Rich

On Mon, Dec 8, 2008 at 9:10 AM, Eric Bodden <eric.bodden at mail.mcgill.ca>wrote:

> Marco I was now able to reproduce the problem. Indeed it does show up
> with the current version of Soot. The problem seems to be in
> soot.coffi.CFG. Patrick Lam "fixed" a bug in this class some months
> ago, but apparently that introduced other problems. I have now rolled
> back this "fix" and things seem to work again.
>
> I am not sure why I did not see this earlier. I guess I must have
> confused two versions of Soot, sorray about that. Anyway, the current
> SVN version should work for you.
>
> Eric
>
> 2008/12/8 Marco Bakera <marco.bakera at tu-dortmund.de>:
> > When using the latest release (instead of the development snapshot),
> there are
> > no problems when running Soot. However, in this case the new method that
> > Richard implemented for me is of course not accessible.
> >
> > Maybe there is something wrong with my setup and the way I am building
> Soot.
> > It it possible for you to build a snapshot release that I can use for
> tests?
> >
> > If you are still working on the SynchronizedRegionFinder issue could you
> > please give a guess on how long it will take to fix it? :)
> >
> > Anyhow thanks for your attentive support. :D
> >
> >
> > Thanks for help,
> > Marco.
> >
> > On Thursday 04 December 2008 15:59:30 Marco Bakera wrote:
> >> On Thursday 04 December 2008 15:33:47 Eric Bodden wrote:
> >> > 2008/12/4 Marco Bakera <marco.bakera at tu-dortmund.de>:
> >> > > In contrast to you both I am unable to reproduce your exception -
> >> > > strange. I built Soot with 'ant classesjar' and used it with my
> >> > > testcase. However I always get the stacktrace. Do I possibly need
> some
> >> > > newer version of jasmin or polyglot?
> >> >
> >> > I don't know. What versions of them are you using right now? Are you
> >> > building Soot from SVN?
> >>
> >> Correct. I am building Soot directly from SVN and use the
> polyglot/jasmin
> >> artifacts from release 2.3.0.
> >>
> >> > Eric
> >> >
> >> > > Is the other problem, provided by Eric, crucial for the dead lock
> graph
> >> > > creation? So far either the dead lock graph was null or did not
> contain
> >> > > any nodes.
> >> > >
> >> > > Thanks for your help.
> >> > >
> >> > >
> >> > > Greetings,
> >> > > Marco.
> >> > >
> >> > > On Thursday 04 December 2008 02:22:47 Richard L. Halpert wrote:
> >> > >> SynchronizedRegionFinder is definitely too strict regarding what
> >> > >> bytecode patterns it can work with.  This is something I hope to
> >> > >> someday remedy...
> >> > >>
> >> > >> -Rich
> >> > >>
> >> > >> On Wed, Dec 3, 2008 at 1:02 PM, Eric Bodden
> >> > >
> >> > > <eric.bodden at mail.mcgill.ca>wrote:
> >> > >> > I am unable to reproduce the behavior you are describing.
> >> > >> >
> >> > >> > I do see an exception but not the kind of exception you reported
> >> > >> > when I run the current version of Soot on your LockGraphTest
> class.
> >> > >> >
> >> > >> > Soot started on Wed Dec 03 15:52:16 GMT-05:00 2008
> >> > >> > No main class given. Inferred 'LockGraphTest' as main class.
> >> > >> > [Call Graph] For information on where the call graph may be
> >> > >> > incomplete, use the verbose option to the cg phase.
> >> > >> > [Spark] Pointer Assignment Graph in 6.0 seconds.
> >> > >> > [Spark] Type masks in 0.7 seconds.
> >> > >> > [Spark] Pointer Graph simplified in 0.0 seconds.
> >> > >> > [Spark] Propagation in 88.9 seconds.
> >> > >> > [Spark] Solution found in 89.0 seconds.
> >> > >> > [wjtp.tn] *** Build May-Happen-in-Parallel Info *** Wed Dec 03
> >> > >> > 15:54:01 GMT-05:00 2008
> >> > >> > [mhp]
> >> > >> > [mhp] Main Thread (Single, ---,---):
> >> > >> > [mhp] [<LockGraphTest: void main(java.lang.String[])>
> >> > >> > [mhp]   <LockGraphTest: void setI(int)>
> >> > >> > [mhp]   <LockGraphTest: void <init>()>
> >> > >> > [mhp]   <LockGraphTest: void setF(LockGraphTest)>
> >> > >> > [mhp]   <LockGraphTest: float getF()>]
> >> > >> > [mhp]
> >> > >> > [wjtp.tn] *** Find and Name Transactions *** Wed Dec 03 15:54:01
> >> > >> > GMT-05:00 2008
> >> > >> > Warning: using default implementation of addAll. You should
> >> > >> > implement a faster specialized implementation.
> >> > >> > this is of type soot.jimple.spark.sets.HashPointsToSet
> >> > >> > other is of type soot.jimple.spark.sets.HybridPointsToSet
> >> > >> > exclude is null
> >> > >> > Exception in thread "main" java.lang.RuntimeException: Unknown
> >> > >> > bytecode pattern: exitmonitor not followed by return,
> exitmonitor,
> >> > >> > goto, or throw
> >> > >> >        at
> >> > >> >
> soot.jimple.toolkits.thread.synchronization.SynchronizedRegionFinder
> >> > >> >.f low Through(SynchronizedRegionFinder.java:270) at
> >> > >> >
> soot.jimple.toolkits.thread.synchronization.SynchronizedRegionFinder
> >> > >> >.f low Through(SynchronizedRegionFinder.java:18) at
> >> > >> >
> soot.toolkits.scalar.ForwardFlowAnalysis.doAnalysis(ForwardFlowAnaly
> >> > >> >si s.j ava:162) at
> >> > >> >
> soot.jimple.toolkits.thread.synchronization.SynchronizedRegionFinder
> >> > >> >.< ini t>(SynchronizedRegionFinder.java:75) at
> >> > >> >
> soot.jimple.toolkits.thread.synchronization.LockAllocator.internalTr
> >> > >> >an sfo rm(LockAllocator.java:168) at
> >> > >> > soot.SceneTransformer.transform(SceneTransformer.java:39) at
> >> > >> > soot.Transform.apply(Transform.java:89)
> >> > >> >         at soot.ScenePack.internalApply(ScenePack.java:43)
> >> > >> >         at soot.Pack.apply(Pack.java:114)
> >> > >> >         at
> >> > >> > soot.PackManager.runWholeProgramPacks(PackManager.java:407) at
> >> > >> > soot.PackManager.runPacks(PackManager.java:327)
> >> > >> >        at soot.Main.run(Main.java:202)
> >> > >> >        at soot.Main.main(Main.java:145)
> >> > >> >         at MyMain.main(MyMain.java:45)
> >> > >> >
> >> > >> >
> >> > >> > This exception only points to an apparent shortcoming of the
> current
> >> > >> > implementation of SynchronizedRegionFinder.
> >> > >> >
> >> > >> > Eric
> >> > >> >
> >> > >> > 2008/12/1 Marco Bakera <marco.bakera at tu-dortmund.de>:
> >> > >> > > You are right, Eric. The problem does not occur in any case.
> The
> >> > >> >
> >> > >> > following
> >> > >> >
> >> > >> > > piece of code provides such an example that runs into problems.
> >> > >> > >
> >> > >> > > public class LockGraphTest {
> >> > >> > >        private final Object lockI = new Object();
> >> > >> > >        private final Object lockF = new Object();
> >> > >> > >        private int iVal;
> >> > >> > >        private float fVal;
> >> > >> > >
> >> > >> > >        public LockGraphTest() {
> >> > >> > >        }
> >> > >> > >
> >> > >> > >        public void setI(int newValue) {
> >> > >> > >                synchronized(lockI) {
> >> > >> > >                        iVal = newValue;
> >> > >> > >                }
> >> > >> > >        }
> >> > >> > >
> >> > >> > >        public void setF(LockGraphTest lgt) {
> >> > >> > >                synchronized(lockF) {
> >> > >> > >                        fVal = (int) lgt.getF();
> >> > >> > >                }
> >> > >> > >        }
> >> > >> > >
> >> > >> > >        public float getF() {
> >> > >> > >                synchronized(lockF) {
> >> > >> > >                        return fVal;
> >> > >> > >                }
> >> > >> > >        }
> >> > >> > >
> >> > >> > >
> >> > >> > >        public static void main(String[] args) {
> >> > >> > >                LockGraphTest lgtF = new LockGraphTest();
> >> > >> > >                lgtF.setI(7);
> >> > >> > >
> >> > >> > >                LockGraphTest lgtI = new LockGraphTest();
> >> > >> > >                lgtI.setI(5);
> >> > >> > >                lgtI.setI(6);
> >> > >> > >                lgtI.setF(lgtF);
> >> > >> > >        }
> >> > >> > > }
> >> > >> > >
> >> > >> > > On Thursday 27 November 2008 15:39:35 Eric Bodden wrote:
> >> > >> > >> Marco does this happen when you apply Soot to any application
> or
> >> > >> > >> only if you apply it to one special program? In the latter
> case
> >> > >> > >> it would help to know what program that would be.
> >> > >> > >>
> >> > >> > >> Cheers,
> >> > >> > >> Eric
> >> > >> > >>
> >> > >> > >> 2008/11/27 Marco Bakera <marco.bakera at tu-dortmund.de>:
> >> > >> > >> > On Monday 10 November 2008 19:42:52 Richard L. Halpert
> wrote:
> >> > >> > >> >> 1) The LockAllocator uses a may-alias relationship to group
> >> > >> > >> >> locks together - so if lock1 in *may* be the same as lock2,
> >> > >> > >> >> they would be treated as a single lock (and the two
> critical
> >> > >> > >> >> sections would be put
> >> > >> >
> >> > >> > in
> >> > >> >
> >> > >> > >> >> the same CriticalSectionGroup).  The Lock allocator
> constructs
> >> > >> > >> >> this graph for the sake of deadlock detection.  You can use
> >> > >> > >> >> the deadlock detection graph by calling
> >> > >> >
> >> > >> >
> soot.jimple.toolkits.thread.synchronization.LockAllocation.getDeadlo
> >> > >> >ck Gr
> >> > >> >
> >> > >> > >> >>aph (). The nodes are CriticalSectionGroups, and the edges
> >> > >> > >> >> represent calls from a critical section in one group to a
> >> > >> > >> >> critical section in another group.  Be sure to call Soot
> with
> >> > >> > >> >> "-p wjtp.tn
> >> > >> > >> >> avoid-deadlock:false", or else the deadlock detector may
> stop
> >> > >> > >> >> constructing the graph early if it finds potential
> deadlock.
> >> > >> > >> >
> >> > >> > >> > That sounds great and I will use this. :) Thanks for that
> hint.
> >> > >> >
> >> > >> > However
> >> > >> >
> >> > >> > >> > when trying the following lines of code.
> >> > >> > >> >
> >> > >> > >> >                String args =
> >> > >> > >> >                        "-w --app " +
> >> > >> > >> >                        // options for call graph creation
> >> > >> > >> >                        "-p cg.cha enabled:false " +
> >> > >> > >> >                        "-p cg.spark enabled:true " +
> >> > >> > >> >                        // options for whole jimple
> >> > >> > >> > transformation pack "-p wjtp.tn enabled:true " +
> >> > >> > >> >                        "-p wjtp.tn avoid-deadlock:false " +
> >> > >> > >> >                        "-p wjtp.tn do-tlo:false " +
> >> > >> > >> >                        "-p wjtp.tn do-mhp:true " +
> >> > >> > >> >                        // the main application class
> >> > >> > >> >                        mainClass.getName();
> >> > >> > >> >
> >> > >> > >> >                // start soot
> >> > >> > >> >                LOG.debug("Starting Soot with command line:
> >> > >> > >> > "+args); Main.main(args.split(" "));
> >> > >> > >> >
> >> > >> > >> > I get the following exception from the main method:
> >> > >> > >> >
> >> > >> > >> > java.lang.RuntimeException: trying to hash null value.
> >> > >> > >> >        at soot.util.HashChain.getPredOf(HashChain.java:338)
> >> > >> > >> >        at
> soot.PatchingChain.getPredOf(PatchingChain.java:225)
> >> > >> > >> >        at
> >> > >> >
> >> > >> >
> soot.toolkits.graph.ExceptionalUnitGraph.buildExceptionDests(Excepti
> >> > >> >on alU
> >> > >> >
> >> > >> > >> >nitGraph.java:337) at
> >> > >> >
> >> > >> >
> soot.toolkits.graph.ExceptionalUnitGraph.initialize(ExceptionalUnitG
> >> > >> >ra ph.
> >> > >> >
> >> > >> > >> >java:263) at
> >> > >> >
> >> > >> >
> soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph
> >> > >> >.j ava
> >> > >> >
> >> > >> > >> >:149) at
> >> > >> >
> >> > >> >
> soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph
> >> > >> >.j ava
> >> > >> >
> >> > >> > >> >:182) at
> >> > >> >
> >> > >> >
> soot.toolkits.scalar.LocalSplitter.internalTransform(LocalSplitter.j
> >> > >> >av a:7
> >> > >> >
> >> > >> > >> >7) at soot.BodyTransformer.transform(BodyTransformer.java:51)
> at
> >> > >> > >> > soot.Transform.apply(Transform.java:104)
> >> > >> > >> >        at
> >> > >> >
> >> > >> > soot.JimpleBodyPack.applyPhaseOptions(JimpleBodyPack.java:57)
> >> > >> >
> >> > >> > >> >        at
> >> > >> > >> > soot.JimpleBodyPack.internalApply(JimpleBodyPack.java:89) at
> >> > >> > >> > soot.Pack.apply(Pack.java:124)
> >> > >> > >> >        at
> >> > >> > >> >
> soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:117
> >> > >> > >> >) at
> soot.SootMethod.getBodyFromMethodSource(SootMethod.java:82)
> >> > >> > >> > at soot.SootMethod.retrieveActiveBody(SootMethod.java:329)
> at
> >> > >> >
> >> > >> >
> soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processNewMetho
> >> > >> >d( OnF
> >> > >> >
> >> > >> > >> >lyCallGraphBuilder.java:181) at
> >> > >> >
> >> > >> >
> soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachabl
> >> > >> >es (On
> >> > >> >
> >> > >> > >> >FlyCallGraphBuilder.java:81) at
> >> > >> > >> >
> soot.jimple.spark.solver.OnFlyCallGraph.build(OnFlyCallGraph.ja
> >> > >> > >> >va
> >> > >> > >> >
> >> > >> > >> >:55 )
> >> > >> >
> >> > >> > at
> >> > >> >
> >> > >> >
> soot.jimple.spark.solver.PropWorklist.handleVarNode(PropWorklist.jav
> >> > >> >a: 123
> >> > >> >
> >> > >> > >> >) at
> >> > >> >
> >> > >> >
> soot.jimple.spark.solver.PropWorklist.propagate(PropWorklist.java:53
> >> > >> >)
> >> > >> >
> >> > >> > >> > at
> >> > >> >
> >> > >> >
> soot.jimple.spark.SparkTransformer.internalTransform(SparkTransforme
> >> > >> >r. jav
> >> > >> >
> >> > >> > >> >a:151) at
> >> > >> > >> > soot.SceneTransformer.transform(SceneTransformer.java:39) at
> >> > >> > >> > soot.Transform.apply(Transform.java:89)
> >> > >> > >> >        at
> >> > >> > >> > soot.RadioScenePack.internalApply(RadioScenePack.java:57) at
> >> > >> >
> >> > >> >
> soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraph
> >> > >> >Pa ck.
> >> > >> >
> >> > >> > >> >java:47) at soot.Pack.apply(Pack.java:114)
> >> > >> > >> >        at
> >> > >> > >> > soot.PackManager.runWholeProgramPacks(PackManager.java:406)
> at
> >> > >> > >> > soot.PackManager.runPacks(PackManager.java:327)
> >> > >> > >> >        at soot.Main.run(Main.java:202)
> >> > >> > >> >        at soot.Main.main(Main.java:145)
> >> > >> > >> >
> >> > >> > >> > The problem is only present when using the development
> version
> >> > >> > >> > of Soot from the SVN repository. Release 2.3.0 has no
> problems.
> >> > >> > >> > However, the method to obtain the Deadlock Graph is not
> present
> >> > >> > >> > there. :)
> >> > >> > >> >
> >> > >> > >> > Thanks for your help.
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> >
> >> > >> > >> > Greetings,
> >> > >> > >> > Marco.
> >
>
>
>
> --
> Eric Bodden
> Sable Research Group, McGill University, Montréal, Canada
> Got an interesting job offer? http://www.bodden.de/hire-me/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20081208/d0ce7653/attachment-0001.htm


More information about the Soot-list mailing list