+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>
#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
(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 &&
(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;
}
/*
* 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)