X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=rts%2FDisassembler.c;h=fff3fe9d7632bce75fc24e009f7fc714be2b23e7;hp=b084a29b89705135d4d8ec5a6550cacc850178fa;hb=cf5905ea24904cf73a041fd7535e8723a668cb9a;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1 diff --git a/rts/Disassembler.c b/rts/Disassembler.c index b084a29..fff3fe9 100644 --- a/rts/Disassembler.c +++ b/rts/Disassembler.c @@ -13,12 +13,10 @@ #include "PosixSource.h" #include "Rts.h" #include "RtsAPI.h" +#include "rts/Bytecodes.h" + #include "RtsUtils.h" -#include "Closures.h" -#include "TSO.h" #include "Schedule.h" - -#include "Bytecodes.h" #include "Printer.h" #include "Disassembler.h" #include "Interpreter.h" @@ -31,6 +29,7 @@ int disInstr ( StgBCO *bco, int pc ) { int i; + StgWord16 instr; StgWord16* instrs = (StgWord16*)(bco->instrs->payload); @@ -40,16 +39,19 @@ disInstr ( StgBCO *bco, int pc ) StgMutArrPtrs* ptrs_arr = bco->ptrs; StgPtr* ptrs = (StgPtr*)(&ptrs_arr->payload[0]); - StgArrWords* itbls_arr = bco->itbls; - StgInfoTable** itbls = (StgInfoTable**)(&itbls_arr->payload[0]); - - switch (instrs[pc++]) { + instr = instrs[pc++]; + switch (instr) { + case bci_BRK_FUN: + debugBelch ("BRK_FUN " ); printPtr( ptrs[instrs[pc]] ); + debugBelch (" %d ", instrs[pc+1]); printPtr( ptrs[instrs[pc+2]] ); debugBelch("\n" ); + pc += 3; + break; case bci_SWIZZLE: debugBelch("SWIZZLE stkoff %d by %d\n", instrs[pc], (signed int)instrs[pc+1]); pc += 2; break; case bci_CCALL: - debugBelch("CCALL marshaller at 0x%x\n", + debugBelch("CCALL marshaller at 0x%lx\n", literals[instrs[pc]] ); pc += 1; break; case bci_STKCHECK: @@ -102,7 +104,7 @@ disInstr ( StgBCO *bco, int pc ) case bci_PUSH_UBX: debugBelch("PUSH_UBX "); for (i = 0; i < instrs[pc+1]; i++) - debugBelch("0x%x ", literals[i + instrs[pc]] ); + debugBelch("0x%lx ", literals[i + instrs[pc]] ); debugBelch("\n"); pc += 2; break; case bci_PUSH_APPLY_N: @@ -144,47 +146,54 @@ disInstr ( StgBCO *bco, int pc ) case bci_ALLOC_AP: debugBelch("ALLOC_AP %d words\n", instrs[pc] ); pc += 1; break; + case bci_ALLOC_AP_NOUPD: + debugBelch("ALLOC_AP_NOUPD %d words\n", instrs[pc] ); + pc += 1; break; case bci_ALLOC_PAP: - debugBelch("ALLOC_PAP %d words, %d arity\n", + debugBelch("ALLOC_PAP %d arity, %d words\n", instrs[pc], instrs[pc+1] ); pc += 2; break; case bci_MKAP: debugBelch("MKAP %d words, %d stkoff\n", instrs[pc+1], instrs[pc] ); pc += 2; break; + case bci_MKPAP: + debugBelch("MKPAP %d words, %d stkoff\n", instrs[pc+1], + instrs[pc] ); + pc += 2; break; case bci_UNPACK: debugBelch("UNPACK %d\n", instrs[pc] ); pc += 1; break; case bci_PACK: debugBelch("PACK %d words with itbl ", instrs[pc+1] ); - printPtr( (StgPtr)itbls[instrs[pc]] ); + printPtr( (StgPtr)literals[instrs[pc]] ); debugBelch("\n"); pc += 2; break; case bci_TESTLT_I: - debugBelch("TESTLT_I %d, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTLT_I %ld, fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTEQ_I: - debugBelch("TESTEQ_I %d, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTEQ_I %ld, fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTLT_F: - debugBelch("TESTLT_F %d, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTLT_F %ld, fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTEQ_F: - debugBelch("TESTEQ_F %d, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTEQ_F %ld, fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTLT_D: - debugBelch("TESTLT_D %d, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTLT_D %ld, fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; case bci_TESTEQ_D: - debugBelch("TESTEQ_D %d, fail to %d\n", literals[instrs[pc]], + debugBelch("TESTEQ_D %ld, fail to %d\n", literals[instrs[pc]], instrs[pc+1]); pc += 2; break; @@ -230,7 +239,7 @@ disInstr ( StgBCO *bco, int pc ) break; default: - barf("disInstr: unknown opcode"); + barf("disInstr: unknown opcode %u", (unsigned int) instr); } return pc; }