diff options
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Disassembler.c | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/rts/Disassembler.c b/rts/Disassembler.c index fff3fe9d76..d043e1d012 100644 --- a/rts/Disassembler.c +++ b/rts/Disassembler.c @@ -40,7 +40,31 @@ disInstr ( StgBCO *bco, int pc ) StgPtr* ptrs = (StgPtr*)(&ptrs_arr->payload[0]); instr = instrs[pc++]; - switch (instr) { + if (instr & bci_FLAG_LARGE_ARGS) { + debugBelch ("LARGE "); + } + +#define BCO_NEXT instrs[pc++] +#define BCO_NEXT_32 (pc += 2) +#define BCO_READ_NEXT_32 (BCO_NEXT_32, (((StgWord) instrs[pc-2]) << 16) \ + + ( (StgWord) instrs[pc-1])) +#define BCO_NEXT_64 (pc += 4) +#define BCO_READ_NEXT_64 (BCO_NEXT_64, (((StgWord) instrs[pc-4]) << 48) \ + + (((StgWord) instrs[pc-3]) << 32) \ + + (((StgWord) instrs[pc-2]) << 16) \ + + ( (StgWord) instrs[pc-1])) +#if WORD_SIZE_IN_BITS == 32 +#define BCO_NEXT_WORD BCO_NEXT_32 +#define BCO_READ_NEXT_WORD BCO_READ_NEXT_32 +#elif WORD_SIZE_IN_BITS == 64 +#define BCO_NEXT_WORD BCO_NEXT_64 +#define BCO_READ_NEXT_WORD BCO_READ_NEXT_64 +#else +#error Cannot cope with WORD_SIZE_IN_BITS being nether 32 nor 64 +#endif +#define BCO_GET_LARGE_ARG ((instr & bci_FLAG_LARGE_ARGS) ? BCO_READ_NEXT_WORD : BCO_NEXT) + + switch (instr & 0xff) { case bci_BRK_FUN: debugBelch ("BRK_FUN " ); printPtr( ptrs[instrs[pc]] ); debugBelch (" %d ", instrs[pc+1]); printPtr( ptrs[instrs[pc+2]] ); debugBelch("\n" ); @@ -54,9 +78,11 @@ disInstr ( StgBCO *bco, int pc ) debugBelch("CCALL marshaller at 0x%lx\n", literals[instrs[pc]] ); pc += 1; break; - case bci_STKCHECK: - debugBelch("STKCHECK %d\n", instrs[pc] ); - pc += 1; break; + case bci_STKCHECK: { + StgWord stk_words_reqd = BCO_GET_LARGE_ARG + 1; + debugBelch("STKCHECK %lu\n", (lnat)stk_words_reqd ); + break; + } case bci_PUSH_L: debugBelch("PUSH_L %d\n", instrs[pc] ); pc += 1; break; @@ -170,10 +196,12 @@ disInstr ( StgBCO *bco, int pc ) debugBelch("\n"); pc += 2; break; - case bci_TESTLT_I: - debugBelch("TESTLT_I %ld, fail to %d\n", literals[instrs[pc]], - instrs[pc+1]); - pc += 2; break; + case bci_TESTLT_I: { + unsigned int discr = BCO_NEXT; + int failto = BCO_GET_LARGE_ARG; + debugBelch("TESTLT_I %ld, fail to %d\n", literals[discr], failto); + break; + } case bci_TESTEQ_I: debugBelch("TESTEQ_I %ld, fail to %d\n", literals[instrs[pc]], instrs[pc+1]); |