modified compiler files for adding new keyword "getoffset" and adding
authoradash <adash>
Wed, 31 Dec 2008 20:16:53 +0000 (20:16 +0000)
committeradash <adash>
Wed, 31 Dec 2008 20:16:53 +0000 (20:16 +0000)
hack for manual prefetches
check in some files that needed tabbing
runtime still not working but compiling works!

23 files changed:
Robust/src/Analysis/Locality/LocalityAnalysis.java
Robust/src/Analysis/Prefetch/PrefetchAnalysis.java
Robust/src/ClassLibrary/Integer.java
Robust/src/ClassLibrary/String.java
Robust/src/ClassLibrary/System.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/BuildFlat.java
Robust/src/IR/Flat/FKind.java
Robust/src/IR/Tree/BuildIR.java
Robust/src/IR/Tree/Kind.java
Robust/src/IR/Tree/SemanticCheck.java
Robust/src/IR/Tree/TaskExitNode.java
Robust/src/IR/TypeDescriptor.java
Robust/src/IR/TypeUtil.java
Robust/src/Lex/Keyword.java
Robust/src/Lex/Lexer.java
Robust/src/Main/Main.java
Robust/src/Parse/java14.cup
Robust/src/Runtime/DSTM/docs/prefetchnotes
Robust/src/Runtime/DSTM/interface/prefetch.c
Robust/src/Runtime/DSTM/interface/prefetch.h
Robust/src/Runtime/runtime.c
Robust/src/buildscript

index a7e645f5648785ab397828eb84163f4157aa7943..289f7e888622a6a9f21f8b3dcfc0bf75ca882bb6 100644 (file)
@@ -357,6 +357,12 @@ public class LocalityAnalysis {
        throw new Error("Incompatible with tasks!");
 
       case FKind.FlatMethod:
+
+      case FKind.FlatOffsetNode:
+       //System.out.println("In FKind.FlatOffsetNode\n");
+       processOffsetNode((FlatOffsetNode)fn, currtable);
+       break;
+
       default:
        throw new Error();
       }
@@ -432,8 +438,9 @@ public class LocalityAnalysis {
        for(int i=0; i<fc.numArgs(); i++) {
          TempDescriptor arg=fc.getArg(i);
          if(isnative&&(currtable.get(arg).equals(GLOBAL)||
-                       currtable.get(arg).equals(CONFLICT)))
+                       currtable.get(arg).equals(CONFLICT))&& !(nodemd.getSymbol().equals("rangePrefetch"))) {
            throw new Error("Potential call to native method "+md+" with global parameter:\n"+currlb.getExplanation());
+         }
          lb.setGlobal(i,currtable.get(arg));
        }
       }
@@ -566,6 +573,11 @@ public class LocalityAnalysis {
     currtable.put(fon.getDest(), srcvalue);
   }
 
+  void processOffsetNode(FlatOffsetNode fon, Hashtable<TempDescriptor, Integer> currtable) {
+    /* Just propagate value */
+    currtable.put(fon.getDst(), LOCAL);
+  }
+
   void processCastNode(FlatCastNode fcn, Hashtable<TempDescriptor, Integer> currtable) {
     currtable.put(fcn.getDst(), currtable.get(fcn.getSrc()));
   }
index 11397ad6a2740b7375eaec44bdc522b655bdccad..3e06eb5d33058edfcb9040bdc9c4cd462bdd13da 100644 (file)
@@ -144,6 +144,10 @@ public class PrefetchAnalysis {
        processFlatSetFieldNode(curr, child_prefetch_set_copy);
        break;
 
+      case FKind.FlatOffsetNode:
+       processDefaultCase(curr,child_prefetch_set_copy);
+       break;
+
       default:
        throw new Error("No such Flatnode kind");
       }
index 523acb2b2e7abf876834da943cb7e126f45f4061..ae9b7e352de075f90f48186dd233864941e9f7f7 100644 (file)
@@ -57,17 +57,17 @@ public class Integer {
   public String toString() {
     return String.valueOf(value);
   }
-  
+
   public int hashCode() {
-      return value;
+    return value;
   }
 
   public boolean equals(Object o) {
-      if (o.getType()!=getType())
-         return false;
-      Integer s=(Integer)o;
-      if (s.intValue()!=this.value)
-         return false;
-      return true;
+    if (o.getType()!=getType())
+      return false;
+    Integer s=(Integer)o;
+    if (s.intValue()!=this.value)
+      return false;
+    return true;
   }
 }
