updates for multicore version runtime, temporarily disable math operations in multico...
authorjzhou <jzhou>
Thu, 7 May 2009 18:28:06 +0000 (18:28 +0000)
committerjzhou <jzhou>
Thu, 7 May 2009 18:28:06 +0000 (18:28 +0000)
12 files changed:
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/BuildCodeMultiCore.java
Robust/src/IR/State.java
Robust/src/Main/Main.java
Robust/src/Runtime/GenericHashtable.c
Robust/src/Runtime/file.c
Robust/src/Runtime/math.c
Robust/src/Runtime/multicoreruntime.c
Robust/src/Runtime/multicoretask.c
Robust/src/Runtime/runtime.h
Robust/src/Runtime/socket.c
Robust/src/buildscript

index ea2363f0c2a80c0c4c9d2c1a37fe743b3043c820..c476478a870edc04389db12266a259f40bc070b3 100644 (file)
@@ -393,6 +393,8 @@ public class BuildCode {
     }
     if(state.MULTICORE) {
       outmethod.println("#include \"task.h\"");
+         outmethod.println("#include \"multicoreruntime.h\"");
+         outmethod.println("#include \"runtime_arch.h\"");
     }
     if (state.THREAD||state.DSM||state.SINGLETM)
       outmethod.println("#include <thread.h>");
