mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +03:00
Fixed switch case bug in JIT where no cases would crash
This commit is contained in:
parent
1a3a5331d1
commit
ef2a9a2b34
@ -79,6 +79,8 @@
|
|||||||
|
|
||||||
; Revision History
|
; Revision History
|
||||||
; ----------------
|
; ----------------
|
||||||
|
; 26 july 2005 by David "BAILOPAN" Anderson
|
||||||
|
; Fixed a bug where zero casetbl entries would crash the JIT.
|
||||||
; 17 february 2005 by Thiadmer Riemersms
|
; 17 february 2005 by Thiadmer Riemersms
|
||||||
; Addition of the BREAK opcode, removal of the older debugging opcode
|
; Addition of the BREAK opcode, removal of the older debugging opcode
|
||||||
; table. There should now be some debug support (if enabled during the
|
; table. There should now be some debug support (if enabled during the
|
||||||
@ -2194,6 +2196,9 @@ JIT_OP_SWITCH:
|
|||||||
pop ebp ; pop return address = table address
|
pop ebp ; pop return address = table address
|
||||||
mov ecx,[ebp] ; ECX = number of records
|
mov ecx,[ebp] ; ECX = number of records
|
||||||
lea ebp,[ebp+ecx*8+8] ; set pointer _after_ LAST case
|
lea ebp,[ebp+ecx*8+8] ; set pointer _after_ LAST case
|
||||||
|
;if there are zero cases we should just skip this -- bail
|
||||||
|
test ecx, ecx
|
||||||
|
jz op_switch_jump
|
||||||
op_switch_loop:
|
op_switch_loop:
|
||||||
cmp eax,[ebp-8] ; PRI == case label?
|
cmp eax,[ebp-8] ; PRI == case label?
|
||||||
je op_switch_jump ; found, jump
|
je op_switch_jump ; found, jump
|
||||||
@ -2208,6 +2213,7 @@ JIT_OP_SWITCH:
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; The caller of asm_runJIT() can determine the maximum size of the compiled
|
; The caller of asm_runJIT() can determine the maximum size of the compiled
|
||||||
; code by multiplying the result of this function by the number of opcodes in
|
; code by multiplying the result of this function by the number of opcodes in
|
||||||
; Pawn module.
|
; Pawn module.
|
||||||
|
Loading…
Reference in New Issue
Block a user