From 8fe4440b10689b018ac3958d61499c918f147870 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 10 Oct 2006 17:32:09 +0000 Subject: [PATCH] fixed non-sequential not having a correct default case --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40114 --- sourcepawn/vm/jit/x86/jit_x86.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sourcepawn/vm/jit/x86/jit_x86.cpp b/sourcepawn/vm/jit/x86/jit_x86.cpp index ee7120ce..038cb3de 100644 --- a/sourcepawn/vm/jit/x86/jit_x86.cpp +++ b/sourcepawn/vm/jit/x86/jit_x86.cpp @@ -1364,10 +1364,15 @@ inline void WriteOp_Switch(JitWriter *jit) { jit->write_uint32(base + RelocLookup(jit, cases[i].offs, false)); } + //if we get here, there was a bug in the JIT, so we should break into the debugger + jit->write_ubyte(IA32_INT3); } else { /* The slow version. Go through each case and generate a check. * In the future we should replace case tables of more than ~8 cases with a * hash table lookup. + * :THOUGHT: Another method of optimizing this - fill in the gaps with jumps to the default case, + * but only if we're under N cases or so! + * :THOUGHT: Write out a static btree lookup :) */ cell_t val; for (cell_t i=0; iwrite_ubyte(IA32_INT3); } }