From: Aleksey Demakov Date: Fri, 16 Jun 2006 02:35:16 +0000 (+0000) Subject: Fix JIT_OP_IDIV and JIT_OP_IREM rules for the divisor value of -1. X-Git-Tag: before.move.to.git~232 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=18f20bf523eb6c9cdc22eec121078096b5c64386;p=francis%2Flibjit.git Fix JIT_OP_IDIV and JIT_OP_IREM rules for the divisor value of -1. --- diff --git a/ChangeLog b/ChangeLog index 626d951..e25f6ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-06-16 Aleksey Demakov + + * jit/jit-rules-x86.sel, jit/jit-rules-x86.ins: fix JIT_OP_IDIV and + JIT_OP_IREM rules for the divisor value of -1. + 2006-06-09 Aleksey Demakov * jit/jit-rules-x86.ins: rewrite JIT_OP_STORE_RELATIVE_BYTE, diff --git a/jit/jit-rules-x86.ins b/jit/jit-rules-x86.ins index 4b7f845..b94095f 100644 --- a/jit/jit-rules-x86.ins +++ b/jit/jit-rules-x86.ins @@ -449,8 +449,9 @@ JIT_OP_IDIV: binary, spill_before, more_space { /* Dividing by -1 gives an exception if the argument is minint, or simply negates for other values */ - unsigned char *patch = inst; + unsigned char *patch; x86_alu_reg_imm(inst, X86_CMP, $1, jit_min_int); + patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_ARITHMETIC); x86_patch(patch, inst); @@ -911,8 +912,9 @@ JIT_OP_IREM: binary, spill_before, more_space { /* Dividing by -1 gives an exception if the argument is minint, or simply gives a remainder of zero */ - unsigned char *patch = inst; + unsigned char *patch; x86_alu_reg_imm(inst, X86_CMP, $1, jit_min_int); + patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_ARITHMETIC); x86_patch(patch, inst); diff --git a/jit/jit-rules-x86.sel b/jit/jit-rules-x86.sel index 8b3acdf..9a20f85 100644 --- a/jit/jit-rules-x86.sel +++ b/jit/jit-rules-x86.sel @@ -449,8 +449,9 @@ JIT_OP_IDIV: binary, spill_before, more_space { /* Dividing by -1 gives an exception if the argument is minint, or simply negates for other values */ - unsigned char *patch = inst; + unsigned char *patch; x86_alu_reg_imm(inst, X86_CMP, $1, jit_min_int); + patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_ARITHMETIC); x86_patch(patch, inst); @@ -911,8 +912,9 @@ JIT_OP_IREM: binary, spill_before, more_space { /* Dividing by -1 gives an exception if the argument is minint, or simply gives a remainder of zero */ - unsigned char *patch = inst; + unsigned char *patch; x86_alu_reg_imm(inst, X86_CMP, $1, jit_min_int); + patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_ARITHMETIC); x86_patch(patch, inst);