index 42a67be05b5821093e045d468e1357e7bfa74e03..c6dabfc56c3f2b7f1ac2c881aa85c09904e8b4b9 100644 (file)
@@ -645,25 +645,37 @@ public class BuildCodeMultiCore extends BuildCode {
 
     /* generate print information for RAW version */
     output.println("#ifdef MULTICORE");
-    output.println("{");
-    output.println("int tmpsum = 0;");
-    output.println("char * taskname = \"" + task.getSymbol() + "\";");
-    output.println("int tmplen = " + task.getSymbol().length() + ";");
-    output.println("int tmpindex = 1;");
-    output.println("for(;tmpindex < tmplen; tmpindex++) {");
-    output.println("   tmpsum = tmpsum * 10 + *(taskname + tmpindex) - '0';");
-    output.println("}");
+       if(this.state.RAW) {
+               output.println("{");
+               output.println("int tmpsum = 0;");
+               output.println("char * taskname = \"" + task.getSymbol() + "\";");
+               output.println("int tmplen = " + task.getSymbol().length() + ";");
+               output.println("int tmpindex = 1;");
+               output.println("for(;tmpindex < tmplen; tmpindex++) {");
+               output.println("   tmpsum = tmpsum * 10 + *(taskname + tmpindex) - '0';");
+               output.println("}");
+       }
     output.println("#ifdef RAWPATH");
-       output.println("BAMBOO_DEBUGPRINT(0xAAAA);");
-    output.println("BAMBOO_DEBUGPRINT_REG(tmpsum);");
-       output.println("BAMBOO_DEBUGPRINT(BAMBOO_GET_EXE_TIME());"); 
+       if(this.state.RAW) {
+               output.println("BAMBOO_DEBUGPRINT(0xAAAA);");
+               output.println("BAMBOO_DEBUGPRINT_REG(tmpsum);"); 
+       } else {
+               output.println("tprintf(\"Process %x(%d): task %s\\n\", corenum, corenum, \"" + task.getSymbol() + "\");");
+       }
+       output.println("BAMBOO_DEBUGPRINT((int)BAMBOO_GET_EXE_TIME());");
     output.println("#endif");
     output.println("#ifdef DEBUG");
-    output.println("BAMBOO_DEBUGPRINT(0xAAAA);");
-    output.println("BAMBOO_DEBUGPRINT_REG(tmpsum);");
-    output.println("#endif");
-    output.println("}");
+       if(this.state.RAW) {
+               output.println("BAMBOO_DEBUGPRINT(0xAAAA);");
+               output.println("BAMBOO_DEBUGPRINT_REG(tmpsum);");
+       } else {
+               output.println("tprintf(\"Process %x(%d): task %s\\n\", corenum, corenum, \"" + task.getSymbol() + "\");");
+       }
     output.println("#endif");
+       if(this.state.RAW) {
+               output.println("}");
+       }
+       output.println("#endif");
 
     for(int i = 0; i < fm.numParameters(); ++i) {
       TempDescriptor temp = fm.getParameter(i);
index aec082572bb3d601ae1f85fea549191f99ced0a7..011a1756c0c5eecb52a70f42e29cc14eeaedcb72 100644 (file)
@@ -66,6 +66,7 @@ public class State {
   public String OWNERSHIPALIASFILE=null;
   public boolean OPTIONAL=false;
   public boolean ARRAYBOUNDARYCHECK=true;
+  public boolean RAW=false;
   public boolean SCHEDULING=false;
   public boolean USEPROFILE=false;
   public boolean THREAD=false;
index d70417c9228654ada8c77cb3f0894c1703c7fbeb..ec1023377cc4c7058d8c5aa5e52621c269ec9c5a 100644 (file)
@@ -135,6 +135,8 @@ public class Main {
        state.OPTIMIZE=true;
       else if (option.equals("-dcopts"))
        state.DCOPTS=true;
+         else if (option.equals("-raw"))
+       state.RAW=true;
       else if (option.equals("-scheduling"))
        state.SCHEDULING=true;
       else if (option.equals("-distributioninfo"))
index 83a65b63eff3ebe544dc3a09e2fee8c2b7c085e6..f8255f3992009789b51633f0bd435fa0b17baad2 100755 (executable)
@@ -1,7 +1,9 @@
 #include <stdio.h>
 #include <sys/types.h>
+#ifndef MULTICORE
 #include <sys/stat.h>
 #include <fcntl.h>
+#endif
 #include <stdlib.h>
 #include <limits.h>
 
@@ -138,7 +140,7 @@ void * gengettable(struct genhashtable *ht, void * key) {
       return ptr->object;
     ptr=ptr->next;
   }
-#ifndef RAW
+#ifndef MULTICORE
   printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p\n",key);
 #endif
   return NULL;
@@ -154,7 +156,7 @@ void * getnext(struct genhashtable *ht, void * key) {
        return NULL;
     ptr=ptr->next;
   }
-#ifndef RAW
+#ifndef MULTICORE
   printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p...\n Likely concurrent removal--bad user!!!\n",key);
 #endif
   return NULL;
@@ -211,7 +213,7 @@ void genfreekey(struct genhashtable *ht, void * key) {
     }
     ptr=ptr->next;
   }
-#ifndef RAW
+#ifndef MULTICORE
   printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p\n",key);
 #endif
 }
index cf4e3ee7872a01ef421b5e747422b8b519bf5198..bf6c2d3d3aaacd1789883f80ce1bb4d310b77d6d 100644 (file)
@@ -1,53 +1,80 @@
+#ifndef MULTICORE
 #include <fcntl.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#endif
+#include <sys/types.h>
 #include "structdefs.h"
 #include "mem.h"
 #include "runtime.h"
 
 void CALL34(___FileOutputStream______nativeWrite____I__AR_B_I_I, int fd, int off, int len, int fd, struct ArrayObject * ___array___, int off, int len) {
+#ifdef MULTICORE
+#else
   char * string= (((char *)&VAR(___array___)->___length___)+sizeof(int));
   int status=write(fd, &string[off], len);
+#endif
 }
 
 void CALL11(___FileOutputStream______nativeClose____I, int fd, int fd) {
+#ifdef MULTICORE
+#else
   close(fd);
+#endif
 }
 
 void CALL11(___FileOutputStream______nativeFlush____I, int fd, int fd) {
   // not supported in RAW version
-#ifndef RAW
+#ifdef MULTICORE
+#else
   fsync(fd);
 #endif
 }
 
 int CALL01(___FileOutputStream______nativeOpen_____AR_B, struct ArrayObject * ___filename___) {
+#ifdef MULTICORE
+  return 0;
+#else
   int length=VAR(___filename___)->___length___;
   char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int));
   int fd=open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU);
   return fd;
