[project @ 2001-08-14 13:40:07 by sewardj]
[ghc-hetmet.git] / ghc / rts / Interpreter.c
index 7a382a4..deb42fb 100644 (file)
@@ -5,10 +5,11 @@
  * Copyright (c) 1994-2000.
  *
  * $RCSfile: Interpreter.c,v $
- * $Revision: 1.24 $
- * $Date: 2001/05/27 06:08:24 $
+ * $Revision: 1.30 $
+ * $Date: 2001/08/14 13:40:09 $
  * ---------------------------------------------------------------------------*/
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
 #include "RtsUtils.h"
 #define BCO_LIT(n)    (W_)literals[n]
 #define BCO_ITBL(n)   itbls[n]
 
-#define LOAD_STACK_POINTERS \
-    iSp = cap->rCurrentTSO->sp; iSu = cap->rCurrentTSO->su;
+#define LOAD_STACK_POINTERS          \
+    iSp = cap->rCurrentTSO->sp;      \
+    iSu = cap->rCurrentTSO->su;      \
+    /* We don't change this ... */   \
+    iSpLim = cap->rCurrentTSO->stack + RESERVED_STACK_WORDS;
+
 
-#define SAVE_STACK_POINTERS \
-    cap->rCurrentTSO->sp = iSp; cap->rCurrentTSO->su = iSu;
+#define SAVE_STACK_POINTERS          \
+    cap->rCurrentTSO->sp = iSp;      \
+    cap->rCurrentTSO->su = iSu;
 
-#define RETURN(retcode) \
+#define RETURN(retcode)              \
    SAVE_STACK_POINTERS; return retcode;
 
 
@@ -169,9 +175,6 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
 
     LOAD_STACK_POINTERS;
 
-    /* We don't change this ... */
-    iSpLim = cap->rCurrentTSO->stack + RESERVED_STACK_WORDS;
-
     /* Main object-entering loop.  Object to be entered is on top of
        stack. */
     nextEnter:
@@ -761,7 +764,23 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
                      }
                  }
               }
-        
+              case bci_SWIZZLE: {
+                 int stkoff = BCO_NEXT;
+                 signed short n = (signed short)(BCO_NEXT);
+                 StackWord(stkoff) += (W_)n;
+                 goto nextInsn;
+              }
+              case bci_CCALL: {
+                 StgInt tok;
+                 int o_itbl                = BCO_NEXT;
+                 void(*marshall_fn)(void*) = (void (*)(void*))BCO_LIT(o_itbl);
+                 SAVE_STACK_POINTERS;
+                 tok = suspendThread(cap);
+                 marshall_fn ( (void*)(& StackWord(0) ) );
+                 cap = resumeThread(tok);
+                 LOAD_STACK_POINTERS;
+                 goto nextInsn;
+              }
               case bci_JMP: {
                  /* BCO_NEXT modifies bciPtr, so be conservative. */
                  int nextpc = BCO_NEXT;