Browse Source

dump jump tables

cache-refactoring
Aleksey Demakov 18 years ago
parent
commit
b1bf15e2c9
  1. 8
      ChangeLog
  2. 1
      include/jit/jit-opcode.h
  3. 27
      jit/jit-dump.c
  4. 2
      jit/jit-opcode.c

8
ChangeLog

@ -1,3 +1,11 @@
2006-08-29 Aleksey Demakov <ademakov@gmail.com>
* include/jit/jit-opcode.h:
* jit/jit-opcode.c: add JIT_OPCODE_IS_JUMP_TABLE flag to mark the
JIT_OP_JUMP_TABLE opcode.
* jit/jit-dump.c (jit_dump_insn, dump_interp_code): add jump table
dumping.
2006-08-28 Klaus Treichel <ktreichel@web.de>

1
include/jit/jit-opcode.h

@ -568,6 +568,7 @@ struct jit_opcode_info
#define JIT_OPCODE_IS_CALL_EXTERNAL 0x00004000
#define JIT_OPCODE_IS_REG 0x00008000
#define JIT_OPCODE_IS_ADDROF_LABEL 0x00010000
#define JIT_OPCODE_IS_JUMP_TABLE 0x00020000
#define JIT_OPCODE_OPER_MASK 0x01F00000
#define JIT_OPCODE_OPER_NONE 0x00000000
#define JIT_OPCODE_OPER_ADD 0x00100000

27
jit/jit-dump.c

@ -419,6 +419,22 @@ void jit_dump_insn(FILE *stream, jit_function_t func, jit_insn_t insn)
(long)(jit_insn_get_label(insn)));
return;
}
else if((flags & JIT_OPCODE_IS_JUMP_TABLE) != 0)
{
jit_label_t *labels;
jit_nint num_labels, label;
labels = (jit_label_t *)jit_value_get_nint_constant(jit_insn_get_value1(insn));
num_labels = jit_value_get_nint_constant(jit_insn_get_value2(insn));
fprintf(stream, "jump_table ");
dump_value(stream, func, jit_insn_get_dest(insn), flags & JIT_OPCODE_DEST_MASK);
printf(" : {");
for(label = 0; label < num_labels; label++)
{
printf(" .L%ld", (long) labels[label]);
}
printf(" }");
return;
}
/* Output the destination information */
if((flags & JIT_OPCODE_DEST_MASK) != JIT_OPCODE_DEST_EMPTY &&
@ -629,6 +645,17 @@ static void dump_interp_code(FILE *stream, void **pc, void **end)
(long)(jit_nint)(pc[1]), (long)(jit_nint)(pc[2]));
pc += 3;
}
else if((info->flags & JIT_OPCODE_IS_JUMP_TABLE) != 0)
{
jit_nint label, num_labels;
num_labels = (jit_nint)pc[0];
for(label = 1; label <= num_labels; label++)
{
fprintf(stream, " %lX",
(long)(jit_nint)pc[label]);
}
pc += 1 + num_labels;
}
}
break;
}

2
jit/jit-opcode.c

@ -539,7 +539,7 @@ jit_opcode_info_t const jit_opcodes[JIT_OP_NUM_OPCODES] = {
/*
* Switch statement support.
*/
{"jump_table", F_(PTR, PTR, INT)},
{"jump_table", F_(ANY, PTR, INT)|JIT_OPCODE_IS_JUMP_TABLE},
};
#if defined(JIT_BACKEND_INTERP)

Loading…
Cancel
Save