+#endif
 }
 
 int CALL01(___FileOutputStream______nativeAppend_____AR_B, struct ArrayObject * ___filename___) {
+#ifdef MULTICORE
+  return 0;
+#else  
   int length=VAR(___filename___)->___length___;
   char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int));
   int fd=open(filename, O_WRONLY|O_CREAT|O_APPEND, S_IRWXU);
   return fd;
+#endif
 }
 
 int CALL01(___FileInputStream______nativeOpen_____AR_B, struct ArrayObject * ___filename___) {
+#ifdef MULTICORE
+  return 0;
+#else
   int length=VAR(___filename___)->___length___;
   char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int));
   int fd=open(filename, O_RDONLY, 0);
   return fd;
+#endif
 }
 
 void CALL11(___FileInputStream______nativeClose____I, int fd, int fd) {
+#ifdef MULTICORE
+#else
   close(fd);
+#endif
 }
 
 int CALL23(___FileInputStream______nativeRead____I__AR_B_I, int fd, int numBytes, int fd, struct ArrayObject * ___array___, int numBytes) {
+#ifdef MULTICORE
+  return -1;
+#else
   int toread=VAR(___array___)->___length___;
   char* string= (((char *)&VAR(___array___)->___length___)+sizeof(int));
   int status;
@@ -57,9 +84,13 @@ int CALL23(___FileInputStream______nativeRead____I__AR_B_I, int fd, int numBytes
 
   status=read(fd, string, toread);
   return status;
+#endif
 }
 
 int CALL11(___FileInputStream______nativePeek____I, int fd, int fd) {
+#ifdef MULTICORE
+  return 0;
+#else
   int status;
   char string[1];
   status=read(fd, string, 1);
@@ -69,12 +100,17 @@ int CALL11(___FileInputStream______nativePeek____I, int fd, int fd) {
   }
   lseek(fd, -1, SEEK_CUR);
   return string[0];
+#endif
 }
 
 long long CALL01(___File______nativeLength_____AR_B, struct ArrayObject * ___pathname___) {
+#ifdef MULTICORE
+  return 0;
+#else
   int length=VAR(___pathname___)->___length___;
   char* filename= (((char *)&VAR(___pathname___)->___length___)+sizeof(int));
   struct stat st;
   stat(filename, &st);
   return st.st_size;
+#endif
 }
index 183fb6b8f79eb0b2c54ab964b0b38c8be9d32fac..95a03f1c05564752b490fc8f051126f1474aeeec 100644 (file)
 #include "runtime.h"
+#ifdef MULTICORE
+#ifdef RAW
 #include "math.h"
+#endif
+#else
+#include "math.h"
+#endif
 #include "structdefs.h"
-
+#if 0
 double CALL11(___Math______cos____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return cos(___a___);
+#endif
+#else
   return cos(___a___);
+#endif
 }
 
 double CALL11(___Math______sin____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
   return sin(___a___);
+#endif
+#else
+  return sin(___a___);
+#endif
 }
 
 double CALL11(___Math______tan____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return tan(___a___);
+#endif
+#else
   return tan(___a___);
+#endif
 }
 
 double CALL11(___Math______acos____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
   return acos(___a___);
+#endif
+#else
+  return acos(___a___);
+#endif
 }
 
 double CALL11(___Math______asin____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return asin(___a___);
+#endif
+#else
   return asin(___a___);
+#endif
 }
 
 double CALL11(___Math______atan____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return atan(___a___);
+#endif
+#else
   return atan(___a___);
+#endif
 }
 
 double CALL22(___Math______atan2____D_D, double ___a___, double ___b___, double ___a___, double ___b___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
   return atan2(___a___,___b___);
+#endif
+#else
+  return atan2(___a___,___b___);
+#endif
 }
 
 double CALL11(___Math______log____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return log(___a___);
+#endif
+#else
   return log(___a___);
+#endif
 }
 
 double CALL11(___Math______exp____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
   return exp(___a___);
+#endif
+#else
+  return exp(___a___);
+#endif
 }
 
 double CALL11(___Math______sqrt____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return -1;
+#ifdef RAW
+  return sqrt(___a___);
+#endif
+#else
   return sqrt(___a___);
+#endif
 }
 
 double CALL22(___Math______pow____D_D, double ___a___, double ___b___, double ___a___, double ___b___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return pow(___a___);
+#endif
+#else
   return pow(___a___,___b___);
+#endif
 }
 
 double CALL11(___Math______ceil____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return ceil(___a___);
+#endif
+#else
   return ceil(___a___);
+#endif
 }
 
 double CALL11(___Math______floor____D, double ___a___, double ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
   return floor(___a___);
+#endif
+#else
+  return floor(___a___);
+#endif
 }
 
 float CALL11(___Math______cosf____F, float ___a___, float ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return cosf(___a___);
+#endif
+#else
   return cosf(___a___);
+#endif
 }
 
 float CALL11(___Math______sinf____F, float ___a___, float ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
   return sinf(___a___);
+#endif
+#else
+  return sinf(___a___);
+#endif
 }
 
 float CALL11(___Math______expf____F, float ___a___, float ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return expf(___a___);
+#endif
+#else
   return expf(___a___);
+#endif
 }
 
 float CALL11(___Math______sqrtf____F, float ___a___, float ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return sqrtf(___a___);
+#endif
+#else
   return sqrtf(___a___);
+#endif
 }
 
 float CALL11(___Math______logf____F, float ___a___, float ___a___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
   return logf(___a___);
+#endif
+#else
+  return logf(___a___);
+#endif
 }
 
 float CALL22(___Math______powf____F_F, float ___a___, float ___b___, float ___a___, float ___b___) {
+#ifdef MULTICORE
+  return 1;
+#ifdef RAW
+  return powf(___a___,___b___);
+#endif
+#else
   return powf(___a___,___b___);
+#endif
 }
+#endif
index 5f25575f942ac8577a2e614459a0e3646f2806f9..2836a4e39e5f993345acca59955907caeff34976 100644 (file)
@@ -1,10 +1,11 @@
 #include "runtime.h"
 #include "structdefs.h"
-#include <signal.h>
 #include "mem.h"
+#ifndef MULTICORE
 #include <fcntl.h>
 #include <errno.h>
 #include <signal.h>
+#endif
 #ifndef RAW
 #include <stdio.h>
 #endif
 //#include "option.h"
 
 extern int classsize[];
+#ifndef MULTICORE
 jmp_buf error_handler;
 int instructioncount;
 
 char *options;
 int injectfailures=0;
 float failurechance=0;
-int debugtask=0;
 int errors=0;
 int injectinstructionfailures;
 int failurecount;
@@ -30,6 +31,9 @@ int instaccum=0;
 #ifdef DMALLOC
 #include "dmalloc.h"
 #endif
+#endif
+
+int debugtask=0;
 
 #ifdef MULTICORE
 void initializeexithandler() {
@@ -167,7 +171,7 @@ struct ArrayObject * allocate_newarray(void * ptr, int type, int length) {
   //v->numlocks = 0;
   v->lock = NULL;
   if (length<0) {
-#ifndef RAW
+#ifndef MULTICORE
     printf("ERROR: negative array\n");
 #endif
     return NULL;
@@ -244,14 +248,20 @@ void failedboundschk() {
   exit(-1);
 #endif
 #else
+#ifndef MULTICORE
+  printf("Array out of bounds\n");
   longjmp(error_handler,2);
 #endif
+#endif
 }
 
 /* Abort task call */
 void abort_task() {
 #ifdef TASK
+#ifndef MULTICORE
+  printf("Aborting\n");
   longjmp(error_handler,4);
+#endif
 #else
   printf("Aborting\n");
   exit(-1);
index 4becf4ef0852f6397f8a12f56f429cb9ea551d12..93a16e9219c572ef17658b9ab1e6618dbbf18769 100644 (file)
@@ -672,7 +672,7 @@ void tagclear(struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) {
     if ((struct ___TagDescriptor___ *)tagptr==tagd)
       obj->___tags___=NULL;
     else
-#ifndef RAW
+#ifndef MULTICORE
       printf("ERROR 1 in tagclear\n");
 #else
          ;
@@ -692,7 +692,7 @@ void tagclear(struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) {
        goto PROCESSCLEAR;
       }
     }
-#ifndef RAW
+#ifndef MULTICORE
     printf("ERROR 2 in tagclear\n");
 #endif
   }
@@ -703,7 +703,7 @@ PROCESSCLEAR:
       if (tagset==obj)
        tagd->flagptr=NULL;
       else
-#ifndef RAW
+#ifndef MULTICORE
        printf("ERROR 3 in tagclear\n");
 #else
          ;
@@ -723,7 +723,7 @@ PROCESSCLEAR:
          goto ENDCLEAR;
        }
       }
-#ifndef RAW
+#ifndef MULTICORE
       printf("ERROR 4 in tagclear\n");
 #endif
     }
@@ -2432,6 +2432,7 @@ void myhandler(int sig, siginfo_t *info, void *uap) {
 }
 #endif
 
+#ifndef MULTICORE
 fd_set readfds;
 int maxreadfd;
 struct RuntimeHash *fdtoobject;
@@ -2450,6 +2451,7 @@ void removereadfd(int fd) {
       maxreadfd--;
   }
 }
