diff options
-rw-r--r-- | aclocal.m4 | 5 | ||||
-rw-r--r-- | mk/config.mk.in | 1 | ||||
-rw-r--r-- | mk/validate-settings.mk | 9 | ||||
-rw-r--r-- | rts/Interpreter.c | 20 | ||||
-rw-r--r-- | rts/Linker.c | 14 | ||||
-rw-r--r-- | rts/ProfHeap.c | 18 | ||||
-rw-r--r-- | rts/Profiling.h | 7 | ||||
-rw-r--r-- | rts/STM.c | 4 | ||||
-rw-r--r-- | rts/Schedule.c | 10 | ||||
-rw-r--r-- | rts/Task.c | 4 | ||||
-rw-r--r-- | rts/Trace.h | 7 | ||||
-rw-r--r-- | rts/sm/GC.c | 15 | ||||
-rw-r--r-- | rts/sm/GCUtils.c | 4 |
13 files changed, 89 insertions, 29 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 2e9764ccdb..d6b97fe52b 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -742,7 +742,8 @@ if test -z "$GCC" then AC_MSG_ERROR([gcc is required]) fi -GccLT34= +GccLT34=NO +GccLT46=NO AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version], [ fp_cv_gcc_version="`$CC -v 2>&1 | grep 'version ' | sed -e 's/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/g'`" @@ -752,9 +753,11 @@ AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version], # isn't a very good reason for that, but for now just make configure # fail. FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [3.4], GccLT34=YES) + FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.6], GccLT46=YES) ]) AC_SUBST([GccVersion], [$fp_cv_gcc_version]) AC_SUBST(GccLT34) +AC_SUBST(GccLT46) ])# FP_GCC_VERSION dnl Small feature test for perl version. Assumes PerlCmd diff --git a/mk/config.mk.in b/mk/config.mk.in index 87f80f71c4..e39c5c7381 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -535,6 +535,7 @@ endif WhatGccIsCalled = @WhatGccIsCalled@ GccVersion = @GccVersion@ GccLT34 = @GccLT34@ +GccLT46 = @GccLT46@ CC = $(WhatGccIsCalled) CC_STAGE0 = @CC_STAGE0@ CC_STAGE1 = $(CC) diff --git a/mk/validate-settings.mk b/mk/validate-settings.mk index 184dfe2ff7..7dc124fcba 100644 --- a/mk/validate-settings.mk +++ b/mk/validate-settings.mk @@ -4,7 +4,16 @@ WERROR = -Werror HADDOCK_DOCS = YES + SRC_CC_OPTS += -Wall $(WERROR) +# Debian doesn't turn -Werror=unused-but-set-variable on by default, so +# we turn it on explicitly for consistency with other users +ifeq "$(GccLT46)" "NO" +SRC_CC_OPTS += -Werror=unused-but-set-variable +endif +# gcc 4.6 gives 3 warning for giveCapabilityToTask not being inlined +SRC_CC_OPTS += -Wno-error=inline + SRC_HC_OPTS += -Wall $(WERROR) -H64m -O0 # Safe by default diff --git a/rts/Interpreter.c b/rts/Interpreter.c index ade4ad18ed..37e0e051c4 100644 --- a/rts/Interpreter.c +++ b/rts/Interpreter.c @@ -49,13 +49,21 @@ /* Sp points to the lowest live word on the stack. */ -#define BCO_NEXT instrs[bciPtr++] -#define BCO_NEXT_32 (bciPtr += 2, (((StgWord) instrs[bciPtr-2]) << 16) + ((StgWord) instrs[bciPtr-1])) -#define BCO_NEXT_64 (bciPtr += 4, (((StgWord) instrs[bciPtr-4]) << 48) + (((StgWord) instrs[bciPtr-3]) << 32) + (((StgWord) instrs[bciPtr-2]) << 16) + ((StgWord) instrs[bciPtr-1])) +#define BCO_NEXT instrs[bciPtr++] +#define BCO_NEXT_32 (bciPtr += 2) +#define BCO_READ_NEXT_32 (BCO_NEXT_32, (((StgWord) instrs[bciPtr-2]) << 16) \ + + ( (StgWord) instrs[bciPtr-1])) +#define BCO_NEXT_64 (bciPtr += 4) +#define BCO_READ_NEXT_64 (BCO_NEXT_64, (((StgWord) instrs[bciPtr-4]) << 48) \ + + (((StgWord) instrs[bciPtr-3]) << 32) \ + + (((StgWord) instrs[bciPtr-2]) << 16) \ + + ( (StgWord) instrs[bciPtr-1])) #if WORD_SIZE_IN_BITS == 32 #define BCO_NEXT_WORD BCO_NEXT_32 +#define BCO_READ_NEXT_WORD BCO_READ_NEXT_32 #elif WORD_SIZE_IN_BITS == 64 #define BCO_NEXT_WORD BCO_NEXT_64 +#define BCO_READ_NEXT_WORD BCO_READ_NEXT_64 #else #error Cannot cope with WORD_SIZE_IN_BITS being nether 32 nor 64 #endif @@ -776,8 +784,12 @@ run_BCO: register StgWord16* instrs = (StgWord16*)(bco->instrs->payload); register StgWord* literals = (StgWord*)(&bco->literals->payload[0]); register StgPtr* ptrs = (StgPtr*)(&bco->ptrs->payload[0]); +#ifdef DEBUG int bcoSize; - bcoSize = BCO_NEXT_WORD; + bcoSize = BCO_READ_NEXT_WORD; +#else + BCO_NEXT_WORD; +#endif IF_DEBUG(interpreter,debugBelch("bcoSize = %d\n", bcoSize)); #ifdef INTERP_STATS diff --git a/rts/Linker.c b/rts/Linker.c index b60898eb4e..6d29ce7409 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1190,11 +1190,15 @@ initLinker( void ) compileResult = regcomp(&re_invalid, "(([^ \t()])+\\.so([^ \t:()])*):([ \t])*(invalid ELF header|file too short)", REG_EXTENDED); - ASSERT( compileResult == 0 ); + if (compileResult != 0) { + barf("Compiling re_invalid failed"); + } compileResult = regcomp(&re_realso, "(GROUP|INPUT) *\\( *(([^ )])+)", REG_EXTENDED); - ASSERT( compileResult == 0 ); + if (compileResult != 0) { + barf("Compiling re_realso failed"); + } # endif #if !defined(ALWAYS_PIC) && defined(x86_64_HOST_ARCH) @@ -4124,10 +4128,14 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC, Elf_Addr P = ((Elf_Addr)targ) + offset; Elf_Word* pP = (Elf_Word*)P; +#if defined(i386_HOST_ARCH) || defined(DEBUG) Elf_Addr A = *pP; +#endif Elf_Addr S; void* S_tmp; +#ifdef i386_HOST_ARCH Elf_Addr value; +#endif StgStablePtr stablePtr; StgPtr stableVal; @@ -4171,7 +4179,9 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC, (void*)P, (void*)S, (void*)A )); checkProddableBlock ( oc, pP ); +#ifdef i386_HOST_ARCH value = S + A; +#endif switch (ELF_R_TYPE(info)) { # ifdef i386_HOST_ARCH diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 7d2a450129..c41f3615a2 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -839,7 +839,7 @@ heapCensusChain( Census *census, bdescr *bd ) nat size; counter *ctr; nat real_size; - rtsBool prim; + PROFILING_ONLY( rtsBool prim ); for (; bd != NULL; bd = bd->link) { @@ -854,7 +854,7 @@ heapCensusChain( Census *census, bdescr *bd ) p = bd->start; while (p < bd->free) { info = get_itbl((StgClosure *)p); - prim = rtsFalse; + PROFILING_ONLY( prim = rtsFalse ); switch (info->type) { @@ -904,7 +904,7 @@ heapCensusChain( Census *census, bdescr *bd ) break; case BCO: - prim = rtsTrue; + PROFILING_ONLY ( prim = rtsTrue ); size = bco_sizeW((StgBCO *)p); break; @@ -915,7 +915,7 @@ heapCensusChain( Census *census, bdescr *bd ) case MUT_PRIM: case MUT_VAR_CLEAN: case MUT_VAR_DIRTY: - prim = rtsTrue; + PROFILING_ONLY ( prim = rtsTrue ); size = sizeW_fromITBL(info); break; @@ -932,7 +932,7 @@ heapCensusChain( Census *census, bdescr *bd ) break; case ARR_WORDS: - prim = rtsTrue; + PROFILING_ONLY ( prim = rtsTrue ); size = arr_words_sizeW((StgArrWords*)p); break; @@ -940,12 +940,12 @@ heapCensusChain( Census *census, bdescr *bd ) case MUT_ARR_PTRS_DIRTY: case MUT_ARR_PTRS_FROZEN: case MUT_ARR_PTRS_FROZEN0: - prim = rtsTrue; + PROFILING_ONLY ( prim = rtsTrue ); size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p); break; case TSO: - prim = rtsTrue; + PROFILING_ONLY ( prim = rtsTrue ); #ifdef PROFILING if (RtsFlags.ProfFlags.includeTSOs) { size = sizeofW(StgTSO); @@ -961,7 +961,7 @@ heapCensusChain( Census *census, bdescr *bd ) #endif case STACK: - prim = rtsTrue; + PROFILING_ONLY ( prim = rtsTrue ); #ifdef PROFILING if (RtsFlags.ProfFlags.includeTSOs) { size = stack_sizeW((StgStack*)p); @@ -977,7 +977,7 @@ heapCensusChain( Census *census, bdescr *bd ) #endif case TREC_CHUNK: - prim = rtsTrue; + PROFILING_ONLY ( prim = rtsTrue ); size = sizeofW(StgTRecChunk); break; diff --git a/rts/Profiling.h b/rts/Profiling.h index e27ad4c5ed..3e365fe536 100644 --- a/rts/Profiling.h +++ b/rts/Profiling.h @@ -12,6 +12,13 @@ #include <stdio.h> #include "BeginPrivate.h" +#include "Rts.h" + +#ifdef PROFILING +#define PROFILING_ONLY(s) s +#else +#define PROFILING_ONLY(s) doNothing() +#endif void initProfiling1 (void); void initProfiling2 (void); @@ -1089,7 +1089,7 @@ static void disconnect_invariant(Capability *cap, FOR_EACH_ENTRY(last_execution, e, { StgTVar *s = e -> tvar; StgTVarWatchQueue *q = s -> first_watch_queue_entry; - StgBool found = FALSE; + DEBUG_ONLY( StgBool found = FALSE ); TRACE(" looking for trec on tvar=%p", s); for (q = s -> first_watch_queue_entry; q != END_STM_WATCH_QUEUE; @@ -1110,7 +1110,7 @@ static void disconnect_invariant(Capability *cap, } TRACE(" found it in watch queue entry %p", q); free_stg_tvar_watch_queue(cap, q); - found = TRUE; + DEBUG_ONLY( found = TRUE ); break; } } diff --git a/rts/Schedule.c b/rts/Schedule.c index fd5536b913..45959a92eb 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -715,7 +715,9 @@ schedulePushWork(Capability *cap USED_IF_THREADS, if (n_free_caps > 0) { StgTSO *prev, *t, *next; +#ifdef SPARK_PUSHING rtsBool pushed_to_all; +#endif debugTrace(DEBUG_sched, "cap %d: %s and %d free capabilities, sharing...", @@ -725,7 +727,9 @@ schedulePushWork(Capability *cap USED_IF_THREADS, n_free_caps); i = 0; +#ifdef SPARK_PUSHING pushed_to_all = rtsFalse; +#endif if (cap->run_queue_hd != END_TSO_QUEUE) { prev = cap->run_queue_hd; @@ -740,7 +744,9 @@ schedulePushWork(Capability *cap USED_IF_THREADS, setTSOPrev(cap, t, prev); prev = t; } else if (i == n_free_caps) { +#ifdef SPARK_PUSHING pushed_to_all = rtsTrue; +#endif i = 0; // keep one for us setTSOLink(cap, prev, t); @@ -1892,7 +1898,7 @@ Capability * scheduleWaitThread (StgTSO* tso, /*[out]*/HaskellObj* ret, Capability *cap) { Task *task; - StgThreadID id; + DEBUG_ONLY( StgThreadID id ); // We already created/initialised the Task task = cap->running_task; @@ -1908,7 +1914,7 @@ scheduleWaitThread (StgTSO* tso, /*[out]*/HaskellObj* ret, Capability *cap) appendToRunQueue(cap,tso); - id = tso->id; + DEBUG_ONLY( id = tso->id ); debugTrace(DEBUG_sched, "new bound thread (%lu)", (unsigned long)id); cap = schedule(cap,task); diff --git a/rts/Task.c b/rts/Task.c index e77a030f39..cf406b2abe 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -347,8 +347,8 @@ taskDoneGC (Task *task, Ticks cpu_time, Ticks elapsed_time) void workerTaskStop (Task *task) { - OSThreadId id; - id = osThreadId(); + DEBUG_ONLY( OSThreadId id ); + DEBUG_ONLY( id = osThreadId() ); ASSERT(task->id == id); ASSERT(myTask() == task); diff --git a/rts/Trace.h b/rts/Trace.h index 2b7c0fb3e3..b63e8760f3 100644 --- a/rts/Trace.h +++ b/rts/Trace.h @@ -194,7 +194,7 @@ void traceOSProcessInfo_ (void); #define debugTrace(class, str, ...) /* nothing */ #define debugTraceCap(class, cap, str, ...) /* nothing */ #define traceThreadStatus(class, tso) /* nothing */ -#define traceEventStartup_(n_caps) /* nothing */ +INLINE_HEADER void traceEventStartup_ (int n_caps STG_UNUSED) {}; #define traceCapsetModify_(tag, capset, other) /* nothing */ #define traceOSProcessInfo_() /* nothing */ @@ -243,8 +243,9 @@ void dtraceUserMsgWrapper(Capability *cap, char *msg); HASKELLEVENT_REQUEST_PAR_GC(cap) #define dtraceCreateSparkThread(cap, spark_tid) \ HASKELLEVENT_CREATE_SPARK_THREAD(cap, spark_tid) -#define dtraceStartup(num_caps) \ +INLINE_HEADER void dtraceStartup (int n_caps) { HASKELLEVENT_STARTUP(num_caps) +} #define dtraceUserMsg(cap, msg) \ HASKELLEVENT_USER_MSG(cap, msg) #define dtraceGcIdle(cap) \ @@ -278,7 +279,7 @@ void dtraceUserMsgWrapper(Capability *cap, char *msg); #define dtraceRequestSeqGc(cap) /* nothing */ #define dtraceRequestParGc(cap) /* nothing */ #define dtraceCreateSparkThread(cap, spark_tid) /* nothing */ -#define dtraceStartup(num_caps) /* nothing */ +INLINE_HEADER void dtraceStartup (int n_caps STG_UNUSED) {}; #define dtraceUserMsg(cap, msg) /* nothing */ #define dtraceGcIdle(cap) /* nothing */ #define dtraceGcWork(cap) /* nothing */ diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 51eab4e2be..9f69a4c65a 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -177,11 +177,15 @@ GarbageCollect (rtsBool force_major_gc, bdescr *bd; generation *gen; lnat live_blocks, live_words, allocated, max_copied, avg_copied; +#if defined(THREADED_RTS) gc_thread *saved_gct; +#endif nat g, n; // necessary if we stole a callee-saves register for gct: +#if defined(THREADED_RTS) saved_gct = gct; +#endif #ifdef PROFILING CostCentreStack *prev_CCS; @@ -956,7 +960,7 @@ any_work (void) static void scavenge_until_all_done (void) { - nat r; + DEBUG_ONLY( nat r ); loop: @@ -973,8 +977,13 @@ loop: collect_gct_blocks(); // scavenge_loop() only exits when there's no work to do + +#ifdef DEBUG r = dec_running(); - +#else + dec_running(); +#endif + traceEventGcIdle(gct->cap); debugTrace(DEBUG_gc, "%d GC threads still running", r); @@ -1400,8 +1409,10 @@ mark_root(void *user USED_IF_THREADS, StgClosure **root) // so we need to save and restore it here. NB. only call // mark_root() from the main GC thread, otherwise gct will be // incorrect. +#if defined(THREADED_RTS) gc_thread *saved_gct; saved_gct = gct; +#endif SET_GCT(user); evacuate(root); diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c index 9efcb6f3be..677998ff14 100644 --- a/rts/sm/GCUtils.c +++ b/rts/sm/GCUtils.c @@ -211,8 +211,8 @@ todo_block_full (nat size, gen_workspace *ws) // Otherwise, push this block out to the global list. else { - generation *gen; - gen = ws->gen; + DEBUG_ONLY( generation *gen ); + DEBUG_ONLY( gen = ws->gen ); debugTrace(DEBUG_gc, "push todo block %p (%ld words), step %d, todo_q: %ld", bd->start, (unsigned long)(bd->free - bd->u.scan), gen->no, dequeElements(ws->todo_q)); |