From 53fe566129d4594c640f83891c54023492eddefe Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 13 May 2009 00:11:58 +0000 Subject: [PATCH] changes to build slightly more optimal code --- .../Analysis/Locality/DiscoverConflicts.java | 31 +++++++++++++++++-- Robust/src/IR/Flat/BuildCode.java | 5 ++- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Robust/src/Analysis/Locality/DiscoverConflicts.java b/Robust/src/Analysis/Locality/DiscoverConflicts.java index 9f35c7cc..bbd6dc96 100644 --- a/Robust/src/Analysis/Locality/DiscoverConflicts.java +++ b/Robust/src/Analysis/Locality/DiscoverConflicts.java @@ -57,6 +57,8 @@ public class DiscoverConflicts { treadmap.put(lb, set); } + //We have a set of things we write to, figure out what things this + //could effect. public void expandTypes() { Set expandedarrays=new HashSet(); for(Iterator it=arrays.iterator();it.hasNext();) { @@ -104,7 +106,9 @@ public class DiscoverConflicts { HashSet srctrans=new HashSet(); transreadmap.put(lb, tfset); srcmap.put(lb,srctrans); - + + //compute writes that need translation on source + for(Iterator fnit=fm.getNodeSet().iterator();fnit.hasNext();) { FlatNode fn=fnit.next(); Hashtable atomictable=locality.getAtomic(lb); @@ -156,6 +160,7 @@ public class DiscoverConflicts { return fn.kind()==FKind.FlatCall; } + //compute set of nodes that need transread on their output HashSet computeTranslationSet(LocalityBinding lb, FlatMethod fm, Hashtable>> fnmap) { HashSet tfset=new HashSet(); @@ -220,6 +225,9 @@ public class DiscoverConflicts { return tfset; } + //Map for each node from temps to the flatnode and (the temp) that + //first did a field/element read for this value + Hashtable>> computeTempSets(LocalityBinding lb) { Hashtable>> tmptofnset=new Hashtable>>(); HashSet discovered=new HashSet(); @@ -245,8 +253,9 @@ public class DiscoverConflicts { if (atomictable.get(fn).intValue()!=0) { if ((fn.numPrev()>0)&&atomictable.get(fn.getPrev(0)).intValue()==0) { //flatatomic enter node... see what we really need to transread - Set liveset=livetemps.get(fn); + //Set liveset=livetemps.get(fn); ttofn=new Hashtable>(); + /* for(Iterator tmpit=liveset.iterator();tmpit.hasNext();) { TempDescriptor tmp=tmpit.next(); if (tmp.getType().isPtr()) { @@ -254,10 +263,24 @@ public class DiscoverConflicts { fnset.add(new TempFlatPair(tmp, fn)); ttofn.put(tmp, fnset); } - } + }*/ } else { ttofn=doMerge(fn, tmptofnset); switch(fn.kind()) { + case FKind.FlatGlobalConvNode: { + FlatGlobalConvNode fgcn=(FlatGlobalConvNode)fn; + if (lb==fgcn.getLocality()&& + fgcn.getMakePtr()) { + TempDescriptor[] writes=fn.writesTemps(); + for(int i=0;i set=new HashSet(); + set.add(new TempFlatPair(wtmp, fn)); + ttofn.put(wtmp, set); + } + } + break; + } case FKind.FlatFieldNode: case FKind.FlatElementNode: { TempDescriptor[] writes=fn.writesTemps(); @@ -313,6 +336,8 @@ public class DiscoverConflicts { return tmptofnset; } + /* See what fields and arrays transactions might modify. */ + public void computeModified(LocalityBinding lb) { MethodDescriptor md=lb.getMethod(); FlatMethod fm=state.getMethodFlat(md); diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 8b11ed2a..3d8baea0 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -1939,7 +1939,10 @@ public class BuildCode { if (state.DSM) { output.println("TRANSREAD("+generateTemp(fm, fgcn.getSrc(),lb)+", (unsigned int) "+generateTemp(fm, fgcn.getSrc(),lb)+");"); } else { - output.println("TRANSREAD("+generateTemp(fm, fgcn.getSrc(),lb)+", "+generateTemp(fm, fgcn.getSrc(),lb)+", (void *)&("+localsprefix+"));"); + if ((dc==null)||dc.getNeedTrans(lb, fgcn)) { + //need to do translation + output.println("TRANSREAD("+generateTemp(fm, fgcn.getSrc(),lb)+", "+generateTemp(fm, fgcn.getSrc(),lb)+", (void *)&("+localsprefix+"));"); + } } } else { /* Need to convert to OID */ -- 2.34.1