changes:
authorbdemsky <bdemsky>
Tue, 12 May 2009 21:47:46 +0000 (21:47 +0000)
committerbdemsky <bdemsky>
Tue, 12 May 2009 21:47:46 +0000 (21:47 +0000)
1) bug fix
2) support for fast memcpy...contact me for objects

Robust/src/Benchmarks/SingleTM/KMeans/makefile
Robust/src/Runtime/STM/stm.c
Robust/src/Runtime/runtime.c
Robust/src/buildscript

index af62dbef5304eba864d92f42941cafcb180397d5..5c244f06cac2aa6fcabefbb789e333d4a6f79b71 100644 (file)
@@ -7,9 +7,12 @@ SRC=${MAINCLASS}.java \
     GlobalArgs.java \
     ../../../ClassLibrary/JavaSTM/Barrier.java
 FLAGS=-mainclass ${MAINCLASS} -singleTM -optimize -debug -dcopts -transstats -joptimize
+FLAGS2=-mainclass ${MAINCLASS} -optimize -debug -joptimize -thread
+
 
 default:
        ../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC}
+       ../../../buildscript ${FLAGS2} -o NON${MAINCLASS} ${SRC}
 
 clean:
        rm -rf tmpbuilddirectory
index 2cef92ee5a217c23e7de18675a2ef213afc6a0ef..6267983f94a742f9bd1646ad5c17e341f859a736 100644 (file)
@@ -50,6 +50,12 @@ int typesCausingAbort[TOTALNUMCLASSANDARRAY];
 #define DEBUGSTM(x...)
 #endif
 
+#ifdef FASTMEMCPY
+void * A_memcpy (void * dest, const void * src, size_t count);
+#else
+#define A_memcpy memcpy
+#endif
+
 #ifdef STMSTATS
 /*** Global variables *****/
 objlockstate_t *objlockscope;
@@ -252,7 +258,7 @@ __attribute__((pure)) void *transRead(void * oid, void *gl) {
     needLock(header,gl);
   }
 #endif
-  memcpy(objcopy, header, size);
+  A_memcpy(objcopy, header, size);
   /* Insert into cache's lookup table */
   STATUS(objcopy)=0;
   t_chashInsert(oid, &objcopy[1]);
@@ -730,7 +736,7 @@ int transCommitProcess(void ** oidwrlocked, int numoidwrlocked) {
     struct ___Object___ *src=t_chashSearch(oidwrlocked[i]);
     dst->___cachedCode___=src->___cachedCode___;
     dst->___cachedHash___=src->___cachedHash___;
-    memcpy(&dst[1], &src[1], tmpsize-sizeof(struct ___Object___));
+    A_memcpy(&dst[1], &src[1], tmpsize-sizeof(struct ___Object___));
     __asm__ __volatile__("": : :"memory");
     header->version++;
   }
index af5a49b5c62df4583a8efede72efb0df938e7c9a..11b45474a6312a3160fdf72caafa5c935c36853e 100644 (file)
 #ifdef STM
 #include "tm.h"
 #include <pthread.h>
+#endif
+
+#if defined(THREADS)||defined(STM)
 /* Global barrier for STM */
 pthread_barrier_t barrier;
 pthread_barrierattr_t attr;
 #endif
+
 #include <string.h>
 
 extern int classsize[];
@@ -189,22 +193,15 @@ void CALL02(___System______rangePrefetch____L___Object_____AR_S, struct ___Objec
 
 #endif
 
-#ifdef STM
 /* STM Barrier constructs */
 #ifdef D___Barrier______setBarrier____I
 void CALL11(___Barrier______setBarrier____I, int nthreads, int nthreads) {
-#ifdef PRECISE_GC
-  struct listitem *tmp=stopforgc((struct garbagelist *)___params___);
-#endif
   // Barrier initialization
   int ret;
   if((ret = pthread_barrier_init(&barrier, NULL, nthreads)) != 0) {
     printf("%s() Could not create a barrier: numthreads = 0 in %s\n", __func__, __FILE__);
     exit(-1);
   }
-#ifdef PRECISE_GC
-  restartaftergc(tmp);
-#endif
 }
 #endif
 
@@ -212,14 +209,19 @@ void CALL11(___Barrier______setBarrier____I, int nthreads, int nthreads) {
 void CALL00(___Barrier______enterBarrier____) {
   // Synchronization point
   int ret;
+#ifdef PRECISE_GC
+  struct listitem *tmp=stopforgc((struct garbagelist *)___params___);
+#endif
   ret = pthread_barrier_wait(&barrier);
+#ifdef PRECISE_GC
+  restartaftergc(tmp);
+#endif
   if(ret != 0 && ret != PTHREAD_BARRIER_SERIAL_THREAD) {
     printf("%s() Could not wait on barrier: error %d in %s\n", __func__, errno, __FILE__);
     exit(-1);
   }
 }
 #endif
-#endif
 
 /* Object allocation function */
 
index e231fabd4e86b7b10b31c8889aa3fecc898951be..002f4b6d50378b5ddd3797a0c98516a3d28e186f 100755 (executable)
@@ -6,6 +6,7 @@ echo -dsm distributed shared memory
 echo -singleTM single machine committing transactions
 echo -stmdebug STM debug
 echo "-stmstats prints single machine commit (stm) statistics for the benchmark"
+echo -fastmemcpy use fast memcpy
 echo -abortreaders abort readers immediately
 echo -trueprob double - probabiltiy of true branch
 echo -dsmcaching -enable caching in dsm runtime
@@ -66,6 +67,7 @@ DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
 REPAIRROOT=~/research/Repair/RepairCompiler/
 CURDIR=`pwd`
 DSMFLAG=false
+FASTMEMCPY=false
 SINGLETM=false
 NOJAVA=false
 CHECKFLAG=false
@@ -154,6 +156,10 @@ elif [[ $1 = '-dsm' ]]
 then
 JAVAOPTS="$JAVAOPTS -dsm"
 DSMFLAG=true
+elif [[ $1 = '-fastmemcpy' ]]
+then
+FASTMEMCPY=true
+EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
 elif [[ $1 = '-singleTM' ]]
 then
 JAVAOPTS="$JAVAOPTS -singleTM"
@@ -579,6 +585,11 @@ $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
 $ROBUSTROOT/Runtime/math.c \
 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
 
+if $FASTMEMCPY
+then
+FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
+fi
+
 if $DSMFLAG
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"