From: jjenista Date: Tue, 26 Oct 2010 17:57:19 +0000 (+0000) Subject: change calloc to RUNMALLOC, added some optional debug deque bits X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3da980048b8c560151691f7f0960abe3b4446c44;p=IRC.git change calloc to RUNMALLOC, added some optional debug deque bits --- diff --git a/Robust/src/Benchmarks/oooJava/micro-master-makefile b/Robust/src/Benchmarks/oooJava/micro-master-makefile index ea7663a4..307351bf 100644 --- a/Robust/src/Benchmarks/oooJava/micro-master-makefile +++ b/Robust/src/Benchmarks/oooJava/micro-master-makefile @@ -14,26 +14,26 @@ SOURCE_FILES=test.java BUILDSCRIPT=../../../buildscript -COREPROFOVERFLOW= -coreprof-checkoverflow -USECOREPROF= -coreprof $(COREPROFOVERFLOW) \ +COREPROFOVERFLOW= #-coreprof-checkoverflow +USECOREPROF= #-coreprof $(COREPROFOVERFLOW) \ -coreprof-eventwords 1024*1024*512 \ -coreprof-enable cpe_main \ - -coreprof-enable cpe_runmalloc \ + -coreprof-enable cpe_workschedgrab +# -coreprof-enable cpe_runmalloc \ -coreprof-enable cpe_taskexecute \ -coreprof-enable cpe_taskdispatch \ -coreprof-enable cpe_poolalloc \ -coreprof-enable cpe_taskretire \ - -coreprof-enable cpe_workschedgrab -# -coreprof-enable cpe_preparememq -# -coreprof-enable cpe_runfree \ -# -coreprof-enable cpe_count_poolalloc \ -# -coreprof-enable cpe_count_poolreuse \ -# -coreprof-enable cpe_taskstallvar \ -# -coreprof-enable cpe_taskstallmem + -coreprof-enable cpe_preparememq \ + -coreprof-enable cpe_runfree \ + -coreprof-enable cpe_count_poolalloc \ + -coreprof-enable cpe_count_poolreuse \ + -coreprof-enable cpe_taskstallvar \ + -coreprof-enable cpe_taskstallmem -USEOOO= -ooojava 24 2 #-ooodebug-disable-task-mem-pool #-ooodebug -BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 2000 -garbagestats -joptimize -noloop -debug #-debug-deque #-optimize src-after-pp +USEOOO= -ooojava 8 2 #-ooodebug-disable-task-mem-pool #-ooodebug +BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 50 -garbagestats -joptimize -noloop -debug -debug-deque #-optimize src-after-pp DRELEASEMODE=-disjoint-release-mode -disjoint-dvisit-stack-callees-on-top -disjoint-alias-file aliases.txt tabbed DISJOINT= -disjoint -disjoint-k 1 -enable-assertions $(DRELEASEMODE) #-disjoint-desire-determinism diff --git a/Robust/src/Runtime/deque.c b/Robust/src/Runtime/deque.c index ca3f7521..a347c01a 100644 --- a/Robust/src/Runtime/deque.c +++ b/Robust/src/Runtime/deque.c @@ -65,11 +65,13 @@ const INTPTR DQNODE_SIZETOREQUEST = sizeof( dequeNode ) + 4095; static inline dequeNode* dqGet4096aligned( void* fromAllocator ) { INTPTR aligned = ((INTPTR)fromAllocator + 4095) & (~4095); + #ifdef DEBUG_DEQUE - printf( "from allocator: 0x%08x to 0x%08x\n", (INTPTR)fromAllocator, (INTPTR)fromAllocator + DQNODE_SIZETOREQUEST ); - printf( "aligned: 0x%08x to 0x%08x\n", aligned, aligned + sizeof( dequeNode ) ); - memset( (void*) aligned, 0, sizeof( dequeNode ) ); + //printf( "from allocator: 0x%08x to 0x%08x\n", (INTPTR)fromAllocator, (INTPTR)fromAllocator + DQNODE_SIZETOREQUEST ); + //printf( "aligned: 0x%08x to 0x%08x\n", aligned, aligned + sizeof( dequeNode ) ); + //memset( (void*) aligned, 0, sizeof( dequeNode ) ); #endif + return (dequeNode*) aligned; } @@ -137,6 +139,12 @@ void dqInit( deque* dq ) { void dqPushBottom( deque* dq, void* item ) { +#ifdef DEBUG_DEQUE + if( item == 0x0 ) { + printf( "Pushing invalid work into the deque.\n" ); + } +#endif + dequeNode* currNode = dqDecodePtr( dq->bottom ); int currIndx = dqDecodeIdx( dq->bottom ); diff --git a/Robust/src/Runtime/memPool.h b/Robust/src/Runtime/memPool.h index f2217c17..582c7e9f 100644 --- a/Robust/src/Runtime/memPool.h +++ b/Robust/src/Runtime/memPool.h @@ -45,9 +45,9 @@ typedef struct MemPool_t { // the memory pool must always have at least one // item in it static MemPool* poolcreate( int itemSize ) { - MemPool* p = calloc( 1, sizeof( MemPool ) ); + MemPool* p = RUNMALLOC( sizeof( MemPool ) ); p->itemSize = itemSize; - p->head = calloc( 1, itemSize ); + p->head = RUNMALLOC( itemSize ); p->head->next = NULL; p->tail = p->head; return p; diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h index bf0bc137..02ec3c89 100644 --- a/Robust/src/Runtime/mlp_runtime.h +++ b/Robust/src/Runtime/mlp_runtime.h @@ -271,13 +271,13 @@ static inline void RELEASE_REFERENCE_TO( SESEcommon* seseRec ) { } static MemPool* taskpoolcreate( int itemSize ) { - MemPool* p = calloc( 1, sizeof( MemPool ) ); + MemPool* p = RUNMALLOC( 1, sizeof( MemPool ) ); SESEcommon *c = (SESEcommon *) p; pthread_cond_init( &(c->runningChildrenCond), NULL ); pthread_mutex_init( &(c->lock), NULL ); p->itemSize = itemSize; - p->head = calloc( 1, itemSize ); + p->head = RUNMALLOC( 1, itemSize ); p->head->next = NULL; p->tail = p->head; return p; diff --git a/Robust/src/Runtime/workschedule.c b/Robust/src/Runtime/workschedule.c index 24c452f7..24201db6 100644 --- a/Robust/src/Runtime/workschedule.c +++ b/Robust/src/Runtime/workschedule.c @@ -185,6 +185,12 @@ void* workerMain( void* arg ) { workUnit = dqPopBottom( myDeque ); +#ifdef DEBUG_DEQUE + if( workUnit == 0x0 ) { + printf( "Got invalid work from the deque bottom.\n" ); + } +#endif + if( workUnit != DQ_POP_EMPTY ) { haveWork = TRUE; break; @@ -195,6 +201,12 @@ void* workerMain( void* arg ) { // your own deque for( i = 0; i < numWorkSchedWorkers - 1; ++i ) { workUnit = dqPopTop( &(deques[lastVictim]) ); + +#ifdef DEBUG_DEQUE + if( workUnit == 0x0 ) { + printf( "Got invalid work from the deque top.\n" ); + } +#endif if( workUnit != DQ_POP_ABORT && workUnit != DQ_POP_EMPTY ) { @@ -334,6 +346,12 @@ void workScheduleInit( int numProcessors, void workScheduleSubmit( void* workUnit ) { +#ifdef DEBUG_DEQUE + if( workUnit == 0x0 ) { + printf( "Submitting invalid task record as work.\n" ); + } +#endif + if( myWorkerID == workerID_NOTAWORKER ) { CP_LOGEVENT( CP_EVENTID_DEBUG_A, CP_EVENTTYPE_BEGIN ); dqPushBottom( &(deques[0]), workUnit );