[project @ 2001-08-03 15:05:52 by sewardj]
[ghc-hetmet.git] / ghc / rts / Interpreter.c
index 2f04ad9..c249c76 100644 (file)
@@ -5,8 +5,8 @@
  * Copyright (c) 1994-2000.
  *
  * $RCSfile: Interpreter.c,v $
- * $Revision: 1.20 $
- * $Date: 2001/02/15 14:30:07 $
+ * $Revision: 1.26 $
+ * $Date: 2001/08/03 15:05:52 $
  * ---------------------------------------------------------------------------*/
 
 #include "Rts.h"
@@ -115,7 +115,7 @@ void interp_startup ( void )
 void interp_shutdown ( void )
 {
    int i, j, k, o_max, i_max, j_max;
-   fprintf(stderr, "%d constrs entered -> (%d BCO, %d UPD, %d ???)\n",
+   fprintf(stderr, "%d constrs entered -> (%d BCO, %d UPD, %d ??? )\n",
                    it_retto_BCO + it_retto_UPDATE + it_retto_other,
                    it_retto_BCO, it_retto_UPDATE, it_retto_other );
    fprintf(stderr, "%d total entries, %d unknown entries \n", 
@@ -691,6 +691,30 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
                     bciPtr = failto;
                  goto nextInsn;
               }
+              case bci_TESTLT_F: {
+                 /* The top thing on the stack should be a tagged float. */
+                 int discr   = BCO_NEXT;
+                 int failto  = BCO_NEXT;
+                 StgFloat stackFlt, discrFlt;
+                 ASSERT(sizeofW(StgFloat) == StackWord(0));
+                 stackFlt = PK_FLT( & StackWord(1) );
+                 discrFlt = PK_FLT( & BCO_LIT(discr) );
+                 if (stackFlt >= discrFlt)
+                    bciPtr = failto;
+                 goto nextInsn;
+              }
+              case bci_TESTEQ_F: {
+                 /* The top thing on the stack should be a tagged float. */
+                 int discr   = BCO_NEXT;
+                 int failto  = BCO_NEXT;
+                 StgFloat stackFlt, discrFlt;
+                 ASSERT(sizeofW(StgFloat) == StackWord(0));
+                 stackFlt = PK_FLT( & StackWord(1) );
+                 discrFlt = PK_FLT( & BCO_LIT(discr) );
+                 if (stackFlt != discrFlt)
+                    bciPtr = failto;
+                 goto nextInsn;
+              }
 
               /* Control-flow ish things */
               case bci_ENTER: {
@@ -737,14 +761,21 @@ StgThreadReturnCode interpretBCO ( Capability* cap )
                      }
                  }
               }
-        
+              case bci_CCALL: {
+                 int o_itbl                = BCO_NEXT;
+                 void(*marshall_fn)(void*) = (void (*)(void*))BCO_LIT(o_itbl);
+                 marshall_fn ( (void*)(& StackWord(0) ) );
+                 goto nextInsn;
+              }
+              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");
 
-              /* As yet unimplemented */
-              case bci_TESTLT_F:
-              case bci_TESTEQ_F:
-
               /* Errors */
               default: 
                  barf("interpretBCO: unknown or unimplemented opcode");