From: bdemsky Date: Tue, 12 May 2009 21:47:46 +0000 (+0000) Subject: changes: X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f4d000ad3d1c4eb0d619f0941a19b5d531cce393;p=IRC.git changes: 1) bug fix 2) support for fast memcpy...contact me for objects --- diff --git a/Robust/src/Benchmarks/SingleTM/KMeans/makefile b/Robust/src/Benchmarks/SingleTM/KMeans/makefile index af62dbef..5c244f06 100644 --- a/Robust/src/Benchmarks/SingleTM/KMeans/makefile +++ b/Robust/src/Benchmarks/SingleTM/KMeans/makefile @@ -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 diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c index 2cef92ee..6267983f 100644 --- a/Robust/src/Runtime/STM/stm.c +++ b/Robust/src/Runtime/STM/stm.c @@ -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++; } diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index af5a49b5..11b45474 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -15,10 +15,14 @@ #ifdef STM #include "tm.h" #include +#endif + +#if defined(THREADS)||defined(STM) /* Global barrier for STM */ pthread_barrier_t barrier; pthread_barrierattr_t attr; #endif + #include 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 */ diff --git a/Robust/src/buildscript b/Robust/src/buildscript index e231fabd..002f4b6d 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -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"