X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSchedule.c;h=ecd47aa41b9d9edf7729dfa1cf71c1ee3f6e609a;hb=153b9cb9b11e05c4edb1b6bc0a7b972660e41f70;hp=95e9ba46efcab70fc77d34f3f429df9f9ba01dd8;hpb=96757f6a4ec72dc609468d3da442db38a73df23e;p=ghc-hetmet.git diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 95e9ba4..ecd47aa 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -542,7 +542,10 @@ schedule( StgMainThread *mainThread USED_WHEN_RTS_SUPPORTS_THREADS, // ToDo: add deadlock detection in GUM (similar to SMP) -- HWL #endif -#if defined(RTS_SUPPORTS_THREADS) +#if defined(RTS_SUPPORTS_THREADS) || defined(mingw32_HOST_OS) + /* win32: might be back here due to awaitEvent() being abandoned + * as a result of a console event having been delivered. + */ if ( EMPTY_RUN_QUEUE() ) { continue; // nothing to do } @@ -1334,7 +1337,7 @@ run_thread: * When next scheduled they will try to commit, this commit will fail and * they will retry. */ for (t = all_threads; t != END_TSO_QUEUE; t = t -> link) { - if (t -> trec != NO_TREC && t -> why_blocked == NotBlocked) { + if (t -> what_next != ThreadRelocated && t -> trec != NO_TREC && t -> why_blocked == NotBlocked) { if (!stmValidateTransaction (t -> trec)) { IF_DEBUG(stm, sched_belch("trec %p found wasting its time", t)); @@ -1343,7 +1346,9 @@ run_thread: // partially-evaluated thunks on the heap. raiseAsync_(t, NULL, rtsTrue); +#ifdef REG_R1 ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME); +#endif } } } @@ -1419,7 +1424,7 @@ isThreadBound(StgTSO* tso USED_IN_THREADED_RTS) * Singleton fork(). Do not copy any running threads. * ------------------------------------------------------------------------- */ -#ifndef mingw32_TARGET_OS +#ifndef mingw32_HOST_OS #define FORKPROCESS_PRIMOP_SUPPORTED #endif @@ -2757,7 +2762,7 @@ unblockThread(StgTSO *tso) case BlockedOnRead: case BlockedOnWrite: -#if defined(mingw32_TARGET_OS) +#if defined(mingw32_HOST_OS) case BlockedOnDoProc: #endif { @@ -2895,7 +2900,7 @@ unblockThread(StgTSO *tso) case BlockedOnRead: case BlockedOnWrite: -#if defined(mingw32_TARGET_OS) +#if defined(mingw32_HOST_OS) case BlockedOnDoProc: #endif { @@ -3110,7 +3115,17 @@ raiseAsync_(StgTSO *tso, StgClosure *exception, rtsBool stop_at_atomically) ASSERT(stop_at_atomically); ASSERT(stmGetEnclosingTRec(tso->trec) == NO_TREC); stmCondemnTransaction(tso -> trec); +#ifdef REG_R1 tso->sp = frame; +#else + // R1 is not a register: the return convention for IO in + // this case puts the return value on the stack, so we + // need to set up the stack to return to the atomically + // frame properly... + tso->sp = frame - 2; + tso->sp[1] = (StgWord) &stg_NO_FINALIZER_closure; // why not? + tso->sp[0] = (StgWord) &stg_ut_1_0_unreg_info; +#endif tso->what_next = ThreadRunGHC; return; @@ -3352,7 +3367,7 @@ findRetryFrameHelper (StgTSO *tso) } } } - + /* ----------------------------------------------------------------------------- resurrectThreads is called after garbage collection on the list of threads found to be garbage. Each of these threads will be woken @@ -3415,7 +3430,7 @@ printThreadBlockage(StgTSO *tso) case BlockedOnWrite: debugBelch("is blocked on write to fd %d", tso->block_info.fd); break; -#if defined(mingw32_TARGET_OS) +#if defined(mingw32_HOST_OS) case BlockedOnDoProc: debugBelch("is blocked on proc (request: %d)", tso->block_info.async_result->reqID); break;