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

Marco Bakera marco.bakera at tu-dortmund.de
Mon Dec 1 05:03:28 EST 2008


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.getDeadlockGr
> >>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(ExceptionalU
> >nitGraph.java:337) at
> > soot.toolkits.graph.ExceptionalUnitGraph.initialize(ExceptionalUnitGraph.
> >java:263) at
> > soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java
> >:149) at
> > soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java
> >:182) at
> > soot.toolkits.scalar.LocalSplitter.internalTransform(LocalSplitter.java: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.processNewMethod(OnF
> >lyCallGraphBuilder.java:181) at
> > soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(On
> >FlyCallGraphBuilder.java:81) at
> > soot.jimple.spark.solver.OnFlyCallGraph.build(OnFlyCallGraph.java:55) at
> > soot.jimple.spark.solver.PropWorklist.handleVarNode(PropWorklist.java:123
> >) at soot.jimple.spark.solver.PropWorklist.propagate(PropWorklist.java:53)
> > at
> > soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.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(CallGraphPack.
> >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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20081201/95ea5684/attachment.bin


More information about the Soot-list mailing list