[project @ 2000-05-11 19:37:30 by rrt]
[ghc-hetmet.git] / ghc / rts / Disassembler.c
index 9cd5054..56792cb 100644 (file)
@@ -5,8 +5,8 @@
  * Copyright (c) 1994-1998.
  *
  * $RCSfile: Disassembler.c,v $
- * $Revision: 1.6 $
- * $Date: 1999/04/27 10:07:19 $
+ * $Revision: 1.12 $
+ * $Date: 1999/12/07 11:49:11 $
  * ---------------------------------------------------------------------------*/
 
 #include "Rts.h"
@@ -97,6 +97,17 @@ static InstrPtr disInfo   ( StgBCO *bco, InstrPtr pc, char* i )
     return pc;
 }
 
+static InstrPtr disInfo16 ( StgBCO *bco, InstrPtr pc, char* i )
+{
+    StgWord x = bcoInstr16(bco,pc); 
+    StgInfoTable* info = bcoConstInfoPtr(bco,x);
+    pc+=2;
+    /* ToDo: print contents of infotable */
+    fprintf(stderr,"%s ",i);
+    printPtr(stgCast(StgPtr,info));
+    return pc;
+}
+
 static InstrPtr disConstPtr  ( StgBCO *bco, InstrPtr pc, char* i )
 {
     StgInt o = bcoInstr(bco,pc++);
@@ -120,14 +131,14 @@ static InstrPtr disConstPtr16 ( StgBCO *bco, InstrPtr pc, char* i )
 static InstrPtr disConstInt  ( StgBCO *bco, InstrPtr pc, char* i )
 {
     StgInt x = bcoConstInt(bco,bcoInstr(bco,pc++));
-    fprintf(stderr,"%s %d",i,x);
+    fprintf(stderr,"%s %d (0x%x)",i,x,x);
     return pc;
 }
 
 static InstrPtr disConstInt16 ( StgBCO *bco, InstrPtr pc, char* i )
 {
     StgInt x = bcoConstInt(bco,bcoInstr16(bco,pc)); pc += 2;
-    fprintf(stderr,"%s %d",i,x);
+    fprintf(stderr,"%s %d (0x%x)",i,x,x);
     return pc;
 }
 
@@ -205,6 +216,8 @@ InstrPtr disInstr( StgBCO *bco, InstrPtr pc )
             return disNone(bco,pc,"PANIC");
     case i_STK_CHECK:
             return disInt(bco,pc,"STK_CHECK");
+    case i_STK_CHECK_big:
+            return disInt16(bco,pc,"STK_CHECK_big");
     case i_ARG_CHECK:
             return disInt(bco,pc,"ARG_CHECK");
     case i_ALLOC_AP:
@@ -213,6 +226,8 @@ InstrPtr disInstr( StgBCO *bco, InstrPtr pc )
             return disInt(bco,pc,"ALLOC_PAP");
     case i_ALLOC_CONSTR:
             return disInfo(bco,pc,"ALLOC_CONSTR");
+    case i_ALLOC_CONSTR_big:
+            return disInfo16(bco,pc,"ALLOC_CONSTR_big");
     case i_MKAP:
             return disIntInt(bco,pc,"MKAP");
     case i_MKAP_big:
@@ -336,14 +351,12 @@ InstrPtr disInstr( StgBCO *bco, InstrPtr pc )
     case i_UNPACK_DOUBLE:
             return disNone(bco,pc,"UNPACK_DOUBLE");
 
-#ifdef PROVIDE_STABLE
     case i_VAR_STABLE:
             return disInt(bco,pc,"VAR_STABLE");
     case i_PACK_STABLE:
             return disNone(bco,pc,"PACK_STABLE");
     case i_UNPACK_STABLE:
             return disNone(bco,pc,"UNPACK_STABLE");
-#endif
 
     case i_PRIMOP1:
         {
@@ -371,12 +384,18 @@ InstrPtr disInstr( StgBCO *bco, InstrPtr pc )
             switch (op) {
             case i_INTERNAL_ERROR2:
                     return disNone(bco,pc,"INTERNAL_ERROR2");
-            case i_ccall_Id:
-                    return disNone(bco,pc,"ccall_Id");
-            case i_ccall_IO:
-                    return disNone(bco,pc,"ccall_IO");
+            case i_ccall_ccall_Id:
+                    return disNone(bco,pc,"ccall_ccall_Id");
+            case i_ccall_ccall_IO:
+                    return disNone(bco,pc,"ccall_ccall_IO");
+            case i_ccall_stdcall_Id:
+                    return disNone(bco,pc,"ccall_stdcall_Id");
+            case i_ccall_stdcall_IO:
+                    return disNone(bco,pc,"ccall_stdcall_IO");
             case i_raise:
                     return disNone(bco,pc,"primRaise");
+            case i_takeMVar:
+                    return disNone(bco,pc,"primTakeMVar");
             default:
                 {
                     const AsmPrim* p = asmFindPrimop(i_PRIMOP2,op);