index 5bdaf0fb57aeba07838ef9b402ae098ca264bd50..56e9ff7c5d9b601a8002b299b60b42d7c73a2a9c 100644 (file)
@@ -271,7 +271,7 @@ public class String {
   }
 
   public static String valueOf(double x) {
-      return valueOf((long)x);
+    return valueOf((long)x);
   }
 
   public static String valueOf(long x) {
index b5f14429639f15322fc13fbdc97006438eefed8e..711769e05f5889fc8100d5639095835a7a242d42 100644 (file)
@@ -17,4 +17,7 @@ public class System {
   public static native void printI(int status);
 
   public static native void clearPrefetchCache();
+
+  public static native void rangePrefetch(Object o, short numoffset,  short[] offsets); //TODO Complete this definition
+
 }
index 82a3d44b9469765b9e860fe47907eeeefe837a3a..cdb43043743e86c3d2667349089dabe5cec9fca4 100644 (file)
@@ -3,6 +3,7 @@ import IR.Tree.FlagExpressionNode;
 import IR.Tree.DNFFlag;
 import IR.Tree.DNFFlagAtom;
 import IR.Tree.TagExpressionList;
+import IR.Tree.OffsetNode;
 import IR.*;
 import java.util.*;
 import java.io.*;
@@ -18,6 +19,7 @@ import Analysis.Locality.LocalityAnalysis;
 import Analysis.Locality.LocalityBinding;
 import Analysis.Prefetch.*;
 
+
 public class BuildCode {
   State state;
   Hashtable temptovar;
@@ -1405,6 +1407,7 @@ public class BuildCode {
     TempObject objecttemps=(TempObject) tempstable.get(lb!=null ? lb : md!=null ? md : task);
 
     if (objecttemps.isLocalPrim(td)||objecttemps.isParamPrim(td)) {
+      //System.out.println("generateTemp returns " + td.getSafeSymbol());
       return td.getSafeSymbol();
     }
 
@@ -1501,10 +1504,23 @@ public class BuildCode {
     case FKind.FlatPrefetchNode:
       generateFlatPrefetchNode(fm,lb, (FlatPrefetchNode) fn, output);
       return;
+
+    case FKind.FlatOffsetNode:
+      generateFlatOffsetNode(fm, lb, (FlatOffsetNode)fn, output);
+      return;
     }
     throw new Error();
   }
 
+  public void generateFlatOffsetNode(FlatMethod fm, LocalityBinding lb, FlatOffsetNode fofn, PrintWriter output) {
+    output.println("/* FlatOffsetNode */");
+    ClassDescriptor cn = fofn.getClassDesc();
+    FieldDescriptor fd = fofn.getField();
+    System.out.println("ClassDescriptor cn =" + cn.toString() + " FieldDescriptor fd =" + fd.toString());
+    System.out.println("TempDescriptor td =" + fofn.getDst().toString() + "Type of TempDescriptor =" + fofn.getDst().getType());
+    output.println("((struct "+cn.getSafeSymbol() +" *)0)->"+ fd.getSafeSymbol()+";");
+  }
+
   public void generateFlatPrefetchNode(FlatMethod fm, LocalityBinding lb, FlatPrefetchNode fpn, PrintWriter output) {
     if (state.PREFETCH) {
       Vector oids = new Vector();
@@ -2214,6 +2230,16 @@ public class BuildCode {
   }
 
   private void generateFlatLiteralNode(FlatMethod fm, LocalityBinding lb, FlatLiteralNode fln, PrintWriter output) {
+    if (fln.getType().isOffset()) {
+      if (fln.getValue() instanceof OffsetNode) {
+       OffsetNode ofn = (OffsetNode) fln.getValue();
+       output.println(generateTemp(fm, fln.getDst(),lb)+
+                      " = (short) (&((struct "+ofn.getClassDesc().getSafeSymbol() +" *)0)->"+
+                      ofn.getField().getSafeSymbol()+");");
+      }
+      output.println("/* offset */");
+      return;
+    }
     if (fln.getValue()==null)
       output.println(generateTemp(fm, fln.getDst(),lb)+"=0;");
     else if (fln.getType().getSymbol().equals(TypeUtil.StringClass)) {
index 52f92b5c6aa702d0630614526e1e6ec8ba910b50..d7201101610f2e3800e1dd2d4c7dbae7ab9d5e1d 100644 (file)
@@ -178,6 +178,7 @@ public class BuildFlat {
   }
 
   private NodePair flattenBlockExpressionNode(BlockExpressionNode en) {
+    //System.out.println("DEBUG -> inside flattenBlockExpressionNode\n");
     TempDescriptor tmp=TempDescriptor.tempFactory("neverused",en.getExpression().getType());
     return flattenExpressionNode(en.getExpression(),tmp);
   }
@@ -195,6 +196,19 @@ public class BuildFlat {
     return new NodePair(fln,fln);
   }
 
+  private NodePair flattenOffsetNode(OffsetNode ofn, TempDescriptor out_temp) {
+    FlatLiteralNode fln = new FlatLiteralNode(ofn.getType(), ofn, out_temp);
+    return new NodePair(fln, fln);
+    /* Another possible approach
+       ClassDescriptor cd = ofn.getClassDesc();
+       FieldDescriptor fd = ofn.getField();
+       FlatOffsetNode fon = new FlatOffsetNode(fd, cd, out_temp);
+       TypeDescriptor type=new TypeDescriptor(ofn.getType());
+       System.out.println("TempDescriptor out_temp = " + out_temp.toString() + "Type of out_temp = " + out_temp.getType());
+       return new NodePair(fon, fon);
+     */
+  }
+
   private NodePair flattenCreateObjectNode(CreateObjectNode con,TempDescriptor out_temp) {
     TypeDescriptor td=con.getType();
     if (!td.isArray()) {
@@ -385,8 +399,8 @@ public class BuildFlat {
     }
     FlatNode first=null;
     FlatNode last=null;
-    TempDescriptor src_tmp=an.getSrc()==null ? TempDescriptor.tempFactory("srctmp",an.getDest().getType()) : TempDescriptor.tempFactory("srctmp",an.getSrc().getType());
-
+    TempDescriptor src_tmp = src_tmp=an.getSrc()==null ? TempDescriptor.tempFactory("srctmp",an.getDest().getType()) : TempDescriptor.tempFactory("srctmp",an.getSrc().getType());
+    
     //Get src value
     if (an.getSrc()!=null) {
       NodePair np_src=flattenExpressionNode(an.getSrc(),src_tmp);
@@ -502,6 +516,8 @@ public class BuildFlat {
     } else if (an.getDest().kind()==Kind.NameNode) {
       //We could be assigning a field or variable
       NameNode nn=(NameNode)an.getDest();
+
+
       if (nn.getExpression()!=null) {
        //It is a field
        FieldAccessNode fan=(FieldAccessNode)nn.getExpression();
@@ -638,6 +654,7 @@ public class BuildFlat {
          }
 
          FlatOpNode fon=new FlatOpNode(getTempforVar(nn.getVar()), src_tmp, null, new Operation(Operation.ASSIGN));
+
          last.addNext(fon);
          last=fon;
          if (pre) {
@@ -645,10 +662,11 @@ public class BuildFlat {
            fon.addNext(fon2);
            last=fon2;
          }
-         return new NodePair(first, last);
-       }
+      return new NodePair(first, last);
+       } //end of else
       }
     }
+
     throw new Error();
   }
 
@@ -757,6 +775,9 @@ public class BuildFlat {
 
     case Kind.OpNode:
       return flattenOpNode((OpNode)en,out_temp);
+
+    case Kind.OffsetNode:
+      return flattenOffsetNode((OffsetNode)en,out_temp);
     }
     throw new Error();
   }
index 2de034b0a0131cd61c7bed36dd77178869da0393..9789a3af3add17149b93f93414324e0032605903 100644 (file)
@@ -22,4 +22,5 @@ public class FKind {
   public static final int FlatAtomicExitNode=19;
   public static final int FlatGlobalConvNode=20;
   public static final int FlatPrefetchNode=21;
+  public static final int FlatOffsetNode=22;
 }
index b692207fd31114af6cc0a0faec656de35b92f037..d6b84a1d2b74cec0f214d7d8e2a37b501d0d1a43 100644 (file)
@@ -5,14 +5,14 @@ import java.util.*;
 
 public class BuildIR {
   State state;
-  
+
   private int m_taskexitnum;
-  
+
   public BuildIR(State state) {
     this.state=state;
     this.m_taskexitnum = 0;
   }
-  
+
   public void buildtree() {
     for(Iterator it=state.parsetrees.iterator(); it.hasNext();) {
       ParseNode pn=(ParseNode)it.next();
@@ -274,7 +274,6 @@ public class BuildIR {
 
   private TypeDescriptor parseTypeDescriptor(ParseNode pn) {
     ParseNode tn=pn.getChild("type");
-
     String type_st=tn.getTerminal();
     if(type_st.equals("byte")) {
       return state.getTypeDescriptor(TypeDescriptor.BYTE);
@@ -457,7 +456,8 @@ public class BuildIR {
       }
       return min;
     } else if (isNode(pn,"fieldaccess")) {
-      ExpressionNode en=parseExpression(pn.getChild("base").getFirstChild());          String fieldname=pn.getChild("field").getTerminal();
+      ExpressionNode en=parseExpression(pn.getChild("base").getFirstChild());
+      String fieldname=pn.getChild("field").getTerminal();
       return new FieldAccessNode(en,fieldname);
     } else if (isNode(pn,"arrayaccess")) {
       ExpressionNode en=parseExpression(pn.getChild("base").getFirstChild());
@@ -467,6 +467,11 @@ public class BuildIR {
       return new CastNode(parseTypeDescriptor(pn.getChild("type")),parseExpression(pn.getChild("exp").getFirstChild()));
     } else if (isNode(pn,"cast2")) {
       return new CastNode(parseExpression(pn.getChild("type").getFirstChild()),parseExpression(pn.getChild("exp").getFirstChild()));
+    } else if (isNode(pn, "getoffset")) {
+      TypeDescriptor td=parseTypeDescriptor(pn);
+      String fieldname = pn.getChild("field").getTerminal();
+      //System.out.println("Checking the values of: "+ " td.toString()= " + td.toString()+ "  fieldname= " + fieldname);
+      return new OffsetNode(td, fieldname);
     } else {
       System.out.println("---------------------");
       System.out.println(pn.PPrint(3,true));
@@ -565,7 +570,7 @@ public class BuildIR {
   }
 
   public BlockNode parseBlock(ParseNode pn) {
-      this.m_taskexitnum = 0;
+    this.m_taskexitnum = 0;
     if (pn==null||isEmpty(pn.getTerminal()))
       return new BlockNode();
     ParseNode bsn=pn.getChild("block_statement_list");
index 5f44bd9107037240ab4dacfe7d1aebf0842babeb..e57358d5acd37642723dd79b4309aa77c231421b 100644 (file)
@@ -22,4 +22,5 @@ public class Kind {
   public final static int TaskExitNode=19;
   public final static int TagDeclarationNode=20;
   public final static int AtomicNode=21;
+  public final static int OffsetNode=22;
 }
index 9bb7d55baefe3bed79967d37a193916d952b42be..708ae78c55b7a6cfedefd5ae0dc3f20b46305ff3 100644 (file)
@@ -372,6 +372,10 @@ public class SemanticCheck {
     case Kind.OpNode:
       checkOpNode(md,nametable,(OpNode)en,td);
       return;
+
+    case Kind.OffsetNode:
+      checkOffsetNode(md, nametable, (OffsetNode)en, new TypeDescriptor(TypeDescriptor.OFFSET));
+      return;
     }
     throw new Error();
   }
@@ -496,6 +500,33 @@ public class SemanticCheck {
     }
   }
 
+  void checkOffsetNode(Descriptor md, SymbolTable nameTable, OffsetNode ofn, TypeDescriptor td) {
+    TypeDescriptor ltd = ofn.td;
+    //System.out.println("Testing TypeDescriptor ltd = " + ofn.td);
+    String fieldname = ofn.fieldname;
+    //System.out.println("Testing String fieldname = " + ofn.fieldname);
+    Descriptor d = (Descriptor) nameTable.get(fieldname);
+    //System.out.println("Testing Descriptor d = " + d.toString());
+
+    ClassDescriptor cd = null;
+    checkTypeDescriptor(ltd);
+    cd = ltd.getClassDesc();
+    ofn.setClassDesc(cd);
+    //System.out.println("Testing for ClassDescriptor cd = " + cd.toString());
+
+    FieldDescriptor fd=null;
+    if (ltd.isArray()&&fieldname.equals("length")) {
+      fd=FieldDescriptor.arrayLength;
+    } else {
+      fd=(FieldDescriptor) cd.getFieldTable().get(fieldname);
+    }
+    //System.out.println("Testing for FieldDescriptor fd = " + fd.toString());
+    ofn.setField(fd);
+    if (fd==null)
+      throw new Error("Unknown field "+fieldname + " in "+ofn.printNode(1)+" in "+md);
+    ofn.setType(td);
+  }
+
   void checkAssignmentNode(Descriptor md, SymbolTable nametable, AssignmentNode an, TypeDescriptor td) {
     boolean postinc=true;
     if (an.getOperation().getBaseOp()==null||
index dbcb19ad73548fe39fffabd4a685a2d03bcda718..57522896cb921cad00b0762c8991e78776c8eab9 100644 (file)
@@ -5,7 +5,7 @@ public class TaskExitNode extends BlockStatementNode {
   Vector vfe;
   Vector ccs;
   int m_taskexitindex;
-  
+
   public TaskExitNode(Vector vfe, Vector ccs, int taskexitindex) {
     this.vfe=vfe;
     this.ccs=ccs;
@@ -29,6 +29,6 @@ public class TaskExitNode extends BlockStatementNode {
   }
 
   public int getTaskExitIndex() {
-      return m_taskexitindex;
+    return m_taskexitindex;
   }
 }
index 579b4dd5c19fe6290590625c56f4b2cb55454fd0..ddef484956388b1e3b42d0ebdfecf24a2487bc70 100644 (file)
@@ -19,10 +19,11 @@ public class TypeDescriptor extends Descriptor {
   public static final int NULL=10;
   public static final int TAG=11;
   public static final int CLASS=12;
+  public static final int OFFSET=13;
 
 
   int arraycount;
-  int type;
+  private int type;
   ClassDescriptor class_desc;
 
   public boolean equals(Object o) {
@@ -106,6 +107,8 @@ public class TypeDescriptor extends Descriptor {
       return "double";
     else if (isFloat())
       return "float";
+    else if (isOffset())
+      return "short";
     else throw new Error("Error Type: "+type);
   }
 
@@ -197,6 +200,10 @@ public class TypeDescriptor extends Descriptor {
     return type==VOID;
   }
 
+  public boolean isOffset() {
+    return type==OFFSET;
+  }
+
   public boolean isPtr() {
     return (isClass()||isNull()||isTag()||isArray());
   }
@@ -296,6 +303,8 @@ public class TypeDescriptor extends Descriptor {
       return "null";
     else if (type==TAG)
       return TypeUtil.TagClass;
+    else if (type==OFFSET)
+      return "offset";
     else throw new Error();
   }
 }
index 443ba4f0b066d787d04b577cb2d61c781442314b..91fd0fdc1f9b75d4def48806ab8de22f773b875f 100644 (file)
@@ -172,6 +172,7 @@ NextMethod:
   }
 
   public boolean isSuperorType(TypeDescriptor possiblesuper, TypeDescriptor cd2) {
+    if (possiblesuper.isOffset() || cd2.isOffset()) return true;
     //Matching type are always okay
     if (possiblesuper.equals(cd2))
       return true;
index 32ddff937f5834751b3230dbde05d3a94f323e19..40f078db888c5d5e03e82f53d5add87a21c7d4d4 100644 (file)
@@ -79,5 +79,7 @@ class Keyword extends Token {
     //Keywords for transactions
     key_table.put("atomic", new Integer(Sym.ATOMIC));
     key_table.put("global", new Integer(Sym.GLOBAL));
+    //Keywords for hacking prefetch calls in java
+    key_table.put("getoffset", new Integer(Sym.GETOFFSET));
   }
 }
index fee2448e8db45e13218c3e937271361e71b2b9f9..18b935acc88f62b1f3fe84a0d235c7b20cfd7c5d 100644 (file)
@@ -258,7 +258,7 @@ public class Lexer {
     "class", "const", "continue", "default", "do", "double", "else", "enum",
     "extends", "external", "final", "finally",
     "flag", //keyword for failure aware computation
-    "float", "for", "global", "goto", "if",
+    "float", "for","getoffset", "global", "goto", "if",
     "implements", "import", "instanceof", "int", "interface", "isavailable",
     "long",
     "native", "new", "optional", "package", "private", "protected", "public",
index c63ed8dfc54b0f9fec4f8e750dcd43aec9030ba5..1a5c66f91fd9a0a0c2e95e58ea17e5b59c9c3a67 100644 (file)
@@ -76,9 +76,9 @@ public class Main {
       } else if (option.equals("-printflat"))
        State.PRINTFLAT=true;
       else if (option.equals("-printscheduling"))
-               State.PRINTSCHEDULING=true;
+       State.PRINTSCHEDULING=true;
       else if (option.equals("-printschedulesim"))
-               State.PRINTSCHEDULESIM=true;
+       State.PRINTSCHEDULESIM=true;
       else if (option.equals("-struct"))
        state.structfile=args[++i];
       else if (option.equals("-conscheck"))
@@ -151,7 +151,7 @@ public class Main {
        System.out.println("-ownwritedots <all/final> -- write ownership graphs; can be all results or just final results");
        System.out.println("-ownaliasfile <filename> -- write a text file showing all detected aliases in program tasks");
        System.out.println("-optional -- enable optional arguments");
-       System.out.println("-scheduling do task scheduling" );
+       System.out.println("-scheduling do task scheduling");
        System.out.println("-multicore generate multi-core version binary");
        System.out.println("-numcore set the number of cores (should be used together with -multicore), defaultly set as 1");
        System.out.println("-raw generate raw version binary (should be used together with -multicore)");
@@ -341,73 +341,73 @@ public class Main {
            tmpinindex = inint.indexOf(';');
            int byObj = Integer.parseInt(inint.substring(0, tmpinindex));
            if(byObj != -1) {
-               tinfo.m_byObj = byObj;
+             tinfo.m_byObj = byObj;
            }
            inint = inint.substring(tmpinindex + 1);
            while(inint.startsWith(" ")) {
-               inint = inint.substring(1);
+             inint = inint.substring(1);
            }
            for(int i = 0; i < numofexits; i++) {
-               String tmpinfo = null;
-               if(i < numofexits - 1) {
-                   tmpinindex = inint.indexOf(';');
-                   tmpinfo = inint.substring(0, tmpinindex);
-                   inint = inint.substring(tmpinindex + 1);
-                   while(inint.startsWith(" ")) {
-                       inint = inint.substring(1);
-                   }
-               } else {
-                   tmpinfo = inint;
+             String tmpinfo = null;
+             if(i < numofexits - 1) {
+               tmpinindex = inint.indexOf(';');
+               tmpinfo = inint.substring(0, tmpinindex);
+               inint = inint.substring(tmpinindex + 1);
+               while(inint.startsWith(" ")) {
+                 inint = inint.substring(1);
                }
-               
-               tmpinindex = tmpinfo.indexOf(',');
-               tinfo.m_exetime[i] = Integer.parseInt(tmpinfo.substring(0, tmpinindex));
-               tmpinfo = tmpinfo.substring(tmpinindex + 1);
-               while(tmpinfo.startsWith(" ")) {
-                   tmpinfo = tmpinfo.substring(1);
+             } else {
+               tmpinfo = inint;
+             }
+
+             tmpinindex = tmpinfo.indexOf(',');
+             tinfo.m_exetime[i] = Integer.parseInt(tmpinfo.substring(0, tmpinindex));
+             tmpinfo = tmpinfo.substring(tmpinindex + 1);
+             while(tmpinfo.startsWith(" ")) {
+               tmpinfo = tmpinfo.substring(1);
+             }
+             tmpinindex = tmpinfo.indexOf(',');
+             tinfo.m_probability[i] = Double.parseDouble(tmpinfo.substring(0, tmpinindex));
+             tmpinfo = tmpinfo.substring(tmpinindex + 1);
+             while(tmpinfo.startsWith(" ")) {
+               tmpinfo = tmpinfo.substring(1);
+             }
+             tmpinindex = tmpinfo.indexOf(',');
+             int numofnobjs = 0;
+             if(tmpinindex == -1) {
+               numofnobjs = Integer.parseInt(tmpinfo);
+               if(numofnobjs != 0) {
+                 System.err.println("Error profile data format!");
+                 System.exit(-1);
                }
-               tmpinindex = tmpinfo.indexOf(',');
-               tinfo.m_probability[i] = Double.parseDouble(tmpinfo.substring(0, tmpinindex));
+             } else {
+               tinfo.m_newobjinfo.setElementAt(new Hashtable<String,Integer>(), i);
+               numofnobjs = Integer.parseInt(tmpinfo.substring(0, tmpinindex));
                tmpinfo = tmpinfo.substring(tmpinindex + 1);
                while(tmpinfo.startsWith(" ")) {
-                   tmpinfo = tmpinfo.substring(1);
+                 tmpinfo = tmpinfo.substring(1);
                }
-               tmpinindex = tmpinfo.indexOf(',');
-               int numofnobjs = 0;
-               if(tmpinindex == -1) {
-                   numofnobjs = Integer.parseInt(tmpinfo);
-                   if(numofnobjs != 0) {
-                       System.err.println("Error profile data format!");
-                       System.exit(-1);
-                   }
-               } else {
-                   tinfo.m_newobjinfo.setElementAt(new Hashtable<String,Integer>(), i);
-                   numofnobjs = Integer.parseInt(tmpinfo.substring(0, tmpinindex));
+               for(int j = 0; j < numofnobjs; j++) {
+                 tmpinindex = tmpinfo.indexOf(',');
+                 String nobjtype = tmpinfo.substring(0, tmpinindex);
+                 tmpinfo = tmpinfo.substring(tmpinindex + 1);
+                 while(tmpinfo.startsWith(" ")) {
+                   tmpinfo = tmpinfo.substring(1);
+                 }
+                 int objnum = 0;
+                 if(j < numofnobjs - 1) {
+                   tmpinindex = tmpinfo.indexOf(',');
+                   objnum  = Integer.parseInt(tmpinfo.substring(0, tmpinindex));
                    tmpinfo = tmpinfo.substring(tmpinindex + 1);
                    while(tmpinfo.startsWith(" ")) {
-                       tmpinfo = tmpinfo.substring(1);
-                   }
-                   for(int j = 0; j < numofnobjs; j++) {
-                       tmpinindex = tmpinfo.indexOf(',');
-                       String nobjtype = tmpinfo.substring(0, tmpinindex);
-                       tmpinfo = tmpinfo.substring(tmpinindex + 1);
-                       while(tmpinfo.startsWith(" ")) {
-                           tmpinfo = tmpinfo.substring(1);
-                       }
-                       int objnum = 0;
-                       if(j < numofnobjs - 1) {
-                           tmpinindex = tmpinfo.indexOf(',');
-                           objnum  = Integer.parseInt(tmpinfo.substring(0, tmpinindex));
-                           tmpinfo = tmpinfo.substring(tmpinindex + 1);
-                           while(tmpinfo.startsWith(" ")) {
-                               tmpinfo = tmpinfo.substring(1);
-                           }
-                       } else {
-                           objnum = Integer.parseInt(tmpinfo);
-                       }
-                       tinfo.m_newobjinfo.elementAt(i).put(nobjtype, objnum);
+                     tmpinfo = tmpinfo.substring(1);
                    }
+                 } else {
+                   objnum = Integer.parseInt(tmpinfo);
+                 }
+                 tinfo.m_newobjinfo.elementAt(i).put(nobjtype, objnum);
                }
+             }
            }
            taskinfos.put(inname, tinfo);
            inindex = profiledata.indexOf('\n');
@@ -438,12 +438,12 @@ public class Main {
                        pfe.setProbability(idouble);
                        int newRate = 0;
                        if((taskinfo.m_newobjinfo.elementAt(pfe.getTaskExitIndex()) != null)
-                               && (taskinfo.m_newobjinfo.elementAt(pfe.getTaskExitIndex()).containsKey(cd.getSymbol()))) {
-                           newRate = taskinfo.m_newobjinfo.elementAt(pfe.getTaskExitIndex()).get(cd.getSymbol());
+                          && (taskinfo.m_newobjinfo.elementAt(pfe.getTaskExitIndex()).containsKey(cd.getSymbol()))) {
+                         newRate = taskinfo.m_newobjinfo.elementAt(pfe.getTaskExitIndex()).get(cd.getSymbol());
                        }
                        pfe.addNewObjInfo(cd, newRate, idouble);
                        if(taskinfo.m_byObj != -1) {
-                           ((FlagState)pfe.getSource()).setByObj(taskinfo.m_byObj);
+                         ((FlagState)pfe.getSource()).setByObj(taskinfo.m_byObj);
                        }
                      }
                      fev = null;
@@ -464,7 +464,7 @@ public class Main {
                  double idouble = taskinfo.m_probability[edge.getTaskExitIndex()];
                  edge.setProbability(idouble);
                  if(taskinfo.m_byObj != -1) {
-                     ((FlagState)edge.getSource()).setByObj(taskinfo.m_byObj);
+                   ((FlagState)edge.getSource()).setByObj(taskinfo.m_byObj);
                  }
                }
              }
@@ -631,43 +631,43 @@ public class Main {
        Vector<Integer> selectedScheduling = new Vector<Integer>();
        int processTime = Integer.MAX_VALUE;
        if(schedulings.size() > 1500) {
-           int index = 0;
-           int upperbound = schedulings.size();
-           long seed = 0;
-           java.util.Random r = new java.util.Random(seed);
-           for(int ii = 0; ii < 1500; ii++) {
-               index = (int)((Math.abs((double)r.nextInt() / (double)Integer.MAX_VALUE)) * upperbound);
-               System.out.println("Scheduling index:" + index);
-               //System.err.println("Scheduling index:" + index);
-               Vector<Schedule> scheduling = schedulings.elementAt(index);
-               scheduleSimulator.setScheduling(scheduling);
-               int tmpTime = scheduleSimulator.process();
-               if(tmpTime < processTime) {
-                   selectedScheduling.clear();
-                   selectedScheduling.add(index);
-                   processTime = tmpTime;
-               } else if(tmpTime == processTime) {
-                   selectedScheduling.add(index);
-               }
-               scheduling = null;
+         int index = 0;
+         int upperbound = schedulings.size();
+         long seed = 0;
+         java.util.Random r = new java.util.Random(seed);
+         for(int ii = 0; ii < 1500; ii++) {
+           index = (int)((Math.abs((double)r.nextInt() / (double)Integer.MAX_VALUE)) * upperbound);
+           System.out.println("Scheduling index:" + index);
+           //System.err.println("Scheduling index:" + index);
+           Vector<Schedule> scheduling = schedulings.elementAt(index);
+           scheduleSimulator.setScheduling(scheduling);
+           int tmpTime = scheduleSimulator.process();
+           if(tmpTime < processTime) {
+             selectedScheduling.clear();
+             selectedScheduling.add(index);
+             processTime = tmpTime;
+           } else if(tmpTime == processTime) {
+             selectedScheduling.add(index);
            }
+           scheduling = null;
+         }
        } else {
-           Iterator it_scheduling = scheduleAnalysis.getSchedulingsIter();
-           int index = 0;
-           while(it_scheduling.hasNext()) {
-               Vector<Schedule> scheduling = (Vector<Schedule>)it_scheduling.next();
-               scheduleSimulator.setScheduling(scheduling);
-               int tmpTime = scheduleSimulator.process();
-               if(tmpTime < processTime) {
-                   selectedScheduling.clear();
-                   selectedScheduling.add(index);
-                   processTime = tmpTime;
-               } else if(tmpTime == processTime) {
-                   selectedScheduling.add(index);
-               }
-               scheduling = null;
-               index++;
+         Iterator it_scheduling = scheduleAnalysis.getSchedulingsIter();
+         int index = 0;
+         while(it_scheduling.hasNext()) {
+           Vector<Schedule> scheduling = (Vector<Schedule>)it_scheduling.next();
+           scheduleSimulator.setScheduling(scheduling);
+           int tmpTime = scheduleSimulator.process();
+           if(tmpTime < processTime) {
+             selectedScheduling.clear();
+             selectedScheduling.add(index);
+             processTime = tmpTime;
+           } else if(tmpTime == processTime) {
+             selectedScheduling.add(index);
            }
+           scheduling = null;
+           index++;
+         }
        }
 
        System.out.print("Selected schedulings with least exectution time " + processTime + ": \n\t");
@@ -759,23 +759,23 @@ public class Main {
       System.exit(l.numErrors());
     }
   }
-  
+
   static class TaskInfo {
-      public int m_numofexits;
-      public int[] m_exetime;
-      public double[] m_probability;
-      public Vector<Hashtable<String, Integer>> m_newobjinfo;
-      public int m_byObj;
-      
-      public TaskInfo(int numofexits) {
-         this.m_numofexits = numofexits;
-         this.m_exetime = new int[this.m_numofexits];
-         this.m_probability = new double[this.m_numofexits];
-         this.m_newobjinfo = new Vector<Hashtable<String, Integer>>();
-         for(int i = 0; i < this.m_numofexits; i++) {
-             this.m_newobjinfo.add(null);
-         }
-         this.m_byObj = -1;
+    public int m_numofexits;
+    public int[] m_exetime;
+    public double[] m_probability;
+    public Vector<Hashtable<String, Integer>> m_newobjinfo;
+    public int m_byObj;
+
+    public TaskInfo(int numofexits) {
+      this.m_numofexits = numofexits;
+      this.m_exetime = new int[this.m_numofexits];
+      this.m_probability = new double[this.m_numofexits];
+      this.m_newobjinfo = new Vector<Hashtable<String, Integer>>();
+      for(int i = 0; i < this.m_numofexits; i++) {
+       this.m_newobjinfo.add(null);
       }
+      this.m_byObj = -1;
+    }
   }
 }
index 85d18b58f97a95cf983e81df9cfcd597e166073f..ad4063596df41d34e56b94b0deca2b2b6e2dd757 100644 (file)
@@ -256,7 +256,9 @@ non terminal ParseNode tag_change;
 //distributed transaction keywords
 terminal ATOMIC;
 terminal GLOBAL;
+terminal GETOFFSET;
 non terminal ParseNode atomic_statement;
+non terminal ParseNode getoffset_expression;
 
 
 start with goal;
@@ -499,7 +501,7 @@ literal ::= INTEGER_LITERAL:integer_lit
        |       BOOLEAN_LITERAL:boolean_lit
        {:
                ParseNode pn=new ParseNode("literal");
-               pn.addChild("boolean").setLiteral(boolean_lit);
+               pn.addChild("boole\1aan").setLiteral(boolean_lit);
                RESULT=pn;
        :}
        |       CHARACTER_LITERAL:char_lit
@@ -1575,6 +1577,7 @@ array_access ::=
 //             RESULT=pn;
 //     :}
        ;
+
 postfix_expression ::=
                primary:exp {: 
        RESULT=exp; :}
@@ -1798,11 +1801,22 @@ conditional_expression ::=
 //     |       conditional_or_expression QUESTION expression 
 //                     COLON conditional_expression
        ;
+getoffset_expression ::=
+        GETOFFSET LBRACE class_or_interface_type:type COMMA IDENTIFIER:id RBRACE {:
+        ParseNode pn = new ParseNode("getoffset");
+        pn.addChild(type);
+        pn.addChild("field").addChild(id);
+        RESULT = pn;
+      :}
+   ;
 assignment_expression ::=
                conditional_expression:expr {: 
                        RESULT=expr; :} |
                assignment:assign {: 
-                       RESULT=assign; :}
+                       RESULT=assign; :}             |
+        getoffset_expression:expr {:
+            RESULT=expr; :}
        ;
 // semantic check necessary here to ensure a valid left-hand side.
 // allowing a parenthesized variable here on the lhs was introduced in
index 1c90595fdaf2dc166538f4aff95d8020e1626511..72ecb073578b34ec64a29075af506896e85d4fc4 100644 (file)
@@ -57,5 +57,13 @@ e.g. of tuple for x.y.z  where x and y are found but z is not found
 Q: How can we represent offset, or index or typechecking .....in bytes i.e. short type number?
 TODO : handle the NULL cases here
 
-       
 
+Start range of prefetches
+--------------------------
+For e.g. Prefetches for array indices 
+a[0].b, a[1].b, a[2].b   = a . 0. 2. b .0
+
+For e.g. Prefetches for next field 
+a.b.next.next.next    = a.b.0.next.3
+
+Current : just do a Java system call to insert these prefetches manually
index d263b048f26e105d286481416a2f2c0935e6e2ce..2012791691602b548a8af878eba0c7a162a6ff61 100644 (file)
@@ -5,31 +5,26 @@
 extern sockPoolHashTable_t *transPrefetchSockPool;
 extern unsigned int myIpAddr;
 
-/* Steps for the new prefetch call */
 // Function for new prefetch call
-void rangePrefetch(int prefetchsiteid, int ntuples, unsigned int *baseoids, 
-    unsigned short *numoffsets, short *offsets) {
+void rangePrefetch(unsigned int oid, short numoffset, short *offsets) {
   // a[0][1] - a[3][1] = a.0.3
   // a.f.h   = a.f.h
   // a.f.next.h = a.f.0.next.0.h
   // a.f.next.next.h  = a.f.next.2.h
+  printf("DEBUG-> Inside rangePrefetch\n");
   /* Allocate memory in prefetch queue and push the block there */
-  int qnodesize = 2*sizeof(int)+ ntuples *(sizeof(unsigned int) + sizeof(unsigned short)) + numoffsets[ntuples -1] * sizeof(short);
+  int qnodesize = sizeof(unsigned int) + sizeof(unsigned short) + numoffset * sizeof(short);
   char *node = (char *) getmemory(qnodesize);
-  int top = numoffsets[ntuples -1];
 
   if(node == NULL)
     return;
 
   int index = 0;
-  *((int *)(node)) = prefetchsiteid;
-  *((int *)(node + sizeof(int))) = ntuples;
-  index = 2 * sizeof(int);
-  memcpy(node+index, baseoids, ntuples * sizeof(unsigned int));
-  index = index + ntuples *(sizeof(unsigned int));
-  memcpy(node+index, numoffsets, ntuples * sizeof(unsigned short));
-  index = index + ntuples *(sizeof(unsigned short));
-  memcpy(node+index, offsets, top * sizeof(short));
+  *(node+index) = oid;
+  index = index + (sizeof(unsigned int));
+  *(node+index) = numoffset;
+  index = index + (sizeof(short));
+  memcpy(node+index, offsets, numoffset * sizeof(short));
 
   movehead(qnodesize);
 }
@@ -48,8 +43,8 @@ void *transPrefetchNew() {
       /* Send  Prefetch Request */
       perMcPrefetchList_t *ptr = pilehead;
       while(ptr != NULL) {
-        sendRangePrefetchReq(ptr, sd);
-        ptr = ptr->next;
+       sendRangePrefetchReq(ptr, sd);
+       ptr = ptr->next;
       }
 
       /* Deallocated pilehead */
@@ -83,7 +78,7 @@ perMcPrefetchList_t*  checkIfLocal(char *ptr) {
   // Iterate for each object
   for (i = 0; i < ntuples; i++) {
     int numoffset = (i == 0) ? endoffsets[0] : (endoffsets[i] - endoffsets[i-1]);
-    int sizetmpObjSet = numoffset >> 1; 
+    int sizetmpObjSet = numoffset >> 1;
     unsigned short tmpobjset[sizetmpObjSet];
     int l;
     for (l = 0; l < sizetmpObjSet; l++) {
@@ -97,29 +92,29 @@ perMcPrefetchList_t*  checkIfLocal(char *ptr) {
     for (j = 0; j < numoffset; j++) {
       // Iterate over each element to be visited
       while (visited != tovisit) {
-        if(chldOffstFrmBase[visited+1] == 0) {
-          visited++;
-          continue;
-        }
-
-        if (!isOidAvail(chldOffstFrmBase[visited+1])) { 
-          // Add to remote requests 
-          unsigned int oid = chldOffstFrmBase[visited+1];
-          int machinenum = lhashSearch(oid);
-          //TODO Group a bunch of oids to send in one prefetch request
-          insertPrefetch(machinenum, oid, numoffset-j, offsets, &head);
-          break;
-        } else {
-          // iterate over each offset
-          int retval;
-          if((retval = lookForObjs(chldOffstFrmBase, offsets, &j, 
-              &visited, &tovisit)) == 0) {
-            printf("%s() Error: Object not found %s at line %d\n", 
-                __func__, __FILE__, __LINE__); 
-          }
-        }
-        visited++;
-      } 
+       if(chldOffstFrmBase[visited+1] == 0) {
+         visited++;
+         continue;
+       }
+
+       if (!isOidAvail(chldOffstFrmBase[visited+1])) {
+         // Add to remote requests
+         unsigned int oid = chldOffstFrmBase[visited+1];
+         int machinenum = lhashSearch(oid);
+         //TODO Group a bunch of oids to send in one prefetch request
+         insertPrefetch(machinenum, oid, numoffset-j, offsets, &head);
+         break;
+       } else {
+         // iterate over each offset
+         int retval;
+         if((retval = lookForObjs(chldOffstFrmBase, offsets, &j,
+                                  &visited, &tovisit)) == 0) {
+           printf("%s() Error: Object not found %s at line %d\n",
+                  __func__, __FILE__, __LINE__);
+         }
+       }
+       visited++;
+      }
     } // end iterate for each element of offsets
 
     //Entire prefetch found locally
@@ -148,8 +143,8 @@ int isOidAvail(unsigned int oid) {
   }
 }
 
-int lookForObjs(int *chldOffstFrmBase, short *offsets, 
-    int *index, int *visited, int *tovisit) {
+int lookForObjs(int *chldOffstFrmBase, short *offsets,
+                int *index, int *visited, int *tovisit) {
   objheader_t *header;
   unsigned int oid = chldOffstFrmBase[*visited+1];
   if((header = (objheader_t *)mhashSearch(oid))!= NULL) {
@@ -176,42 +171,42 @@ int lookForObjs(int *chldOffstFrmBase, short *offsets,
       int i;
       //check is stride +ve or negative
       if(GET_STRIDEINC(offsets[(*index)]+1)) { //-ve stride
-        for(i = startindex; i <= range+1; i = i - stride) {
-          unsigned int oid = 0;
-          if((i < 0 || i >= length)) {
-            //if yes treat the object as found
-            oid = 0;
-            continue;
-          } else {
-            // compute new object
-            oid = *((unsigned int *)(((char *)ao) + sizeof(struct ArrayObject) + (elementsize*i)));
-          }
-          // add new object
-          chldOffstFrmBase[*tovisit] = oid;
-          *tovisit = *tovisit + 1;
-        }
+       for(i = startindex; i <= range+1; i = i - stride) {
+         unsigned int oid = 0;
+         if((i < 0 || i >= length)) {
+           //if yes treat the object as found
+           oid = 0;
+           continue;
+         } else {
+           // compute new object
+           oid = *((unsigned int *)(((char *)ao) + sizeof(struct ArrayObject) + (elementsize*i)));
+         }
+         // add new object
+         chldOffstFrmBase[*tovisit] = oid;
+         *tovisit = *tovisit + 1;
+       }
       } else { //+ve stride
-        for(i = startindex; i <= range; i = i + stride) {
-          unsigned int oid = 0;
-          if(i < 0 || i >= length) {
-            //if yes treat the object as found
-            oid = 0;
-            continue;
-          } else {
-            // compute new object
-            oid = *((unsigned int *)(((char *)ao) + sizeof(struct ArrayObject) + (elementsize*i)));
-          }
-          // add new object
-          chldOffstFrmBase[*tovisit] = oid;
-          *tovisit = *tovisit + 1;
-        }
+       for(i = startindex; i <= range; i = i + stride) {
+         unsigned int oid = 0;
+         if(i < 0 || i >= length) {
+           //if yes treat the object as found
+           oid = 0;
+           continue;
+         } else {
+           // compute new object
+           oid = *((unsigned int *)(((char *)ao) + sizeof(struct ArrayObject) + (elementsize*i)));
+         }
+         // add new object
+         chldOffstFrmBase[*tovisit] = oid;
+         *tovisit = *tovisit + 1;
+       }
       }
     } else if(range == 0) {
       if(startindex >=0 || startindex < length) {
-        unsigned int oid = *((unsigned int *)(((char *)ao) + sizeof(struct ArrayObject) + (elementsize*startindex)));
-        // add new object
-        chldOffstFrmBase[*tovisit] = oid;
-        *tovisit = *tovisit + 1;
+       unsigned int oid = *((unsigned int *)(((char *)ao) + sizeof(struct ArrayObject) + (elementsize*startindex)));
+       // add new object
+       chldOffstFrmBase[*tovisit] = oid;
+       *tovisit = *tovisit + 1;
       }
     }
   } else { //linked list
@@ -226,10 +221,10 @@ int lookForObjs(int *chldOffstFrmBase, short *offsets,
     } else {
       int i;
       for(i = 0; i < range; i++) {
-        oid = *((unsigned int *)(((char *)header) + sizeof(objheader_t) + startindex));
-        // add new object
-        chldOffstFrmBase[*tovisit] = oid;
-        *tovisit = *tovisit + 1;
+       oid = *((unsigned int *)(((char *)header) + sizeof(objheader_t) + startindex));
+       // add new object
+       chldOffstFrmBase[*tovisit] = oid;
+       *tovisit = *tovisit + 1;
       }
     }
   }
@@ -278,7 +273,7 @@ void insertPrefetch(int mid, unsigned int oid, short numoffset, short *offsets,
       tmp->next = *head;
       *head=tmp;
       return;
-    }   
+    }
 
     //keep looking
     if (tmid < mid)
@@ -290,16 +285,16 @@ void insertPrefetch(int mid, unsigned int oid, short numoffset, short *offsets,
       int matchstatus;
 
       if ((*tmp)==NULL||((toid=(*tmp)->oid)>oid)) {
-        objnode = (objOffsetPile_t *) malloc(sizeof(objOffsetPile_t));
-        objnode->offsets = offsets;
-        objnode->oid = oid;
-        objnode->numoffset = numoffset;
-        objnode->next = *tmp;
-        *tmp = objnode;
-        return;
-      }   
+       objnode = (objOffsetPile_t *) malloc(sizeof(objOffsetPile_t));
+       objnode->offsets = offsets;
+       objnode->oid = oid;
+       objnode->numoffset = numoffset;
+       objnode->next = *tmp;
+       *tmp = objnode;
+       return;
+      }
       if (toid < oid)
-        continue;
+       continue;
 
       /* Fill list DS */
       int i;
@@ -307,24 +302,24 @@ void insertPrefetch(int mid, unsigned int oid, short numoffset, short *offsets,
       short * ooffset=(*tmp)->offsets;
 
       for(i=0; i<numoffset; i++) {
-        if (i>onumoffset) {
-          //We've matched, let's just extend the current prefetch
-          (*tmp)->numoffset=numoffset;
-          (*tmp)->offsets=offsets;
-          return;
-        }
-        if (ooffset[i]<offsets[i]) {
-          goto oidloop;
-        } else if (ooffset[i]>offsets[i]) {
-          //Place item before the current one
-          objnode = (objOffsetPile_t *) malloc(sizeof(objOffsetPile_t));
-          objnode->offsets = offsets;
-          objnode->oid = oid;
-          objnode->numoffset = numoffset;
-          objnode->next = *tmp;
-          *tmp = objnode;
-          return;
-        }
+       if (i>onumoffset) {
+         //We've matched, let's just extend the current prefetch
+         (*tmp)->numoffset=numoffset;
+         (*tmp)->offsets=offsets;
+         return;
+       }
+       if (ooffset[i]<offsets[i]) {
+         goto oidloop;
+       } else if (ooffset[i]>offsets[i]) {
+         //Place item before the current one
+         objnode = (objOffsetPile_t *) malloc(sizeof(objOffsetPile_t));
+         objnode->offsets = offsets;
+         objnode->oid = oid;
+         objnode->numoffset = numoffset;
+         objnode->next = *tmp;
+         *tmp = objnode;
+         return;
+       }
       }
       //if we get to the end, we're already covered by this prefetch
       return;
index 79e0a49c76e746a9a973871492b543724cca8b35..0a963d5f156dfaf5a1b63a56993ab86849875060 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef _PREFETCH_H_
+#define _PREFETCH_H_
 #include "queue.h"
 #include "dstm.h"
 
@@ -33,13 +35,16 @@ proPrefetchQ_t prefetchQ;
 void proPrefetchQDealloc(perMcPrefetchList_t *);
 
 /******** Process Queue Element functions ***********/
-void rangePrefetch(int, int, unsigned int *, unsigned short *, short *offset);
+//void rangePrefetch(int, int, unsigned int *, unsigned short *, short *offset);
+void rangePrefetch(unsigned int, short, short *);
 void *transPrefetchNew();
 perMcPrefetchList_t* checkIfLocal(char *ptr);
 int isOidAvail(unsigned int oid);
 int lookForObjs(int*, short *, int *, int *, int *);
-void insertPrefetch(int, unsigned int, short, short*, perMcPrefetchList_t **); 
+void insertPrefetch(int, unsigned int, short, short*, perMcPrefetchList_t **);
 void sendRangePrefetchReq(perMcPrefetchList_t *, int sd);
 
 /************* Internal functions *******************/
 int getsize(short *ptr, int n);
+
+#endif
index 836856cc459eb23da0981bea05d812168a5fe57d..ae9dbe15482426713088f00130eaf12bfd411eaf 100644 (file)
@@ -9,6 +9,7 @@
 #ifdef DSTM
 #include "dstm.h"
 #include "prelookup.h"
+#include "prefetch.h"
 #endif
 
 extern int classsize[];
@@ -106,6 +107,20 @@ void CALL01(___System______printString____L___String___,struct ___String___ * __
 void CALL00(___System______clearPrefetchCache____) {
   prehashClear();
 }
+
+void CALL12(___System______rangePrefetch____L___Object____S__AR_S, struct ___Object___ * ___o___, short ___numoffset___, struct ArrayObject * ___offsets___) {
+  /* Manual Prefetches to be inserted */
+  unsigned int oid;
+  oid = ((int *) VAR(___o___))[0];
+  int numoffset=VAR(___offsets___)->___length___;
+  int i;
+  short offArry[numoffset];
+  for(i = 0; i<numoffset; i++) {
+    offArry[i] = *((short *)(((char *)&VAR(___offsets___)->___length___) + sizeof(int) + i * sizeof(short)));
+    //printf("Testing-> offArry[%d] = %d\n", i, offArry[i]);
+  }
+  rangePrefetch(oid, (short)numoffset, offArry);
+}
 #endif
 
 /* Object allocation function */
index 7e6de17b558250fc99ee82993f6ac6383eda3dde..6d4c9d81f2783bcd7e63ae92982121c02c480c38 100755 (executable)
@@ -388,7 +388,7 @@ if $TRANSSTATSFLAG
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
 fi
-FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.c $DSMRUNTIME/machinepile.c $DSMRUNTIME/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRUNTIME/sockpool.c $DSMRUNTIME/addUdpEnhance.c $DSMRUNTIME/signal.c $DSMRUNTIME/gCollect.c $DSMRUNTIME/addPrefetchEnhance.c $DSMRUNTIME/dsmlock.c"
+FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.c $DSMRUNTIME/machinepile.c $DSMRUNTIME/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRUNTIME/sockpool.c $DSMRUNTIME/addUdpEnhance.c $DSMRUNTIME/signal.c $DSMRUNTIME/gCollect.c $DSMRUNTIME/addPrefetchEnhance.c $DSMRUNTIME/dsmlock.c $DSMRUNTIME/prefetch.c"
 fi
 
 if $RECOVERFLAG