From 61f0cee8e4e0c5bd90bf6bd5b794efebc7e872e9 Mon Sep 17 00:00:00 2001 From: adash Date: Tue, 6 Nov 2007 09:37:33 +0000 Subject: [PATCH] Add IndexDescritor.java to handle arrays Fix bugs and new changes to support IndexDescriptor and New prefetchpair Handle FlatLiteralNodes --- .../Analysis/Prefetch/IndexDescriptor.java | 109 ++++++++ .../Analysis/Prefetch/PrefetchAnalysis.java | 263 ++++++++++++------ .../src/Analysis/Prefetch/PrefetchPair.java | 73 ++--- 3 files changed, 332 insertions(+), 113 deletions(-) create mode 100644 Robust/src/Analysis/Prefetch/IndexDescriptor.java diff --git a/Robust/src/Analysis/Prefetch/IndexDescriptor.java b/Robust/src/Analysis/Prefetch/IndexDescriptor.java new file mode 100644 index 00000000..5bb9fe2c --- /dev/null +++ b/Robust/src/Analysis/Prefetch/IndexDescriptor.java @@ -0,0 +1,109 @@ +/* + * IndexDescriptor.java + * Author: Alokika Dash adash@uci.edu + * Date: 11-02-2007 + */ + +package Analysis.Prefetch; +import IR.Flat.*; +import java.util.*; +import IR.*; + +/** + * Descriptor + * + * This class is used to represent the index and index offset of Arrays in + * a prefetch pair + * for eg: for a prefetch pair a[i+z] this class stores var i and var z + */ + +public class IndexDescriptor extends Descriptor { + public ArrayList tddesc; + public Integer offset; + + public IndexDescriptor(Integer offset) { + super(offset.toString()); + this.offset = offset; + } + + public IndexDescriptor(TempDescriptor tdesc, Integer offset) { + super(tdesc.toString()); + if(tddesc == null) + tddesc = new ArrayList(); + tddesc.add(tdesc); + this.offset = offset; + } + + public IndexDescriptor() { + super("Empty"); + tddesc = new ArrayList(); + offset = 0; + } + + public IndexDescriptor(ArrayList tdesc, Integer offset) { + super(tdesc.toString()); + if(tddesc == null) + tddesc = new ArrayList(); + tddesc.addAll(tdesc); + this.offset = offset; + } + + public ArrayList getTempDesc() { + return tddesc; + } + + public TempDescriptor getTempDescAt(int index) { + return (TempDescriptor) tddesc.get(index); + } + + public int getOffset() { + return offset; + } + + public String toString() { + String label="["; + if(getTempDesc() == null) { + label += offset.toString(); + return label; + } else { + ListIterator lit = getTempDesc().listIterator(); + for(;lit.hasNext();) { + TempDescriptor td = (TempDescriptor) lit.next(); + label += td.toString()+"+"; + } + label +=offset.toString(); + } + label += "]"; + return label; + } + + public int hashCode() { + int hashcode = (Integer) offset.hashCode(); + if(tddesc != null) { + ListIterator lit = tddesc.listIterator(); + while(lit.hasNext()) { + hashcode = hashcode ^ lit.next().hashCode(); + } + } + return hashcode; + } + + public boolean equals(Object o) { + if(o instanceof IndexDescriptor) { + IndexDescriptor idesc = (IndexDescriptor) o; + if(!offset.equals(idesc.offset)) { + return false; + } + if(tddesc == null && idesc.tddesc == null) { + return true; + } else if(tddesc!=null && idesc.tddesc!=null) { + if(tddesc.equals((ArrayList)idesc.tddesc)){ + return true; + } + }else { + return false; + } + } + return false; + } +} diff --git a/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java b/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java index ef36272f..cc934976 100644 --- a/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java +++ b/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java @@ -3,6 +3,7 @@ package Analysis.Prefetch; import java.util.*; import Analysis.CallGraph.CallGraph; import Analysis.Prefetch.PrefetchPair; +import Analysis.Prefetch.IndexDescriptor; import IR.SymbolTable; import IR.State; import IR.TypeUtil; @@ -19,19 +20,55 @@ public class PrefetchAnalysis { Hashtable> prefetch_hash; public static final int ROUNDED_MODE = 5; + /** This function finds if a tempdescriptor object is found in a given prefetch pair + * It returns true if found else returns false*/ + private boolean isTempDescFound(PrefetchPair pp, TempDescriptor td) { + ArrayList desc = (ArrayList) pp.getDesc(); + ListIterator it = desc.listIterator(); + for(;it.hasNext();) { + Object o = it.next(); + if(o instanceof IndexDescriptor) { + ArrayList tdarray = (ArrayList)((IndexDescriptor)o).tddesc; + if(tdarray.contains(td)) { + return true; + } + } + } + return false; + } + + /** This function creates a new Arraylist of Descriptors by replacing old tempdescriptors with new + * tempdescriptors when there is a match for FlatOpNodes or FlatLiteralNodes */ + private ArrayList getNewDesc(PrefetchPair pp, TempDescriptor td, TempDescriptor newtd) { + ArrayList desc = (ArrayList) pp.getDesc(); + ListIterator it = desc.listIterator(); + for(;it.hasNext();) { + Object currdesc = it.next(); + if(currdesc instanceof IndexDescriptor) { + ArrayList tdarray = (ArrayList)((IndexDescriptor)currdesc).tddesc; + if(tdarray.contains(td)) { + int index = tdarray.indexOf(td); + tdarray.set(index, newtd); + } + } + } + return desc; + } + + /** This function starts the prefetchanalysis */ public PrefetchAnalysis(State state, CallGraph callgraph, TypeUtil typeutil) { - this.typeutil=typeutil; - this.state=state; - this.callgraph=callgraph; - prefetch_hash = new Hashtable(); - DoPrefetch(); + this.typeutil=typeutil; + this.state=state; + this.callgraph=callgraph; + prefetch_hash = new Hashtable(); + DoPrefetch(); } /** This function starts the prefetch analysis */ private void DoPrefetch() { - Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); - while(classit.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)classit.next(); + Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); + while(classit.hasNext()) { + ClassDescriptor cn=(ClassDescriptor)classit.next(); doMethodAnalysis(cn); } } @@ -96,12 +133,18 @@ public class PrefetchAnalysis { case FKind.FlatOpNode: processFlatOpNode(curr, child_hash); break; + case FKind.FlatLiteralNode: + processFlatLiteralNode(curr, child_hash); + break; case FKind.FlatSetElementNode: processFlatSetElementNode(curr, child_hash); break; case FKind.FlatSetFieldNode: processFlatSetFieldNode(curr, child_hash); break; + case FKind.FlatMethod: + //processFlatMethod(curr, child_hash); + break; default: /*If FlatNode is not concerned with the prefetch set of its Child then propagate * prefetches up the FlatNode*/ @@ -179,8 +222,7 @@ public class PrefetchAnalysis { FieldDescriptor currffn_field = currffn.getField(); TempDescriptor currffn_src = currffn.getSrc(); if (currffn_field.getType().isPtr()) { - Boolean b = new Boolean(false); - PrefetchPair pp = new PrefetchPair(currffn_src, (Descriptor) currffn_field, b); + PrefetchPair pp = new PrefetchPair(currffn_src, (Descriptor) currffn_field); Float prob = new Float((float)1.0); currcopy.put(pp, prob); } @@ -191,17 +233,13 @@ public class PrefetchAnalysis { PrefetchPair childpp = null; while (ecld.hasMoreElements()) { childpp = (PrefetchPair) ecld.nextElement(); - if (childpp.base == currffn.getDst() && (childpp.getDesc()!= null || childpp.getisTempDesc()!=null)) { + if (childpp.base == currffn.getDst() && (childpp.getDesc()!= null)) { if (currffn.getField().getType().isPtr()) { - /* Create a new Prefetch set */ + /* Create a new Prefetch set*/ ArrayList newdesc = new ArrayList(); - ArrayList newbool = new ArrayList(); newdesc.add(currffn.getField()); - Boolean b = new Boolean(false); - newbool.add(b); newdesc.addAll(childpp.desc); - newbool.addAll(childpp.isTempDesc); - PrefetchPair newpp = new PrefetchPair(currffn.getSrc(), newdesc, newbool); + PrefetchPair newpp = new PrefetchPair(currffn.getSrc(), newdesc); Float newprob = child_hash.get(childpp).floatValue(); tocompare.put(newpp, newprob); child_hash.remove(childpp); @@ -213,8 +251,7 @@ public class PrefetchAnalysis { child_hash.remove(newpp); } } - } else if(childpp.base == currffn.getDst() && (childpp.getDesc() == null || - childpp.getisTempDesc() == null)) { + } else if(childpp.base == currffn.getDst() && (childpp.getDesc() == null)) { child_hash.remove(childpp); } else { continue; @@ -280,9 +317,10 @@ public class PrefetchAnalysis { /* Do Self analysis of the current node*/ TempDescriptor currfen_index = currfen.getIndex(); + IndexDescriptor idesc = new IndexDescriptor(currfen_index, 0); TempDescriptor currfen_src = currfen.getSrc(); if(currfen.getDst().getType().isPtr()) { - PrefetchPair pp = new PrefetchPair(currfen_src, (Descriptor) currfen_index, true); + PrefetchPair pp = new PrefetchPair(currfen_src, (Descriptor) idesc); Float prob = new Float((float)1.0); currcopy.put(pp, prob); } @@ -293,17 +331,14 @@ public class PrefetchAnalysis { PrefetchPair childpp = null; while (ecld.hasMoreElements()) { childpp = (PrefetchPair) ecld.nextElement(); - if (childpp.base == currfen.getDst() && (childpp.getDesc()!= null || childpp.getisTempDesc()!=null)) { + if (childpp.base == currfen.getDst() && (childpp.getDesc()!= null)) { if (currfen.getDst().getType().isPtr()) { //TODO Modify the Prefetch Pair to insert cases like f=a[i+1] + //if match exists then create a new Prefetch set with the new prefetch pair in a new hash table ArrayList newdesc = new ArrayList(); - ArrayList newbool = new ArrayList(); - newdesc.add(currfen.getIndex()); - Boolean b = new Boolean(true); - newbool.add(b); + newdesc.add((Descriptor)idesc); newdesc.addAll(childpp.desc); - newbool.addAll(childpp.isTempDesc); - PrefetchPair newpp = new PrefetchPair(currfen.getSrc(), newdesc, newbool); + PrefetchPair newpp = new PrefetchPair(currfen.getSrc(), newdesc); Float newprob = child_hash.get(childpp).floatValue(); tocompare.put(newpp, newprob); child_hash.remove(childpp); @@ -315,8 +350,7 @@ public class PrefetchAnalysis { child_hash.remove(newpp); } } - } else if(childpp.base == currfen.getDst() && (childpp.getDesc() == null || - childpp.getisTempDesc() == null)) { + } else if(childpp.base == currfen.getDst() && (childpp.getDesc() == null)) { child_hash.remove(childpp); } } @@ -381,26 +415,29 @@ public class PrefetchAnalysis { Enumeration ecld = child_hash.keys(); while (ecld.hasMoreElements()) { childpp = (PrefetchPair) ecld.nextElement(); - if (childpp.base == currfsfn.getDst() && (FieldDescriptor)childpp.getDescAt(0)== currfsfn.getField()) { - if(childpp.getDesc()!= null && childpp.getisTempDesc()!=null) { - if(currfsfn.getSrc().getType().isPtr()) { - ArrayList newdesc = new ArrayList(); - ArrayList newbool = new ArrayList(); - newdesc.addAll(1,childpp.desc); - newbool.addAll(1,childpp.isTempDesc); - PrefetchPair newpp = new PrefetchPair(currfsfn.getSrc(), newdesc, newbool); - Float newprob = child_hash.get(childpp).floatValue(); + if(childpp.base == currfsfn.getDst()) { + if((childpp.getDescAt(0) instanceof FieldDescriptor) && (childpp.getDescAt(0) == currfsfn.getField()) + && (childpp.getDescAt(1)!= null)) { + ArrayList newdesc = new ArrayList(); + newdesc.addAll(1,childpp.desc); + PrefetchPair newpp = new PrefetchPair(currfsfn.getSrc(), newdesc); + Float newprob = child_hash.get(childpp).floatValue(); + tocompare.put(newpp, newprob); + child_hash.remove(childpp); + /* Check for independence of prefetch pairs in newly generated and child_hash prefetch pairs + * to compute new probability */ + if(child_hash.containsKey(newpp)) { + newprob = (float)(1.0 - ((1.0 - child_hash.get(newpp).floatValue()) * (1.0 - tocompare.get(newpp).floatValue()))); tocompare.put(newpp, newprob); - child_hash.remove(childpp); - /* Check for independence of prefetch pairs if any in the child prefetch set - * to compute new probability */ - if(child_hash.containsKey(newpp)) { - newprob = (float)(1.0 - ((1.0 - child_hash.get(newpp).floatValue()) * (1.0 - tocompare.get(newpp).floatValue()))); - tocompare.put(newpp, newprob); - child_hash.remove(newpp); - } + child_hash.remove(newpp); } - } + + } else if((childpp.getDescAt(0) instanceof FieldDescriptor) && (childpp.getDescAt(0) == currfsfn.getField()) + && (childpp.getDescAt(1)== null)){ + child_hash.remove(childpp); + } else { + continue; + } } } @@ -440,14 +477,14 @@ public class PrefetchAnalysis { while (ecld.hasMoreElements()) { childpp = (PrefetchPair) ecld.nextElement(); //TODO Add comparision for cases like a[i+1]=f.The following only works for cases like a[i]=f - if ((childpp.base == currfsen.getDst()) && ((TempDescriptor)childpp.getDescAt(0)== currfsen.getIndex())) { - if(childpp.getDesc()!= null && childpp.getisTempDesc()!=null) { - if(currfsen.getSrc().getType().isPtr()) { + if (childpp.base == currfsen.getDst()){ + if((childpp.getDescAt(0) instanceof IndexDescriptor)) { + if((((IndexDescriptor)childpp.getDescAt(0)).tddesc.get(0) == currfsen.getIndex()) + && (((IndexDescriptor)(childpp.getDescAt(0))).tddesc.get(1) == null) && (childpp.getDescAt(1)!=null)) { + //if match exists then create a new Prefetch set with the new prefetch pair in a new hash table ArrayList newdesc = new ArrayList(); - ArrayList newbool = new ArrayList(); newdesc.addAll(1,childpp.desc); - newbool.addAll(1,childpp.isTempDesc); - PrefetchPair newpp = new PrefetchPair(currfsen.getSrc(), newdesc, newbool); + PrefetchPair newpp = new PrefetchPair(currfsen.getSrc(), newdesc); Float newprob = child_hash.get(childpp).floatValue(); tocompare.put(newpp, newprob); child_hash.remove(childpp); @@ -458,11 +495,15 @@ public class PrefetchAnalysis { tocompare.put(newpp, newprob); child_hash.remove(newpp); } + } else if((((IndexDescriptor)childpp.getDescAt(0)).tddesc.get(0) == currfsen.getIndex()) && + (((IndexDescriptor) (childpp.getDescAt(0))).tddesc.get(1) == null) && (childpp.getDescAt(1)==null)) { + child_hash.remove(childpp); + } else { + continue; } - } + } } } - /* Merge child prefetch pairs */ ecld = child_hash.keys(); while(ecld.hasMoreElements()) { @@ -470,7 +511,6 @@ public class PrefetchAnalysis { tocompare.put(childpp, child_hash.get(childpp)); child_hash.remove(childpp); } - /* Compare with the orginal prefetch pairs */ pSetHasChanged = comparePrefetchSets(prefetch_hash.get(curr), tocompare); /* Enqueue parent nodes */ @@ -482,6 +522,7 @@ public class PrefetchAnalysis { prefetch_hash.put(curr,tocompare); } } + /** This function applies rules and does analysis for a FlatOpNode * And updates the global prefetch hashtable * */ @@ -498,15 +539,14 @@ public class PrefetchAnalysis { ecld = child_hash.keys(); while (ecld.hasMoreElements()) { childpp = (PrefetchPair) ecld.nextElement(); - ArrayList copychildpp = (ArrayList) childpp.desc.clone(); - ArrayList copybool = (ArrayList) childpp.isTempDesc.clone(); - /* Base of child prefetch pair same as destination of the current FlatOpNode */ + PrefetchPair copyofchildpp = (PrefetchPair) childpp.clone(); + + /* Base of child prefetch pair same as destination of the current FlatOpNode + * For cases like x=y followed by t=x[i] or t=x.g*/ if(childpp.base == currfopn.getDest()) { ArrayList newdesc = new ArrayList(); - ArrayList newbool = new ArrayList(); newdesc.addAll(childpp.desc); - newbool.addAll(childpp.isTempDesc); - PrefetchPair newpp = new PrefetchPair(currfopn.getLeft(), newdesc, newbool); + PrefetchPair newpp = new PrefetchPair(currfopn.getLeft(), newdesc); Float newprob = child_hash.get(childpp).floatValue(); tocompare.put(newpp, newprob); child_hash.remove(childpp); @@ -517,36 +557,29 @@ public class PrefetchAnalysis { tocompare.put(newpp, newprob); child_hash.remove(newpp); } - /* Any member of the desc of child prefetch pair is same as destination of the current FlatOpNode */ - } else if(copychildpp.contains(currfopn.getDest())) { - index = copychildpp.indexOf((TempDescriptor)currfopn.getDest()); - copychildpp.set(index, currfopn.getLeft()); - /* Check if TempDescriptor */ - if(copybool.get(index).booleanValue() == false){ - copybool.set(index, true); - } + /* Any member of the desc of child prefetch pair is same as destination of the current FlatOpNode + * For cases like x=y followed by t = r[i].x or t =r[x].p or t = r[p+x].q*/ + } else if(isTempDescFound(copyofchildpp, currfopn.getDest())) { ArrayList newdesc = new ArrayList(); - ArrayList newbool = new ArrayList(); - newdesc.addAll(copychildpp); - newbool.addAll(copybool); - PrefetchPair newpp = new PrefetchPair(childpp.base, newdesc, newbool); + newdesc.addAll((ArrayList)getNewDesc(copyofchildpp, currfopn.getDest(), currfopn.getLeft())); + //ArrayList newdesc = (ArrayList)getNewDesc(copyofchildpp, currfopn.getDest(), currfopn.getLeft()); + PrefetchPair newpp = new PrefetchPair(childpp.base, newdesc); Float newprob = child_hash.get(childpp).floatValue(); tocompare.put(newpp, newprob); child_hash.remove(childpp); /* Check for independence of prefetch pairs if any in the child prefetch set - * to compute new probability */ + * to compute new probability*/ if(child_hash.containsKey(newpp)) { newprob = (float)(1.0 - ((1.0 - child_hash.get(newpp).floatValue()) * (1.0 - tocompare.get(newpp).floatValue()))); tocompare.put(newpp, newprob); child_hash.remove(newpp); } - }else { - continue; + continue; } } } else if(currfopn.getRight()!=null) { - //FIXME + //FIXME case i = i+z followed by a[i].x } else { //FIXME } @@ -571,8 +604,80 @@ public class PrefetchAnalysis { } } + private void processFlatLiteralNode(FlatNode curr, Hashtable child_hash) { + boolean pSetHasChanged = false; + Hashtable tocompare = new Hashtable(); + FlatLiteralNode currfln = (FlatLiteralNode) curr; + Enumeration ecld = null; + PrefetchPair childpp = null; + + if(currfln.getType().isIntegerType()) { + ecld = child_hash.keys(); + while (ecld.hasMoreElements()) { + childpp = (PrefetchPair) ecld.nextElement(); + PrefetchPair copyofchildpp = (PrefetchPair) childpp.clone(); + /* Check for same index in child prefetch pairs + * for cases like i = 0 followed by t = a[i].r or t = a[j+i].r or t = a[j].b[i].r*/ + if(isTempDescFound(copyofchildpp,currfln.getDst())) { + ArrayList copychilddesc = (ArrayList) copyofchildpp.getDesc(); + ListIterator it = copychilddesc.listIterator(); + for(;it.hasNext();) { + Object o = it.next(); + if(o instanceof IndexDescriptor) { + ArrayList td = (ArrayList)((IndexDescriptor)o).tddesc; + for(ListIterator lit = td.listIterator();lit.hasNext();) { + if(td.contains(currfln.getDst())) { + int index = td.indexOf(currfln.getDst()); + ((IndexDescriptor)o).offset = (Integer)currfln.getValue(); + td.remove(index); + } + } + } + } + ArrayList newdesc = new ArrayList(); + newdesc.addAll(copychilddesc); + PrefetchPair newpp = new PrefetchPair(childpp.base, newdesc); + Float newprob = (child_hash.get(childpp)).floatValue(); + tocompare.put(newpp, newprob); + child_hash.remove(childpp); + /* Check for independence of prefetch pairs if any in the child prefetch set + * to compute new probability */ + if(child_hash.containsKey(newpp)) { + newprob = (float)(1.0 - ((1.0 - child_hash.get(newpp).floatValue()) * (1.0 - tocompare.get(newpp).floatValue()))); + tocompare.put(newpp, newprob); + child_hash.remove(newpp); + } + } + } + } + + /* Merge child prefetch pairs */ + ecld = child_hash.keys(); + while(ecld.hasMoreElements()) { + childpp = (PrefetchPair) ecld.nextElement(); + tocompare.put(childpp, child_hash.get(childpp)); + child_hash.remove(childpp); + } + + /* Compare with the orginal prefetch pairs */ + pSetHasChanged = comparePrefetchSets(prefetch_hash.get(curr), tocompare); + /* Enqueue parent nodes */ + if(pSetHasChanged) { + for(int i=0; i currhash = (Hashtable) prefetch_hash.get(fn); diff --git a/Robust/src/Analysis/Prefetch/PrefetchPair.java b/Robust/src/Analysis/Prefetch/PrefetchPair.java index ee4c8c91..26e58084 100644 --- a/Robust/src/Analysis/Prefetch/PrefetchPair.java +++ b/Robust/src/Analysis/Prefetch/PrefetchPair.java @@ -4,49 +4,37 @@ import java.util.*; import IR.*; public class PrefetchPair { - TempDescriptor base; - ArrayList desc; - ArrayList isTempDesc; //Keeps track if the desc is a FieldDescriptor or TempDescriptor. Has same size() as desc - + public TempDescriptor base; + public ArrayList desc; - public PrefetchPair() { + public PrefetchPair(){ + desc = new ArrayList(); } public PrefetchPair(TempDescriptor t) { base = t; desc = null; - isTempDesc = null; } - public PrefetchPair(TempDescriptor t, Descriptor f, Boolean type) { + public PrefetchPair(TempDescriptor t, Descriptor f) { base = t; if (desc == null) desc = new ArrayList(); - if (isTempDesc == null) - isTempDesc = new ArrayList(); desc.add(f); - isTempDesc.add(type); } - public PrefetchPair(TempDescriptor t, ArrayList descriptor, ArrayList bool) { + public PrefetchPair(TempDescriptor t, ArrayList descriptor) { base = t; if(desc == null){ desc = new ArrayList(); } - if(isTempDesc == null) - isTempDesc = new ArrayList(); desc.addAll(descriptor); - isTempDesc.addAll(bool); } public TempDescriptor getBase() { return base; } - public boolean isTempDescDesc(int index) { - return isTempDesc.get(index).booleanValue(); - } - public Descriptor getDescAt(int index) { return desc.get(index); } @@ -55,16 +43,12 @@ public class PrefetchPair { return desc; } - public ArrayList getisTempDesc() { - return isTempDesc; - } - public FieldDescriptor getFieldDesc(int index) { return (FieldDescriptor) desc.get(index); } - public TempDescriptor getTempDesc(int index) { - return (TempDescriptor) desc.get(index); + public IndexDescriptor getIndexDesc(int index) { + return (IndexDescriptor) desc.get(index); } public int hashCode() { @@ -80,18 +64,17 @@ public class PrefetchPair { public String toString() { String label= getBase().toString(); - if(getDesc() == null || getisTempDesc() == null) + if(getDesc() == null) return label; ListIterator it=getDesc().listIterator(); - ListIterator istemp=getisTempDesc().listIterator(); - for(;it.hasNext() && istemp.hasNext();) { - Boolean isFd = (Boolean) istemp.next(); - if(isFd.booleanValue() == false) { - FieldDescriptor fd = (FieldDescriptor) it.next(); + for(;it.hasNext();) { + Object o = it.next(); + if(o instanceof FieldDescriptor) { + FieldDescriptor fd = (FieldDescriptor) o; label+="."+ fd.toString(); } else { - TempDescriptor td = (TempDescriptor) it.next(); - label+="."+ td.toString(); + IndexDescriptor id = (IndexDescriptor) o; + label+= id.toString(); } } return label; @@ -106,12 +89,34 @@ public class PrefetchPair { if (desc == null && pp.desc == null) { return true; } else if (desc != null && pp.desc != null) { - if (desc.equals((List)pp.desc) && - isTempDesc.equals((List)pp.isTempDesc)) { + if (desc.equals((ArrayList)pp.desc)) { return true; } + } else { + return false; } } return false; } + + public Object clone() { + PrefetchPair newpp = new PrefetchPair(); + newpp.base = this.base; + ArrayList td = new ArrayList(); + for(int i = 0; i