From 07b354f4aa4206d51a6e1d7728c494846c95ddf1 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 3 Apr 2009 20:40:20 +0000 Subject: [PATCH] support for STM --- .../Locality/GenerateConversions.java | 4 +- .../Analysis/Locality/LocalityAnalysis.java | 196 +++++++++++++++++- 2 files changed, 197 insertions(+), 3 deletions(-) diff --git a/Robust/src/Analysis/Locality/GenerateConversions.java b/Robust/src/Analysis/Locality/GenerateConversions.java index 8ee501b6..d241970d 100644 --- a/Robust/src/Analysis/Locality/GenerateConversions.java +++ b/Robust/src/Analysis/Locality/GenerateConversions.java @@ -111,7 +111,7 @@ public class GenerateConversions { * locality. */ for(Iterator writeit=writes.iterator(); writeit.hasNext();) { TempDescriptor wrtmp=writeit.next(); - if (nodetemptab.get(wrtmp)==LocalityAnalysis.GLOBAL) { + if (nodetemptab.get(wrtmp)==LocalityAnalysis.GLOBAL||state.SINGLETM) { TempNodePair tnp=new TempNodePair(wrtmp); tempset.add(tnp); } @@ -188,7 +188,7 @@ public class GenerateConversions { TempDescriptor [] readtemps=fn.readsTemps(); for(int i=0; i()); + classtolb.get(lbmain.getMethod().getClassDesc()).add(lbmain); + + if (!methodtolb.containsKey(lbmain.getMethod())) + methodtolb.put(lbmain.getMethod(), new HashSet()); + methodtolb.get(lbmain.getMethod()).add(lbmain); + + //Do this to force a virtual table number for the run method + lbrun=new LocalityBinding(typeutil.getRun(), false); + lbtovisit.add(lbrun); + + discovered.put(lbrun, lbrun); + if (!classtolb.containsKey(lbrun.getMethod().getClassDesc())) + classtolb.put(lbrun.getMethod().getClassDesc(), new HashSet()); + classtolb.get(lbrun.getMethod().getClassDesc()).add(lbrun); + + if (!methodtolb.containsKey(lbrun.getMethod())) + methodtolb.put(lbrun.getMethod(), new HashSet()); + methodtolb.get(lbrun.getMethod()).add(lbrun); + + while(!lbtovisit.empty()) { + LocalityBinding lb=(LocalityBinding) lbtovisit.pop(); + Integer returnglobal=lb.getGlobalReturn(); + MethodDescriptor md=lb.getMethod(); + Hashtable atomictable=new Hashtable(); + calldep.remove(lb); + try { + computeCallsFlagsSTM(md, lb, atomictable); + } catch (Error e) { + System.out.println("Error in "+md+" context "+lb); + e.printStackTrace(); + System.exit(-1); + } + atomictab.put(lb, atomictable); + } + } + + public void computeCallsFlagsSTM(MethodDescriptor md, LocalityBinding lb, Hashtable atomictable) { + FlatMethod fm=state.getMethodFlat(md); + HashSet tovisit=new HashSet(); + tovisit.add(fm.getNext(0)); + { + // Build table for initial node + Hashtable table=new Hashtable(); + atomictable.put(fm, lb.isAtomic() ? 1 : 0); + int offset=md.isStatic() ? 0 : 1; + if (!md.isStatic()) { + table.put(fm.getParameter(0), lb.getGlobalThis()); + } + for(int i=offset; i currtable=new Hashtable(); + int atomicstate=0; + for(int i=0; i()); + classtolb.get(lb.getMethod().getClassDesc()).add(lb); + if (!methodtolb.containsKey(lb.getMethod())) + methodtolb.put(lb.getMethod(), new HashSet()); + methodtolb.get(lb.getMethod()).add(lb); + } else + lb=discovered.get(lb); + + if (!dependence.containsKey(lb)) + dependence.put(lb, new HashSet()); + dependence.get(lb).add(currlb); + + if (!calldep.containsKey(currlb)) + calldep.put(currlb, new HashSet()); + calldep.get(currlb).add(lb); + } + } + private void computeLocalityBindings() { lbmain=new LocalityBinding(typeutil.getMain(), false); lbmain.setGlobalReturn(EITHER); @@ -250,6 +441,9 @@ public class LocalityAnalysis { } } + + + public void computeCallsFlags(MethodDescriptor md, LocalityBinding lb, Hashtable> temptable, Hashtable atomictable) { FlatMethod fm=state.getMethodFlat(md); HashSet tovisit=new HashSet(); -- 2.34.1