[project @ 2001-02-11 17:51:07 by simonmar]
[ghc-hetmet.git] / ghc / rts / Interpreter.c
index 99f126b..ea0757d 100644 (file)
@@ -5,12 +5,10 @@
  * Copyright (c) 1994-2000.
  *
  * $RCSfile: Interpreter.c,v $
- * $Revision: 1.15 $
- * $Date: 2001/02/06 12:02:05 $
+ * $Revision: 1.17 $
+ * $Date: 2001/02/11 17:51:07 $
  * ---------------------------------------------------------------------------*/
 
-#ifdef GHCI
-
 #include "Rts.h"
 #include "RtsAPI.h"
 #include "RtsUtils.h"
@@ -383,7 +381,16 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
              cap->rCurrentTSO->what_next = ThreadEnterInterp;
              RETURN(StackOverflow);
           }
+
+          /* Context-switch check */
+          if (context_switch) {
+             iSp--;
+             StackWord(0) = (W_)obj;
+             cap->rCurrentTSO->what_next = ThreadEnterInterp;
+             RETURN(ThreadYielding);
+         }
  
+
 #         ifdef INTERP_STATS
           it_lastopc = 0; /* no opcode */
 #         endif
@@ -762,5 +769,3 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
 
     barf("fallen off end of object-type switch in interpretBCO()");
 }
-
-#endif /* GHCI */