+#endif
 
 #ifdef PRECISE_GC
 #define OFFSET 2
@@ -2500,7 +2502,9 @@ void executetasks() {
   /* Zero fd set */
   FD_ZERO(&readfds);
 #endif
+#ifndef MULTICORE
   maxreadfd=0;
+#endif
 #if 0
   fdtoobject=allocateRuntimeHash(100);
 #endif
@@ -2511,7 +2515,11 @@ void executetasks() {
 #endif
 
 newtask:
+#ifdef MULTICORE
+  while(hashsize(activetasks)>0) {
+#else
   while((hashsize(activetasks)>0)||(maxreadfd>0)) {
+#endif
 
 #ifdef DEBUG
     BAMBOO_DEBUGPRINT(0xe990);
@@ -2726,7 +2734,7 @@ newtask:
            ObjectHashget(pw->objectset, (int) parameter, (int *) &next, (int *) &enterflags, &UNUSED, &UNUSED2);
            ObjectHashremove(pw->objectset, (int)parameter);
            if (enterflags!=NULL)
-             free(enterflags);
+             RUNFREE(enterflags);
            // release grabbed locks
            for(j = 0; j < locklen; ++j) {
                 int * lock = (int *)(locks[j]->redirectlock);
@@ -2781,11 +2789,12 @@ parameterpresent:
        //void ** checkpoint=makecheckpoint(currtpd->task->numParameters, currtpd->parameterArray, forward, reverse);
 #endif
 #endif  // #if 0: for recovery
+#ifndef MULTICORE
        if (x=setjmp(error_handler)) {
          //int counter;
          /* Recover */
 #ifdef DEBUG
-#ifndef RAW
+#ifndef MULTICORE
          printf("Fatal Error=%d, Recovering!\n",x);
 #endif
 #endif
@@ -2802,6 +2811,7 @@ parameterpresent:
          BAMBOO_DEBUGPRINT_REG(x);
          BAMBOO_EXIT(0xa020);
        } else {
+#endif
 #if 0 
                if (injectfailures) {
             if ((((double)random())/RAND_MAX)<failurechance) {
@@ -2825,11 +2835,11 @@ execute:
 #endif
 
          if(debugtask) {
-#ifndef RAW
-               printf("ENTER %s count=%d\n",currtpd->task->name, (instaccum-instructioncount));
+#ifndef MULTICORE
+        printf("ENTER %s count=%d\n",currtpd->task->name, (instaccum-instructioncount));
 #endif
            ((void(*) (void **))currtpd->task->taskptr)(taskpointerarray);
-#ifndef RAW
+#ifndef MULTICORE
            printf("EXIT %s count=%d\n",currtpd->task->name, (instaccum-instructioncount));
 #endif
          } else {
@@ -2894,7 +2904,9 @@ execute:
        }
       }
     }
+#ifndef MULTICORE
   }
+#endif
 #ifdef DEBUG
   BAMBOO_DEBUGPRINT(0xe99b);
 #endif
@@ -3013,7 +3025,7 @@ void printdebug() {
   }
   for(i=0; i<numtasks[corenum]; i++) {
     struct taskdescriptor * task=taskarray[BAMBOO_NUM_OF_CORE][i];
-#ifndef RAW
+#ifndef MULTICORE
        printf("%s\n", task->name);
 #endif
     for(j=0; j<task->numParameters; j++) {
@@ -3021,7 +3033,7 @@ void printdebug() {
       struct parameterwrapper *parameter=param->queue;
       struct ObjectHash * set=parameter->objectset;
       struct ObjectIterator objit;
-#ifndef RAW
+#ifndef MULTICORE
          printf("  Parameter %d\n", j);
 #endif
       ObjectHashiterator(set, &objit);
@@ -3032,13 +3044,13 @@ void printdebug() {
        int numflags=Objdata3(&objit);
        int flags=Objdata2(&objit);
        Objnext(&objit);
-#ifndef RAW
+#ifndef MULTICORE
        printf("    Contains %lx\n", obj);
        printf("      flag=%d\n", obj->flag);
 #endif
        if (tagptr==NULL) {
        } else if (tagptr->type==TAGTYPE) {
-#ifndef RAW
+#ifndef MULTICORE
          printf("      tag=%lx\n",tagptr);
 #else
          ;
@@ -3047,7 +3059,7 @@ void printdebug() {
          int tagindex=0;
          struct ArrayObject *ao=(struct ArrayObject *)tagptr;
          for(; tagindex<ao->___cachedCode___; tagindex++) {
-#ifndef RAW
+#ifndef MULTICORE
                  printf("      tag=%lx\n",ARRAYGET(ao, struct ___TagDescriptor___*, tagindex));
 #else
                  ;
index 7480746b369fa9cfbf55d0f05ef5009a5bb7ef29..76c169264901344f136660ddb64abf9080856d51 100644 (file)
@@ -1,9 +1,11 @@
 #ifndef RUNTIME
 #define RUNTIME
+#ifndef MULTICORE
 #include <setjmp.h>
 extern jmp_buf error_handler;
 extern int instructioncount;
 extern int failurecount;
+#endif
 #ifdef DSTM
 #include "dstm.h"
 #endif
index 564e74283860002738b047198b957a60dde7fdca..cb7b77e90841953d97b1c53d6486585fac4ba3d3 100644 (file)
@@ -1,14 +1,14 @@
 #include "runtime.h"
 #include "structdefs.h"
-#include <fcntl.h>
 #ifndef MULTICORE
+#include <fcntl.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #include <strings.h>
 #include <netdb.h>
 #include <netinet/tcp.h>
-#endif
 #include <errno.h>
+#endif
 #include "SimpleHash.h"
 #include "GenericHashtable.h"
 
@@ -342,6 +342,8 @@ int CALL02(___ServerSocket______nativeaccept____L___Socket___,struct ___ServerSo
 }
 
 void CALL24(___Socket______nativeWrite_____AR_B_I_I, int offset, int length, struct ___Socket___ * ___this___, struct ArrayObject * ___b___, int offset, int length) {
+#ifdef MULTICORE
+#else
   int fd=VAR(___this___)->___fd___;
   char * charstr=((char *)&VAR(___b___)->___length___)+sizeof(int)+offset;
   while(1) {
@@ -356,16 +358,18 @@ void CALL24(___Socket______nativeWrite_____AR_B_I_I, int offset, int length, str
     }
 
     if (length!=0) {
-#ifndef MULTICORE
       perror("ERROR IN NATIVEWRITE");
       printf("error=%d remaining bytes %d\n",errno, length);
-#endif
     }
     break;
   }
+#endif
 }
 
 int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___, struct ArrayObject * ___b___) {
+#ifdef MULTICORE
+  return -1;
+#else
   int fd=VAR(___this___)->___fd___;
   int length=VAR(___b___)->___length___;
 
@@ -412,6 +416,7 @@ int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___,
 #endif
 #endif
   return byteread;
+#endif
 }
 
 void CALL01(___Socket______nativeClose____, struct ___Socket___ * ___this___) {
index a23e2eb1c3e65ebb0b2a27bc0ecfd88f8b1a19f7..c43dbe3f6ebd34c77f7463113878daf6df6238e3 100755 (executable)
@@ -34,6 +34,7 @@ echo -printscheduling print out scheduling graphs
 echo -printschedulesim print out scheduling simulator result graphs
 echo -abcclose close the array boundary check
 echo "-tilera generate tilera version binary (should be used together with -multicore"
+echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
 echo "-raw generate raw version binary (should be used together with -multicore)"
 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
 echo -threadsimulate generate multi-thread simulate version binary
@@ -74,6 +75,7 @@ MLPDEBUG=false
 MULTICOREFLAG=false
 RAWFLAG=false
 TILERAFLAG=false
+TILERACONFIG=''
 CACHEFLUSHFLAG=false
 RAWCONFIG=''
 DEBUGFLAG=false
@@ -206,9 +208,14 @@ shift
 elif [[ $1 = '-raw' ]]
 then
 RAWFLAG=true
+JAVAOPTS="$JAVAOPTS -raw"
 elif [[ $1 = '-tilera' ]]
 then
 TILERAFLAG=true
+elif [[ $1 = '-tileraconfig' ]]
+then
+TILERACONFIG="$2"
+shift
 elif [[ $1 = '-cacheflush' ]]
 then
 CACHEFLUSHFLAG=true
@@ -486,7 +493,8 @@ make
 elif $TILERAFLAG
 then # TILERAFLAG
 TILERADIR="$CURDIR/tilera"
-MAKEFILE="Makefile.tilera"
+MAKEFILE="Makefile.tilera.$TILERACONFIG"
+SIMHVC="sim.hvc.$TILERACONFIG"
 mkdir $TILERADIR
 cd $TILERADIR
 make clean
@@ -525,6 +533,7 @@ TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
 fi #INTERRUPT version
 
 cp $ROBUSTROOT/Runtime/Tilera/$MAKEFILE ./Makefile
+cp $ROBUSTROOT/Runtime/Tilera/$SIMHVS ./sim.hvc
 cp ../Runtime/multicoretask.c ./
 cp ../Runtime/multicoreruntime.c ./
 cp ../Runtime/Queue.c ./
@@ -535,8 +544,6 @@ cp ../Runtime/GenericHashtable.c ./
 cp ../Runtime/SimpleHash.c ./
 cp ../Runtime/ObjectHash.c ./
 cp ../Runtime/socket.c ./
-cp ../Runtime/taskdefs.c ./
-cp ../Runtime/methods.c ./
 cp ../Runtime/mem.c ./
 cp ../Runtime/GenericHashtable.h ./
 cp ../Runtime/mem.h ./