[project @ 2002-10-22 11:01:18 by simonmar]
authorsimonmar <unknown>
Tue, 22 Oct 2002 11:01:20 +0000 (11:01 +0000)
committersimonmar <unknown>
Tue, 22 Oct 2002 11:01:20 +0000 (11:01 +0000)
change the types of cmp_thread, rts_getThreadId, and labelThread to
take StgPtr rather than StgTSO *, since the compiler now has no
distinction between these two types in the back end.

I also noticed that labelThread need not be a primitive: it could just
as well be a normal C function called by the FFI, but I haven't made
that change.

ghc/includes/PrimOps.h
ghc/rts/PrimOps.hc
ghc/rts/Schedule.c
ghc/rts/Schedule.h

index a43105e..0e4ee74 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.h,v 1.98 2002/10/18 09:51:04 simonmar Exp $
+ * $Id: PrimOps.h,v 1.99 2002/10/22 11:01:18 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -276,10 +276,8 @@ EXTFUN_RTS(unblockAsyncExceptionszh_fast);
 EXTFUN_RTS(myThreadIdzh_fast);
 EXTFUN_RTS(labelThreadzh_fast);
 
-extern int cmp_thread(const StgTSO *tso1, const StgTSO *tso2);
-extern int rts_getThreadId(const StgTSO *tso);
-extern void labelThread(StgTSO *tso, char *label);
-
+extern int cmp_thread(StgPtr tso1, StgPtr tso2);
+extern int rts_getThreadId(StgPtr tso);
 
 /* -----------------------------------------------------------------------------
    Weak Pointer PrimOps.
index 9320708..a860dc8 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.101 2002/10/18 09:51:03 simonmar Exp $
+ * $Id: PrimOps.hc,v 1.102 2002/10/22 11:01:19 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -1123,7 +1123,7 @@ FN_(labelThreadzh_fast)
        R1.p = ThreadId#
        R2.p = Addr# */
 #ifdef DEBUG
-  STGCALL2(labelThread,(StgTSO *)R1.p,(char *)R2.p);
+  STGCALL2(labelThread,R1.p,(char *)R2.p);
 #endif
   JMP_(ENTRY_CODE(Sp[0]));
   FE_
index 9759b55..17c7e74 100644 (file)
@@ -1,5 +1,5 @@
 /* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.156 2002/09/25 14:46:31 simonmar Exp $
+ * $Id: Schedule.c,v 1.157 2002/10/22 11:01:19 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -1657,10 +1657,11 @@ static void unblockThread(StgTSO *tso);
  * instances of Eq/Ord for ThreadIds.
  * ------------------------------------------------------------------------ */
 
-int cmp_thread(const StgTSO *tso1, const StgTSO *tso2) 
+int
+cmp_thread(StgPtr tso1, StgPtr tso2) 
 { 
-  StgThreadID id1 = tso1->id; 
-  StgThreadID id2 = tso2->id;
+  StgThreadID id1 = ((StgTSO *)tso1)->id; 
+  StgThreadID id2 = ((StgTSO *)tso2)->id;
  
   if (id1 < id2) return (-1);
   if (id1 > id2) return 1;
@@ -1672,13 +1673,15 @@ int cmp_thread(const StgTSO *tso1, const StgTSO *tso2)
  *
  * This is used in the implementation of Show for ThreadIds.
  * ------------------------------------------------------------------------ */
-int rts_getThreadId(const StgTSO *tso) 
+int
+rts_getThreadId(StgPtr tso) 
 {
-  return tso->id;
+  return ((StgTSO *)tso)->id;
 }
 
 #ifdef DEBUG
-void labelThread(StgTSO *tso, char *label)
+void
+labelThread(StgPtr tso, char *label)
 {
   int len;
   void *buf;
index 7722802..85bece5 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Schedule.h,v 1.35 2002/07/25 18:37:00 sof Exp $
+ * $Id: Schedule.h,v 1.36 2002/10/22 11:01:20 simonmar Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -197,6 +197,8 @@ void print_bq (StgClosure *node);
 void print_bqe (StgBlockingQueueElement *bqe);
 #endif
 
+void labelThread(StgPtr tso, char *label);
+
 /* -----------------------------------------------------------------------------
  * Some convenient macros...
  */