projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2003-05-27 14:05:11 by simonmar]
[ghc-hetmet.git]
/
ghc
/
rts
/
Schedule.c
diff --git
a/ghc/rts/Schedule.c
b/ghc/rts/Schedule.c
index
61cae7a
..
2d99ad1
100644
(file)
--- a/
ghc/rts/Schedule.c
+++ b/
ghc/rts/Schedule.c
@@
-1,5
+1,5
@@
/* ---------------------------------------------------------------------------
/* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.163 2003/03/19 18:41:19 sof Exp $
+ * $Id: Schedule.c,v 1.169 2003/05/14 09:11:49 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
*
* (c) The GHC Team, 1998-2000
*
@@
-217,14
+217,15
@@
static StgThreadID next_thread_id = 1;
/* The smallest stack size that makes any sense is:
* RESERVED_STACK_WORDS (so we can get back from the stack overflow)
* + sizeofW(StgStopFrame) (the stg_stop_thread_info frame)
/* The smallest stack size that makes any sense is:
* RESERVED_STACK_WORDS (so we can get back from the stack overflow)
* + sizeofW(StgStopFrame) (the stg_stop_thread_info frame)
- * + 1 (the realworld token for an IO thread)
* + 1 (the closure to enter)
* + 1 (the closure to enter)
+ * + 1 (stg_ap_v_ret)
+ * + 1 (spare slot req'd by stg_ap_v_ret)
*
* A thread with this stack will bomb immediately with a stack
* overflow, which will increase its stack size.
*/
*
* A thread with this stack will bomb immediately with a stack
* overflow, which will increase its stack size.
*/
-#define MIN_STACK_WORDS (RESERVED_STACK_WORDS + sizeofW(StgStopFrame) + 2)
+#define MIN_STACK_WORDS (RESERVED_STACK_WORDS + sizeofW(StgStopFrame) + 3)
#if defined(GRAN)
#if defined(GRAN)
@@
-589,7
+590,7
@@
schedule( void )
#endif // SMP
/* check for signals each time around the scheduler */
#endif // SMP
/* check for signals each time around the scheduler */
-#ifndef mingw32_TARGET_OS
+#if defined(RTS_USER_SIGNALS)
if (signals_pending()) {
RELEASE_LOCK(&sched_mutex); /* ToDo: kill */
startSignalHandlers();
if (signals_pending()) {
RELEASE_LOCK(&sched_mutex); /* ToDo: kill */
startSignalHandlers();
@@
-656,7
+657,7
@@
schedule( void )
if ( !EMPTY_RUN_QUEUE() ) { goto not_deadlocked; }
if ( !EMPTY_RUN_QUEUE() ) { goto not_deadlocked; }
-#ifndef mingw32_TARGET_OS
+#if defined(RTS_USER_SIGNALS)
/* If we have user-installed signal handlers, then wait
* for signals to arrive rather then bombing out with a
* deadlock.
/* If we have user-installed signal handlers, then wait
* for signals to arrive rather then bombing out with a
* deadlock.
@@
-1669,11
+1670,7
@@
suspendThread( StgRegTable *reg,
StgRegTable *
resumeThread( StgInt tok,
StgRegTable *
resumeThread( StgInt tok,
- rtsBool concCall
-#if !defined(RTS_SUPPORTS_THREADS)
- STG_UNUSED
-#endif
- )
+ rtsBool concCall STG_UNUSED )
{
StgTSO *tso, **prev;
Capability *cap;
{
StgTSO *tso, **prev;
Capability *cap;
@@
-1765,11
+1762,8
@@
labelThread(StgPtr tso, char *label)
/* Caveat: Once set, you can only set the thread name to "" */
len = strlen(label)+1;
/* Caveat: Once set, you can only set the thread name to "" */
len = strlen(label)+1;
- buf = malloc(len);
- if (buf == NULL) {
- fprintf(stderr,"insufficient memory for labelThread!\n");
- } else
- strncpy(buf,label,len);
+ buf = stgMallocBytes(len * sizeof(char), "Schedule.c:labelThread()");
+ strncpy(buf,label,len);
/* Update will free the old memory for us */
updateThreadLabel((StgWord)tso,buf);
}
/* Update will free the old memory for us */
updateThreadLabel((StgWord)tso,buf);
}
@@
-2362,7
+2356,7
@@
waitThread_(StgMainThread* m
IF_DEBUG(scheduler, fprintf(stderr, "== scheduler: main thread (%d) finished\n",
m->tso->id));
IF_DEBUG(scheduler, fprintf(stderr, "== scheduler: main thread (%d) finished\n",
m->tso->id));
- free(m);
+ stgFree(m);
// Postcondition: sched_mutex still held
return stat;
// Postcondition: sched_mutex still held
return stat;
@@
-2537,7
+2531,7
@@
GetRoots(evac_fn evac)
markSparkQueue(evac);
#endif
markSparkQueue(evac);
#endif
-#ifndef mingw32_TARGET_OS
+#if defined(RTS_USER_SIGNALS)
// mark the signal handlers (signals should be already blocked)
markSignalHandlers(evac);
#endif
// mark the signal handlers (signals should be already blocked)
markSignalHandlers(evac);
#endif
@@
-2622,7
+2616,7
@@
performGCWithRoots(void (*get_roots)(evac_fn))
static StgTSO *
threadStackOverflow(StgTSO *tso)
{
static StgTSO *
threadStackOverflow(StgTSO *tso)
{
- nat new_stack_size, new_tso_size, diff, stack_words;
+ nat new_stack_size, new_tso_size, stack_words;
StgPtr new_sp;
StgTSO *dest;
StgPtr new_sp;
StgTSO *dest;
@@
-2663,8
+2657,7
@@
threadStackOverflow(StgTSO *tso)
memcpy(new_sp, tso->sp, stack_words * sizeof(W_));
/* relocate the stack pointers... */
memcpy(new_sp, tso->sp, stack_words * sizeof(W_));
/* relocate the stack pointers... */
- diff = (P_)new_sp - (P_)tso->sp; /* In *words* */
- dest->sp = new_sp;
+ dest->sp = new_sp;
dest->stack_size = new_stack_size;
/* Mark the old TSO as relocated. We have to check for relocated
dest->stack_size = new_stack_size;
/* Mark the old TSO as relocated. We have to check for relocated