[project @ 2001-05-18 09:18:05 by simonmar]
[ghc-hetmet.git] / ghc / rts / Interpreter.c
index f371862..ccbac4a 100644 (file)
@@ -5,8 +5,8 @@
  * Copyright (c) 1994-2000.
  *
  * $RCSfile: Interpreter.c,v $
- * $Revision: 1.18 $
- * $Date: 2001/02/12 12:44:11 $
+ * $Revision: 1.21 $
+ * $Date: 2001/03/21 10:56:04 $
  * ---------------------------------------------------------------------------*/
 
 #include "Rts.h"
@@ -562,7 +562,7 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
                  ap = (StgAP_UPD*)allocate_UPD(request);
                  StackWord(-1) = (W_)ap;
                  ap->n_args = n_payload;
-                 SET_HDR(ap, &stg_AP_UPD_info, ??)
+                 SET_HDR(ap, &stg_AP_UPD_info, CCS_SYSTEM/*ToDo*/)
                  iSp --;
                  goto nextInsn;
               }
@@ -706,7 +706,8 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
                  if (ret_itbl == (StgInfoTable*)&stg_ctoi_ret_R1p_info
                      || ret_itbl == (StgInfoTable*)&stg_ctoi_ret_R1n_info
                      || ret_itbl == (StgInfoTable*)&stg_ctoi_ret_F1_info
-                     || ret_itbl == (StgInfoTable*)&stg_ctoi_ret_D1_info) {
+                     || ret_itbl == (StgInfoTable*)&stg_ctoi_ret_D1_info
+                     || ret_itbl == (StgInfoTable*)&stg_ctoi_ret_V_info) {
                      /* Returning to interpreted code.  Interpret the BCO 
                         immediately underneath the itbl. */
                      StgBCO* ret_bco = (StgBCO*)StackWord(tag +1+1);
@@ -720,12 +721,29 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
                         the TOS value into R1/F1/D1 and do a standard
                         compiled-code return. */
                      StgInfoTable* magic_itbl = BCO_ITBL(o_itoc_itbl);
-                     StackWord(0) = (W_)magic_itbl;
-                     cap->rCurrentTSO->what_next = ThreadRunGHC;
-                     RETURN(ThreadYielding);
+                     if (magic_itbl != NULL) {
+                        StackWord(0) = (W_)magic_itbl;
+                        cap->rCurrentTSO->what_next = ThreadRunGHC;
+                        RETURN(ThreadYielding);
+                     } else {
+                        /* Special case -- returning a VoidRep to
+                           compiled code.  T.O.S is the VoidRep tag,
+                           and underneath is the return itbl.  Zap the
+                           tag and enter the itbl. */
+                       ASSERT(StackWord(0) == (W_)NULL);
+                       iSp ++;
+                        cap->rCurrentTSO->what_next = ThreadRunGHC;
+                        RETURN(ThreadYielding);
+                     }
                  }
               }
         
+              case bci_JMP: {
+                 /* BCO_NEXT modifies bciPtr, so be conservative. */
+                 int nextpc = BCO_NEXT;
+                 bciPtr     = nextpc;
+                 goto nextInsn;
+              }
               case bci_CASEFAIL:
                  barf("interpretBCO: hit a CASEFAIL");