/* Automatically generated from ./jit-rules-x86.sel - DO NOT EDIT */ /* * Copyright (C) 2004 Southern Storm Software, Pty Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(JIT_INCLUDE_RULES) case JIT_OP_TRUNC_SBYTE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 26 "./jit-rules-x86.sel" { inst = widen_byte(inst, _jit_reg_info[reg].cpu_reg, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_TRUNC_UBYTE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 31 "./jit-rules-x86.sel" { inst = widen_byte(inst, _jit_reg_info[reg].cpu_reg, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_TRUNC_SHORT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 36 "./jit-rules-x86.sel" { x86_widen_reg(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_TRUNC_USHORT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 41 "./jit-rules-x86.sel" { x86_widen_reg(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_CHECK_SBYTE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 46 "./jit-rules-x86.sel" { unsigned char *patch1; unsigned char *patch2; x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, -128); patch1 = inst; x86_branch8(inst, X86_CC_LE, 0, 1); x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, 127); patch2 = inst; x86_branch8(inst, X86_CC_LE, 0, 1); x86_patch(patch1, inst); inst = throw_builtin(inst, func, JIT_RESULT_OVERFLOW); x86_patch(patch2, inst); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_CHECK_UBYTE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 61 "./jit-rules-x86.sel" { unsigned char *patch1; x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, 256); patch1 = inst; x86_branch8(inst, X86_CC_LT, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_OVERFLOW); x86_patch(patch1, inst); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_CHECK_SHORT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 71 "./jit-rules-x86.sel" { unsigned char *patch1; unsigned char *patch2; x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, -32768); patch1 = inst; x86_branch8(inst, X86_CC_LE, 0, 1); x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, 32767); patch2 = inst; x86_branch8(inst, X86_CC_LE, 0, 1); x86_patch(patch1, inst); inst = throw_builtin(inst, func, JIT_RESULT_OVERFLOW); x86_patch(patch2, inst); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_CHECK_USHORT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 86 "./jit-rules-x86.sel" { unsigned char *patch1; x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, 65536); patch1 = inst; x86_branch8(inst, X86_CC_LT, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_OVERFLOW); x86_patch(patch1, inst); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_CHECK_INT: case JIT_OP_CHECK_UINT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 96 "./jit-rules-x86.sel" { unsigned char *patch1; x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, 0); patch1 = inst; x86_branch8(inst, X86_CC_GE, 0, 1); inst = throw_builtin(inst, func, JIT_RESULT_OVERFLOW); x86_patch(patch1, inst); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_NFLOAT_TO_FLOAT32: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 106 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(void *)); x86_fst_membase(inst, X86_ESP, 0, 0, 1); x86_fld_membase(inst, X86_ESP, 0, 0); x86_alu_reg_imm(inst, X86_ADD, X86_ESP, sizeof(void *)); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_NFLOAT_TO_FLOAT64: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 114 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(jit_float64)); x86_fst_membase(inst, X86_ESP, 0, 1, 1); x86_fld_membase(inst, X86_ESP, 0, 1); x86_alu_reg_imm(inst, X86_ADD, X86_ESP, sizeof(jit_float64)); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FLOAT32_TO_NFLOAT: case JIT_OP_FLOAT64_TO_NFLOAT: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 122 "./jit-rules-x86.sel" { /* Nothing to do: loading the value onto the FP stack is sufficient */ } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IADD: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 131 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, imm_value); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 134 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 137 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_ISUB: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 142 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_SUB, _jit_reg_info[reg].cpu_reg, imm_value); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 145 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_SUB, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 148 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_SUB, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IMUL: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 153 "./jit-rules-x86.sel" { /* Handle special cases of immediate multiplies */ switch(imm_value) { case 0: { x86_clear_reg(inst, _jit_reg_info[reg].cpu_reg); } break; case 1: break; case -1: { x86_neg_reg(inst, _jit_reg_info[reg].cpu_reg); } break; case 2: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 1); } break; case 3: { /* lea reg, [reg + reg * 2] */ x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 1); } break; case 4: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 2); } break; case 5: { /* lea reg, [reg + reg * 4] */ x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 2); } break; case 6: { /* lea reg, [reg + reg * 2]; add reg, reg */ x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 1); x86_alu_reg_reg(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); } break; case 8: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 3); } break; case 9: { /* lea reg, [reg + reg * 8] */ x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 3); } break; case 10: { /* lea reg, [reg + reg * 4]; add reg, reg */ x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 2); x86_alu_reg_reg(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); } break; case 12: { /* lea reg, [reg + reg * 2]; shl reg, 2 */ x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 1); x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 2); } break; case 16: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 4); } break; case 25: { /* lea reg, [reg + reg * 4]; lea reg, [reg + reg * 4] */ x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 2); x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 2); } break; case 32: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 5); } break; case 64: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 6); } break; case 100: { /* lea reg, [reg + reg * 4]; shl reg, 2; lea reg, [reg + reg * 4] */ x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 2); x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 2); x86_lea_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg].cpu_reg, 2); } break; case 128: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 7); } break; case 256: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 8); } break; case 512: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 9); } break; case 1024: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 10); } break; case 2048: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 11); } break; case 4096: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 12); } break; case 8192: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 13); } break; case 16384: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 14); } break; case 32768: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 15); } break; case 65536: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 16); } break; case 0x00020000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 17); } break; case 0x00040000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 18); } break; case 0x00080000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 19); } break; case 0x00100000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 20); } break; case 0x00200000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 21); } break; case 0x00400000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 22); } break; case 0x00800000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 23); } break; case 0x01000000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 24); } break; case 0x02000000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 25); } break; case 0x04000000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 26); } break; case 0x08000000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 27); } break; case 0x10000000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 28); } break; case 0x20000000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 29); } break; case 0x40000000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 30); } break; case (jit_nint)0x80000000: { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, 31); } break; default: { x86_imul_reg_reg_imm(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, imm_value); } break; } } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 427 "./jit-rules-x86.sel" { x86_imul_reg_membase(inst, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 430 "./jit-rules-x86.sel" { x86_imul_reg_reg(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IDIV: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; _jit_regs_spill_all(gen); reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 437 "./jit-rules-x86.sel" { switch(imm_value) { case 0: { inst = throw_builtin(inst, func, JIT_RESULT_DIVISION_BY_ZERO); } break; case 1: break; case -1: { /* Dividing by -1 gives an exception if the argument is minint, or simply negates for other values */ unsigned char *patch = inst; x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, jit_min_int); x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_ARITHMETIC); x86_patch(patch, inst); x86_neg_reg(inst, _jit_reg_info[reg].cpu_reg); } break; case 2: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 1); } break; case 4: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 2); } break; case 8: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 3); } break; case 16: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 4); } break; case 32: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 5); } break; case 64: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 6); } break; case 128: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 7); } break; case 256: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 8); } break; case 512: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 9); } break; case 1024: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 10); } break; case 2048: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 11); } break; case 4096: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 12); } break; case 8192: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 13); } break; case 16384: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 14); } break; case 32768: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 15); } break; case 65536: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 16); } break; case 0x00020000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 17); } break; case 0x00040000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 18); } break; case 0x00080000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 19); } break; case 0x00100000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 20); } break; case 0x00200000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 21); } break; case 0x00400000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 22); } break; case 0x00800000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 23); } break; case 0x01000000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 24); } break; case 0x02000000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 25); } break; case 0x04000000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 26); } break; case 0x08000000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 27); } break; case 0x10000000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 28); } break; case 0x20000000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 29); } break; case 0x40000000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 30); } break; case (jit_nint)0x80000000: { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, 31); } break; default: { x86_mov_reg_imm(inst, X86_ECX, imm_value); x86_cdq(inst); x86_div_reg(inst, X86_ECX, 1); } break; } } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 656 "./jit-rules-x86.sel" { unsigned char *patch, *patch2; x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg2].cpu_reg, _jit_reg_info[reg2].cpu_reg); patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_DIVISION_BY_ZERO); x86_patch(patch, inst); x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg2].cpu_reg, -1); patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, jit_min_int); patch2 = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_ARITHMETIC); x86_patch(patch, inst); x86_patch(patch2, inst); x86_cdq(inst); x86_div_reg(inst, _jit_reg_info[reg2].cpu_reg, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IDIV_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; _jit_regs_spill_all(gen); reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 677 "./jit-rules-x86.sel" { switch(imm_value) { case 0: { inst = throw_builtin(inst, func, JIT_RESULT_DIVISION_BY_ZERO); } break; case 1: break; case 2: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 1); } break; case 4: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 2); } break; case 8: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 3); } break; case 16: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 4); } break; case 32: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 5); } break; case 64: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 6); } break; case 128: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 7); } break; case 256: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 8); } break; case 512: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 9); } break; case 1024: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 10); } break; case 2048: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 11); } break; case 4096: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 12); } break; case 8192: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 13); } break; case 16384: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 14); } break; case 32768: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 15); } break; case 65536: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 16); } break; case 0x00020000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 17); } break; case 0x00040000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 18); } break; case 0x00080000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 19); } break; case 0x00100000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 20); } break; case 0x00200000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 21); } break; case 0x00400000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 22); } break; case 0x00800000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 23); } break; case 0x01000000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 24); } break; case 0x02000000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 25); } break; case 0x04000000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 26); } break; case 0x08000000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 27); } break; case 0x10000000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 28); } break; case 0x20000000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 29); } break; case 0x40000000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 30); } break; case (jit_nint)0x80000000: { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, 31); } break; default: { x86_mov_reg_imm(inst, X86_ECX, imm_value); x86_clear_reg(inst, X86_EDX); x86_div_reg(inst, X86_ECX, 0); } break; } } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 883 "./jit-rules-x86.sel" { unsigned char *patch; x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg2].cpu_reg, _jit_reg_info[reg2].cpu_reg); patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_DIVISION_BY_ZERO); x86_patch(patch, inst); x86_clear_reg(inst, X86_EDX); x86_div_reg(inst, _jit_reg_info[reg2].cpu_reg, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IREM: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; _jit_regs_spill_all(gen); reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 895 "./jit-rules-x86.sel" { switch(imm_value) { case 0: { inst = throw_builtin(inst, func, JIT_RESULT_DIVISION_BY_ZERO); } break; case 1: { x86_clear_reg(inst, _jit_reg_info[reg].cpu_reg); } break; case -1: { /* Dividing by -1 gives an exception if the argument is minint, or simply gives a remainder of zero */ unsigned char *patch = inst; x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, jit_min_int); x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_ARITHMETIC); x86_patch(patch, inst); x86_clear_reg(inst, _jit_reg_info[reg].cpu_reg); } break; default: { x86_mov_reg_imm(inst, X86_ECX, imm_value); x86_cdq(inst); x86_div_reg(inst, X86_ECX, 1); /* TODO: rearrange register assignments to avoid the move */ x86_mov_reg_reg(inst, X86_EAX, X86_EDX, 4); } break; } } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 934 "./jit-rules-x86.sel" { unsigned char *patch, *patch2; x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg2].cpu_reg, _jit_reg_info[reg2].cpu_reg); patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_DIVISION_BY_ZERO); x86_patch(patch, inst); x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg2].cpu_reg, -1); patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, jit_min_int); patch2 = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_ARITHMETIC); x86_patch(patch, inst); x86_patch(patch2, inst); x86_cdq(inst); x86_div_reg(inst, _jit_reg_info[reg2].cpu_reg, 1); x86_mov_reg_reg(inst, X86_EAX, X86_EDX, 4); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IREM_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; _jit_regs_spill_all(gen); reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 956 "./jit-rules-x86.sel" { switch(imm_value) { case 0: { inst = throw_builtin(inst, func, JIT_RESULT_DIVISION_BY_ZERO); } break; case 1: { x86_clear_reg(inst, _jit_reg_info[reg].cpu_reg); } break; case 2: case 4: case 8: case 16: case 32: case 64: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 0x00020000: case 0x00040000: case 0x00080000: case 0x00100000: case 0x00200000: case 0x00400000: case 0x00800000: case 0x01000000: case 0x02000000: case 0x04000000: case 0x08000000: case 0x10000000: case 0x20000000: case 0x40000000: case (jit_nint)0x80000000: { x86_alu_reg_imm(inst, X86_AND, _jit_reg_info[reg].cpu_reg, imm_value - 1); } break; default: { x86_mov_reg_imm(inst, X86_ECX, imm_value); x86_clear_reg(inst, X86_EDX); x86_div_reg(inst, X86_ECX, 0); x86_mov_reg_reg(inst, X86_EAX, X86_EDX, 4); } break; } } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1017 "./jit-rules-x86.sel" { unsigned char *patch; x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg2].cpu_reg, _jit_reg_info[reg2].cpu_reg); patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_DIVISION_BY_ZERO); x86_patch(patch, inst); x86_clear_reg(inst, X86_EDX); x86_div_reg(inst, _jit_reg_info[reg2].cpu_reg, 0); x86_mov_reg_reg(inst, X86_EAX, X86_EDX, 4); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_INEG: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1030 "./jit-rules-x86.sel" { x86_neg_reg(inst, _jit_reg_info[reg].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LADD: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1035 "./jit-rules-x86.sel" { jit_int value1 = ((jit_int *)(imm_value))[0]; jit_int value2 = ((jit_int *)(imm_value))[1]; if(value1 != 0) { x86_alu_reg_imm(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, value1); x86_alu_reg_imm(inst, X86_ADC, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, value2); } else { x86_alu_reg_imm(inst, X86_ADD, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, value2); } } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1048 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); x86_alu_reg_membase(inst, X86_ADC, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, X86_EBP, local_offset + 4); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1052 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); x86_alu_reg_reg(inst, X86_ADC, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, _jit_reg_info[_jit_reg_info[reg2].other_reg].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LSUB: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1058 "./jit-rules-x86.sel" { jit_int value1 = ((jit_int *)(imm_value))[0]; jit_int value2 = ((jit_int *)(imm_value))[1]; if(value1 != 0) { x86_alu_reg_imm(inst, X86_SUB, _jit_reg_info[reg].cpu_reg, value1); x86_alu_reg_imm(inst, X86_SBB, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, value2); } else { x86_alu_reg_imm(inst, X86_SUB, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, value2); } } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1071 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_SUB, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); x86_alu_reg_membase(inst, X86_SBB, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, X86_EBP, local_offset + 4); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1075 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_SUB, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); x86_alu_reg_reg(inst, X86_SBB, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, _jit_reg_info[_jit_reg_info[reg2].other_reg].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LNEG: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1081 "./jit-rules-x86.sel" { x86_not_reg(inst, _jit_reg_info[reg].cpu_reg); x86_not_reg(inst, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg); x86_alu_reg_imm(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, 1); x86_alu_reg_imm(inst, X86_ADC, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FADD: case JIT_OP_DADD: case JIT_OP_NFADD: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top_two (gen, insn->value1, insn->value2, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1089 "./jit-rules-x86.sel" { x86_fp_op_reg(inst, X86_FADD, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FSUB: case JIT_OP_DSUB: case JIT_OP_NFSUB: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top_two (gen, insn->value1, insn->value2, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1094 "./jit-rules-x86.sel" { x86_fp_op_reg(inst, X86_FSUB, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FMUL: case JIT_OP_DMUL: case JIT_OP_NFMUL: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top_two (gen, insn->value1, insn->value2, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1099 "./jit-rules-x86.sel" { x86_fp_op_reg(inst, X86_FMUL, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FDIV: case JIT_OP_DDIV: case JIT_OP_NFDIV: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top_two (gen, insn->value1, insn->value2, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1104 "./jit-rules-x86.sel" { x86_fp_op_reg(inst, X86_FDIV, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FREM: case JIT_OP_DREM: case JIT_OP_NFREM: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top_two (gen, insn->value1, insn->value2, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1109 "./jit-rules-x86.sel" { unsigned char *label; int save_eax = 0; if(gen->contents[X86_REG_EAX].num_values > 0 || gen->contents[X86_REG_EAX].used_for_temp) { save_eax = 1; x86_push_reg(inst, X86_EAX); } x86_fxch(inst, 1); label = inst; x86_fprem(inst); x86_fnstsw(inst); x86_alu_reg_imm(inst, X86_AND, X86_EAX, 0x0400); x86_branch(inst, X86_CC_NZ, label, 0); x86_fstp(inst, 1); if(save_eax) { x86_pop_reg(inst, X86_EAX); } } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FNEG: case JIT_OP_DNEG: case JIT_OP_NFNEG: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1132 "./jit-rules-x86.sel" { x86_fchs(inst); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IAND: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1141 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_AND, _jit_reg_info[reg].cpu_reg, imm_value); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1144 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_AND, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1147 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_AND, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IOR: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1152 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_OR, _jit_reg_info[reg].cpu_reg, imm_value); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1155 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_OR, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1158 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IXOR: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1163 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_XOR, _jit_reg_info[reg].cpu_reg, imm_value); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1166 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_XOR, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1169 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_XOR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_INOT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1174 "./jit-rules-x86.sel" { x86_not_reg(inst, _jit_reg_info[reg].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_ISHL: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1179 "./jit-rules-x86.sel" { x86_shift_reg_imm(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, (imm_value & 0x1F)); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1182 "./jit-rules-x86.sel" { inst = shift_reg(inst, X86_SHL, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_ISHR: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1187 "./jit-rules-x86.sel" { x86_shift_reg_imm(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, (imm_value & 0x1F)); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1190 "./jit-rules-x86.sel" { inst = shift_reg(inst, X86_SAR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_ISHR_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1195 "./jit-rules-x86.sel" { x86_shift_reg_imm(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, (imm_value & 0x1F)); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1198 "./jit-rules-x86.sel" { inst = shift_reg(inst, X86_SHR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LAND: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1203 "./jit-rules-x86.sel" { jit_int value1 = ((jit_int *)(imm_value))[0]; jit_int value2 = ((jit_int *)(imm_value))[1]; x86_alu_reg_imm(inst, X86_AND, _jit_reg_info[reg].cpu_reg, value1); x86_alu_reg_imm(inst, X86_AND, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, value2); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1209 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_AND, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); x86_alu_reg_membase(inst, X86_AND, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, X86_EBP, local_offset + 4); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1213 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_AND, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); x86_alu_reg_reg(inst, X86_AND, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, _jit_reg_info[_jit_reg_info[reg2].other_reg].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOR: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1219 "./jit-rules-x86.sel" { jit_int value1 = ((jit_int *)(imm_value))[0]; jit_int value2 = ((jit_int *)(imm_value))[1]; x86_alu_reg_imm(inst, X86_OR, _jit_reg_info[reg].cpu_reg, value1); x86_alu_reg_imm(inst, X86_OR, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, value2); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1225 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_OR, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); x86_alu_reg_membase(inst, X86_OR, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, X86_EBP, local_offset + 4); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1229 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, _jit_reg_info[_jit_reg_info[reg2].other_reg].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LXOR: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1235 "./jit-rules-x86.sel" { jit_int value1 = ((jit_int *)(imm_value))[0]; jit_int value2 = ((jit_int *)(imm_value))[1]; x86_alu_reg_imm(inst, X86_XOR, _jit_reg_info[reg].cpu_reg, value1); x86_alu_reg_imm(inst, X86_XOR, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, value2); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1241 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_XOR, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); x86_alu_reg_membase(inst, X86_XOR, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, X86_EBP, local_offset + 4); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1245 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_XOR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); x86_alu_reg_reg(inst, X86_XOR, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, _jit_reg_info[_jit_reg_info[reg2].other_reg].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LNOT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1251 "./jit-rules-x86.sel" { x86_not_reg(inst, _jit_reg_info[reg].cpu_reg); x86_not_reg(inst, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_BR: { unsigned char * inst; _jit_regs_spill_all(gen); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1261 "./jit-rules-x86.sel" { inst = output_branch(func, inst, 0xEB /* jmp */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_IFALSE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1266 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); inst = output_branch(func, inst, 0x74 /* eq */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_ITRUE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1272 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); inst = output_branch(func, inst, 0x75 /* ne */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_IEQ: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_nint_constant && insn->value2->address == 0) { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1278 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); inst = output_branch(func, inst, 0x74 /* eq */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1282 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x74 /* eq */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1286 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x74 /* eq */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1290 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x74 /* eq */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_INE: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_nint_constant && insn->value2->address == 0) { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1296 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); inst = output_branch(func, inst, 0x75 /* ne */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1300 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x75 /* ne */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1304 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x75 /* ne */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1308 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x75 /* ne */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_ILT: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1314 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x7C /* lt */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1318 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x7C /* lt */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1322 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x7C /* lt */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_ILT_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1328 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x72 /* lt_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1332 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x72 /* lt_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1336 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x72 /* lt_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_ILE: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1342 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x7E /* le */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1346 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x7E /* le */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1350 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x7E /* le */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_ILE_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1356 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x76 /* le_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1360 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x76 /* le_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1364 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x76 /* le_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_IGT: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1370 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x7F /* gt */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1374 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x7F /* gt */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1378 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x7F /* gt */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_IGT_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1384 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x77 /* gt_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1388 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x77 /* gt_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1392 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x77 /* gt_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_IGE: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1398 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x7D /* ge */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1402 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x7D /* ge */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1406 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x7D /* ge */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_BR_IGE_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1412 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = output_branch(func, inst, 0x73 /* ge_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1416 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = output_branch(func, inst, 0x73 /* ge_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1420 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = output_branch(func, inst, 0x73 /* ge_un */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_IEQ: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_nint_constant && insn->value2->address == 0) { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1430 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_EQ, 0); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1434 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_EQ, 0); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1438 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_EQ, 0); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1442 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_EQ, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_INE: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_nint_constant && insn->value2->address == 0) { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1448 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_NE, 0); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1452 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_NE, 0); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1456 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_NE, 0); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1460 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_NE, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_ILT: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1466 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LT, 1); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1470 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LT, 1); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1474 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LT, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_ILT_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1480 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LT, 0); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1484 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LT, 0); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1488 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LT, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_ILE: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1494 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LE, 1); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1498 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LE, 1); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1502 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LE, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_ILE_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1508 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LE, 0); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1512 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LE, 0); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1516 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_LE, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IGT: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1522 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GT, 1); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1526 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GT, 1); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1530 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GT, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IGT_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1536 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GT, 0); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1540 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GT, 0); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1544 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GT, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IGE: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1550 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GE, 1); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1554 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GE, 1); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1558 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GE, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_IGE_UN: { unsigned char * inst; int reg; int reg2; jit_nint imm_value; jit_nint local_offset; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->is_constant) { imm_value = insn->value2->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1564 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, imm_value); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GE, 0); } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value2->in_frame && !(insn->value2->in_register)) { local_offset = insn->value2->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1568 "./jit-rules-x86.sel" { x86_alu_reg_membase(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, X86_EBP, local_offset); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GE, 0); } gen->posn.ptr = (unsigned char *)inst; } else { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1572 "./jit-rules-x86.sel" { x86_alu_reg_reg(inst, X86_CMP, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg2].cpu_reg); inst = setcc_reg(inst, _jit_reg_info[reg].cpu_reg, X86_CC_GE, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FATAN: case JIT_OP_DATAN: case JIT_OP_NFATAN: { unsigned char * inst; int reg; { if(!_jit_regs_is_top(gen, insn->value1) || _jit_regs_num_used(gen, 8) != 1) { _jit_regs_spill_all(gen); } reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1582 "./jit-rules-x86.sel" { x86_fld1(inst); x86_fpatan(inst); x86_fldz(inst); x86_fp_op_reg(inst, X86_FADD, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FCOS: case JIT_OP_DCOS: case JIT_OP_NFCOS: { unsigned char * inst; int reg; { if(!_jit_regs_is_top(gen, insn->value1) || _jit_regs_num_used(gen, 8) != 1) { _jit_regs_spill_all(gen); } reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1590 "./jit-rules-x86.sel" { x86_fcos(inst); x86_fldz(inst); x86_fp_op_reg(inst, X86_FADD, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FSIN: case JIT_OP_DSIN: case JIT_OP_NFSIN: { unsigned char * inst; int reg; { if(!_jit_regs_is_top(gen, insn->value1) || _jit_regs_num_used(gen, 8) != 1) { _jit_regs_spill_all(gen); } reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1597 "./jit-rules-x86.sel" { x86_fsin(inst); x86_fldz(inst); x86_fp_op_reg(inst, X86_FADD, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FSQRT: case JIT_OP_DSQRT: case JIT_OP_NFSQRT: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1604 "./jit-rules-x86.sel" { x86_fsqrt(inst); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_FABS: case JIT_OP_DABS: case JIT_OP_NFABS: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1609 "./jit-rules-x86.sel" { x86_fabs(inst); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_CHECK_NULL: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1618 "./jit-rules-x86.sel" { unsigned char *patch; x86_alu_reg_reg(inst, X86_OR, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg); patch = inst; x86_branch8(inst, X86_CC_NE, 0, 0); inst = throw_builtin(inst, func, JIT_RESULT_NULL_REFERENCE); x86_patch(patch, inst); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1632 "./jit-rules-x86.sel" { jit_function_t func = (jit_function_t)(insn->dest); x86_call_code(inst, func->closure_entry); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL_TAIL: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1638 "./jit-rules-x86.sel" { jit_function_t func = (jit_function_t)(insn->dest); x86_mov_reg_reg(inst, X86_ESP, X86_EBP, sizeof(void *)); x86_pop_reg(inst, X86_EBP); x86_jump_code(inst, func->closure_entry); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL_INDIRECT: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1646 "./jit-rules-x86.sel" { x86_call_reg(inst, X86_EAX); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL_INDIRECT_TAIL: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1651 "./jit-rules-x86.sel" { x86_mov_reg_reg(inst, X86_ESP, X86_EBP, sizeof(void *)); x86_pop_reg(inst, X86_EBP); x86_jump_reg(inst, X86_EAX); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL_VTABLE_PTR: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1658 "./jit-rules-x86.sel" { x86_call_reg(inst, X86_EAX); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL_VTABLE_PTR_TAIL: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1663 "./jit-rules-x86.sel" { x86_mov_reg_reg(inst, X86_ESP, X86_EBP, sizeof(void *)); x86_pop_reg(inst, X86_EBP); x86_jump_reg(inst, X86_EAX); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL_EXTERNAL: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1670 "./jit-rules-x86.sel" { x86_call_code(inst, (void *)(insn->dest)); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL_EXTERNAL_TAIL: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1675 "./jit-rules-x86.sel" { x86_mov_reg_reg(inst, X86_ESP, X86_EBP, sizeof(void *)); x86_pop_reg(inst, X86_EBP); x86_jump_code(inst, (void *)(insn->dest)); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_RETURN: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1682 "./jit-rules-x86.sel" { inst = jump_to_epilog(gen, inst, block); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_RETURN_INT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1687 "./jit-rules-x86.sel" { int cpu_reg = _jit_reg_info[reg].cpu_reg; if(cpu_reg != X86_EAX) { x86_mov_reg_reg(inst, X86_EAX, cpu_reg, 4); } inst = jump_to_epilog(gen, inst, block); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_RETURN_LONG: { unsigned char * inst; int reg; jit_nint imm_value; if(insn->value1->is_constant) { imm_value = insn->value1->address; _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1697 "./jit-rules-x86.sel" { x86_mov_reg_imm(inst, X86_EAX, ((jit_int *)(insn->value1->address))[0]); x86_mov_reg_imm(inst, X86_EDX, ((jit_int *)(insn->value1->address))[1]); inst = jump_to_epilog(gen, inst, block); } gen->posn.ptr = (unsigned char *)inst; } else { reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1704 "./jit-rules-x86.sel" { if(_jit_reg_info[reg].cpu_reg != X86_EAX) { x86_mov_reg_reg(inst, X86_EAX, _jit_reg_info[reg].cpu_reg, 4); x86_mov_reg_reg(inst, X86_EDX, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg, 4); } inst = jump_to_epilog(gen, inst, block); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_RETURN_FLOAT32: { unsigned char * inst; int reg; { if(!_jit_regs_is_top(gen, insn->value1) || _jit_regs_num_used(gen, 8) != 1) { _jit_regs_spill_all(gen); } reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1714 "./jit-rules-x86.sel" { _jit_regs_free_reg(gen, reg, 1); inst = jump_to_epilog(gen, inst, block); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_RETURN_FLOAT64: { unsigned char * inst; int reg; { if(!_jit_regs_is_top(gen, insn->value1) || _jit_regs_num_used(gen, 8) != 1) { _jit_regs_spill_all(gen); } reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1720 "./jit-rules-x86.sel" { _jit_regs_free_reg(gen, reg, 1); inst = jump_to_epilog(gen, inst, block); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_RETURN_NFLOAT: { unsigned char * inst; int reg; { if(!_jit_regs_is_top(gen, insn->value1) || _jit_regs_num_used(gen, 8) != 1) { _jit_regs_spill_all(gen); } reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1726 "./jit-rules-x86.sel" { _jit_regs_free_reg(gen, reg, 1); inst = jump_to_epilog(gen, inst, block); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_RETURN_SMALL_STRUCT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1732 "./jit-rules-x86.sel" { inst = load_small_struct (inst, X86_EAX, X86_EDX, _jit_reg_info[reg].cpu_reg, 0, jit_value_get_nint_constant(insn->value2), 0); inst = jump_to_epilog(gen, inst, block); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_SETUP_FOR_NESTED: { unsigned char * inst; _jit_regs_spill_all(gen); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1740 "./jit-rules-x86.sel" { jit_nint nest_reg = jit_value_get_nint_constant(insn->value1); if(nest_reg == -1) { x86_push_reg(inst, X86_EBP); } else { x86_mov_reg_reg(inst, _jit_reg_info[nest_reg].cpu_reg, X86_EBP, sizeof(void *)); } } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_SETUP_FOR_SIBLING: { unsigned char * inst; _jit_regs_spill_all(gen); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1754 "./jit-rules-x86.sel" { jit_value_t parent; jit_nint level = jit_value_get_nint_constant(insn->value1); jit_nint nest_reg = jit_value_get_nint_constant(insn->value2); int cpu_reg; if(nest_reg == -1) { cpu_reg = X86_EAX; } else { cpu_reg = _jit_reg_info[nest_reg].cpu_reg; } parent = func->builder->parent_frame; if(parent->in_register) { x86_mov_reg_reg(inst, cpu_reg, _jit_reg_info[parent->reg].cpu_reg, sizeof(void *)); } else if(parent->in_global_register) { x86_mov_reg_reg(inst, cpu_reg, _jit_reg_info[parent->global_reg].cpu_reg, sizeof(void *)); } else { _jit_gen_fix_value(parent); x86_mov_reg_membase(inst, cpu_reg, X86_EBP, parent->frame_offset, sizeof(void *)); } while(level > 0) { gen->posn.ptr = inst; if(!jit_cache_check_for_n(&(gen->posn), 16)) { jit_cache_mark_full(&(gen->posn)); return; } x86_mov_reg_membase(inst, cpu_reg, cpu_reg, 0, sizeof(void *)); --level; } if(nest_reg == -1) { x86_push_reg(inst, cpu_reg); } } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_IMPORT: { #line 1804 "./jit-rules-x86.sel" { unsigned char *inst; int reg; jit_nint level = jit_value_get_nint_constant(insn->value2); _jit_gen_fix_value(insn->value1); reg = _jit_regs_load_value (gen, func->builder->parent_frame, 1, 0); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32 + level * 8)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; while(level > 0) { x86_mov_reg_membase(inst, reg, reg, 0, sizeof(void *)); --level; } if(insn->value1->frame_offset != 0) { x86_alu_reg_imm(inst, X86_ADD, reg, insn->value1->frame_offset); } gen->posn.ptr = inst; } } break; case JIT_OP_THROW: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1835 "./jit-rules-x86.sel" { x86_push_reg(inst, _jit_reg_info[reg].cpu_reg); if(func->builder->setjmp_value != 0) { /* We have a "setjmp" block in the current function, so we must record the location of the throw first */ _jit_gen_fix_value(func->builder->setjmp_value); x86_call_imm(inst, 0); x86_pop_membase(inst, X86_EBP, func->builder->setjmp_value->frame_offset + jit_jmp_catch_pc_offset); } x86_call_code(inst, (void *)jit_exception_throw); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_RETHROW: { #line 1851 "./jit-rules-x86.sel" { /* Not used in native code back ends */ } } break; case JIT_OP_LOAD_PC: { #line 1854 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_dest_value(gen, insn->dest); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_call_imm(inst, 0); x86_pop_reg(inst, _jit_reg_info[reg].cpu_reg); gen->posn.ptr = inst; } } break; case JIT_OP_LOAD_EXCEPTION_PC: { #line 1869 "./jit-rules-x86.sel" { /* Not used in native code back ends */ } } break; case JIT_OP_ENTER_FINALLY: { #line 1872 "./jit-rules-x86.sel" { /* Nothing to do here: return address on the stack */ } } break; case JIT_OP_LEAVE_FINALLY: { unsigned char * inst; _jit_regs_spill_all(gen); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1875 "./jit-rules-x86.sel" { /* The "finally" return address is on the stack */ x86_ret(inst); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_CALL_FINALLY: { unsigned char * inst; _jit_regs_spill_all(gen); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1881 "./jit-rules-x86.sel" { inst = output_branch(func, inst, 0xE8 /* call */, insn); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_ENTER_FILTER: { #line 1886 "./jit-rules-x86.sel" { /* TODO */ TODO(); } } break; case JIT_OP_LEAVE_FILTER: { #line 1892 "./jit-rules-x86.sel" { /* TODO */ TODO(); } } break; case JIT_OP_CALL_FILTER: { #line 1898 "./jit-rules-x86.sel" { /* TODO */ TODO(); } } break; case JIT_OP_CALL_FILTER_RETURN: { #line 1904 "./jit-rules-x86.sel" { /* TODO */ TODO(); } } break; case JIT_OP_ADDRESS_OF_LABEL: { #line 1910 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_dest_value(gen, insn->dest); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; inst = output_branch(func, inst, 0xB8 + reg /* mov reg, imm */, insn); x86_call_imm(inst, 0); x86_alu_reg_membase(inst, X86_ADD, reg, X86_ESP, 0); x86_alu_reg_imm(inst, X86_ADD, X86_ESP, sizeof(void *)); x86_alu_reg_imm(inst, X86_SUB, reg, 5); gen->posn.ptr = inst; } } break; case JIT_OP_COPY_LOAD_SBYTE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1933 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_LOAD_UBYTE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1936 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_LOAD_SHORT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1939 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_LOAD_USHORT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1942 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_INT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1945 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_LONG: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1948 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_FLOAT32: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1951 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_FLOAT64: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1954 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_NFLOAT: { unsigned char * inst; int reg; { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 1957 "./jit-rules-x86.sel" {} gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_COPY_STRUCT: { _jit_regs_spill_all(gen); #line 1960 "./jit-rules-x86.sel" { unsigned char *inst; _jit_gen_fix_value(insn->dest); _jit_gen_fix_value(insn->value1); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } inst = memory_copy(gen, inst, X86_EBP, insn->dest->frame_offset, X86_EBP, insn->value1->frame_offset, jit_type_get_size(jit_value_get_type(insn->dest))); gen->posn.ptr = inst; } } break; case JIT_OP_COPY_STORE_BYTE: { #line 1977 "./jit-rules-x86.sel" { unsigned char *inst; int reg; _jit_regs_force_out(gen, insn->dest, 1); _jit_gen_fix_value(insn->dest); if(!(insn->value1->is_constant)) { reg = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } inst = mov_membase_reg_byte (inst, X86_EBP, insn->dest->frame_offset, _jit_reg_info[reg].cpu_reg); gen->posn.ptr = inst; } else { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_mov_membase_imm(inst, X86_EBP, insn->dest->frame_offset, insn->value1->address, 1); gen->posn.ptr = inst; } } } break; case JIT_OP_COPY_STORE_SHORT: { #line 2014 "./jit-rules-x86.sel" { unsigned char *inst; int reg; _jit_regs_force_out(gen, insn->dest, 1); _jit_gen_fix_value(insn->dest); if(!(insn->value1->is_constant)) { reg = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_mov_membase_reg(inst, X86_EBP, insn->dest->frame_offset, _jit_reg_info[reg].cpu_reg, 2); gen->posn.ptr = inst; } else { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_mov_membase_imm(inst, X86_EBP, insn->dest->frame_offset, insn->value1->address, 2); gen->posn.ptr = inst; } } } break; case JIT_OP_ADDRESS_OF: { #line 2050 "./jit-rules-x86.sel" { unsigned char *inst; int reg; _jit_regs_force_out(gen, insn->value1, 0); _jit_gen_fix_value(insn->value1); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_regs_dest_value(gen, insn->dest); reg = _jit_reg_info[reg].cpu_reg; x86_lea_membase(inst, reg, X86_EBP, insn->value1->frame_offset); gen->posn.ptr = inst; } } break; case JIT_OP_RETURN_REG: { #line 2072 "./jit-rules-x86.sel" { /* Nothing to do here */ } } break; case JIT_OP_PUSH_INT: { unsigned char * inst; int reg; jit_nint imm_value; jit_nint local_offset; if(insn->value1->is_constant) { imm_value = insn->value1->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2075 "./jit-rules-x86.sel" { x86_push_imm(inst, imm_value); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value1->in_frame && !(insn->value1->in_register)) { local_offset = insn->value1->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2079 "./jit-rules-x86.sel" { x86_push_membase(inst, X86_EBP, local_offset); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else { reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2083 "./jit-rules-x86.sel" { x86_push_reg(inst, _jit_reg_info[reg].cpu_reg); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_PUSH_LONG: { unsigned char * inst; int reg; jit_nint imm_value; jit_nint local_offset; if(insn->value1->is_constant) { imm_value = insn->value1->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2089 "./jit-rules-x86.sel" { x86_push_imm(inst, ((jit_int *)(imm_value))[1]); x86_push_imm(inst, ((jit_int *)(imm_value))[0]); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value1->in_frame && !(insn->value1->in_register)) { local_offset = insn->value1->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2094 "./jit-rules-x86.sel" { x86_push_membase(inst, X86_EBP, local_offset + 4); x86_push_membase(inst, X86_EBP, local_offset); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else { reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2099 "./jit-rules-x86.sel" { x86_push_reg(inst, _jit_reg_info[_jit_reg_info[reg].other_reg].cpu_reg); x86_push_reg(inst, _jit_reg_info[reg].cpu_reg); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_PUSH_FLOAT32: { unsigned char * inst; int reg; jit_nint imm_value; jit_nint local_offset; if(insn->value1->is_constant) { imm_value = insn->value1->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2106 "./jit-rules-x86.sel" { jit_int *ptr = (jit_int *)(imm_value); x86_push_imm(inst, ptr[0]); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value1->in_frame && !(insn->value1->in_register)) { local_offset = insn->value1->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2111 "./jit-rules-x86.sel" { x86_push_membase(inst, X86_EBP, local_offset); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2115 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(jit_float32)); x86_fst_membase(inst, X86_ESP, 0, 0, 1); _jit_regs_free_reg(gen, reg, 1); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_PUSH_FLOAT64: { unsigned char * inst; int reg; jit_nint imm_value; jit_nint local_offset; if(insn->value1->is_constant) { imm_value = insn->value1->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2123 "./jit-rules-x86.sel" { jit_int *ptr = (jit_int *)(imm_value); x86_push_imm(inst, ptr[1]); x86_push_imm(inst, ptr[0]); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value1->in_frame && !(insn->value1->in_register)) { local_offset = insn->value1->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2129 "./jit-rules-x86.sel" { x86_push_membase(inst, X86_EBP, local_offset + 4); x86_push_membase(inst, X86_EBP, local_offset); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2134 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(jit_float64)); x86_fst_membase(inst, X86_ESP, 0, 1, 1); _jit_regs_free_reg(gen, reg, 1); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_PUSH_NFLOAT: { unsigned char * inst; int reg; jit_nint imm_value; jit_nint local_offset; if(insn->value1->is_constant) { imm_value = insn->value1->address; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2142 "./jit-rules-x86.sel" { jit_int *ptr = (jit_int *)(imm_value); if(sizeof(jit_nfloat) != sizeof(jit_float64)) { x86_push_imm(inst, ptr[2]); } x86_push_imm(inst, ptr[1]); x86_push_imm(inst, ptr[0]); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else if(insn->value1->in_frame && !(insn->value1->in_register)) { local_offset = insn->value1->frame_offset; inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2152 "./jit-rules-x86.sel" { if(sizeof(jit_nfloat) != sizeof(jit_float64)) { x86_push_membase(inst, X86_EBP, local_offset + 8); } x86_push_membase(inst, X86_EBP, local_offset + 4); x86_push_membase(inst, X86_EBP, local_offset); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } else { reg = _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2161 "./jit-rules-x86.sel" { if(sizeof(jit_nfloat) != sizeof(jit_float64)) { x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(jit_nfloat)); x86_fst80_membase(inst, X86_ESP, 0); } else { x86_alu_reg_imm(inst, X86_SUB, X86_ESP, sizeof(jit_float64)); x86_fst_membase(inst, X86_ESP, 0, 1, 1); } _jit_regs_free_reg(gen, reg, 1); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_PUSH_STRUCT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2177 "./jit-rules-x86.sel" { jit_nuint size; size = (jit_nuint)jit_value_get_nint_constant(insn->value2); if((size % sizeof(void *)) == 0 && size <= 4 * sizeof(void *)) { /* Handle small structures that are a multiple of the word size */ while(size > 0) { size -= sizeof(void *); x86_push_membase(inst, _jit_reg_info[reg].cpu_reg, size); } } else { /* Handle arbitrary-sized structures */ x86_alu_reg_imm(inst, X86_SUB, X86_ESP, ROUND_STACK(size)); inst = memory_copy(gen, inst, X86_ESP, 0, _jit_reg_info[reg].cpu_reg, 0, size); } gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_POP_STACK: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2199 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_ADD, X86_ESP, insn->value1->address); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_FLUSH_SMALL_STRUCT: { unsigned char * inst; { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2205 "./jit-rules-x86.sel" { jit_nuint size; jit_nint offset; _jit_gen_fix_value(insn->value1); size = jit_type_get_size(jit_value_get_type(insn->value1)); offset = insn->value1->frame_offset; inst = store_small_struct (inst, X86_EAX, X86_EDX, X86_EBP, offset, (jit_nint)size, 0); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_LOAD_RELATIVE_SBYTE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2220 "./jit-rules-x86.sel" { x86_widen_membase(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, insn->value2->address, 1, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_RELATIVE_UBYTE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2225 "./jit-rules-x86.sel" { x86_widen_membase(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, insn->value2->address, 0, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_RELATIVE_SHORT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2230 "./jit-rules-x86.sel" { x86_widen_membase(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, insn->value2->address, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_RELATIVE_USHORT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2235 "./jit-rules-x86.sel" { x86_widen_membase(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, insn->value2->address, 0, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_RELATIVE_INT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2240 "./jit-rules-x86.sel" { x86_mov_reg_membase(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, insn->value2->address, 4); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_RELATIVE_LONG: { #line 2245 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); int reg2, reg3; int frame_offset; _jit_gen_fix_value(insn->dest); _jit_regs_get_reg_pair(gen, reg, -1, -1, ®2, ®3); reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; reg3 = _jit_reg_info[reg3].cpu_reg; frame_offset = insn->dest->frame_offset; inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_mov_reg_membase(inst, reg2, reg, insn->value2->address, 4); x86_mov_reg_membase(inst, reg3, reg, insn->value2->address + 4, 4); x86_mov_membase_reg(inst, X86_EBP, frame_offset, reg2, 4); x86_mov_membase_reg(inst, X86_EBP, frame_offset + 4, reg3, 4); insn->dest->in_frame = 1; gen->posn.ptr = inst; } } break; case JIT_OP_LOAD_RELATIVE_FLOAT32: { #line 2274 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); _jit_regs_new_top(gen, insn->dest, 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_fld_membase(inst, reg, insn->value2->address, 0); gen->posn.ptr = inst; } } break; case JIT_OP_LOAD_RELATIVE_FLOAT64: { #line 2293 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); _jit_regs_new_top(gen, insn->dest, 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_fld_membase(inst, reg, insn->value2->address, 1); gen->posn.ptr = inst; } } break; case JIT_OP_LOAD_RELATIVE_NFLOAT: { #line 2312 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); _jit_regs_new_top(gen, insn->dest, 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; if(sizeof(jit_nfloat) != sizeof(jit_float64)) { x86_fld80_membase(inst, reg, insn->value2->address); } else { x86_fld_membase(inst, reg, insn->value2->address, 1); } gen->posn.ptr = inst; } } break; case JIT_OP_LOAD_RELATIVE_STRUCT: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { _jit_regs_spill_all(gen); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2338 "./jit-rules-x86.sel" { _jit_gen_fix_value(insn->dest); inst = memory_copy(gen, inst, X86_EBP, insn->dest->frame_offset, _jit_reg_info[reg].cpu_reg, jit_value_get_nint_constant(insn->value2), jit_type_get_size(jit_value_get_type(insn->dest))); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_STORE_RELATIVE_BYTE: { #line 2346 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2; if(insn->dest->is_constant) { reg = insn->dest->address + insn->value2->address; if(insn->value1->is_constant) { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_mov_mem_imm(inst, reg, insn->value1->address, 1); } else { reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg2 = _jit_reg_info[reg2].cpu_reg; x86_mov_mem_reg(inst, reg, reg2, 1); } gen->posn.ptr = inst; } else { reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); if(!(insn->value1->is_constant)) { reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; inst = mov_membase_reg_byte (inst, reg, insn->value2->address, reg2); gen->posn.ptr = inst; } else { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_mov_membase_imm(inst, reg, insn->value2->address, insn->value1->address, 1); gen->posn.ptr = inst; } } } } break; case JIT_OP_STORE_RELATIVE_SHORT: { #line 2420 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2; if(insn->dest->is_constant) { reg = insn->dest->address + insn->value2->address; if(insn->value1->is_constant) { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_mov_mem_imm(inst, reg, insn->value1->address, 2); } else { reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg2 = _jit_reg_info[reg2].cpu_reg; x86_mov_mem_reg(inst, reg, reg2, 2); } gen->posn.ptr = inst; } else { reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); if(!(insn->value1->is_constant)) { reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; x86_mov_membase_reg(inst, reg, insn->value2->address, reg2, 2); gen->posn.ptr = inst; } else { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_mov_membase_imm(inst, reg, insn->value2->address, insn->value1->address, 2); gen->posn.ptr = inst; } } } } break; case JIT_OP_STORE_RELATIVE_INT: { #line 2493 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2; if(insn->dest->is_constant) { reg = insn->dest->address + insn->value2->address; if(insn->value1->is_constant) { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_mov_mem_imm(inst, reg, insn->value1->address, 4); } else { reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg2 = _jit_reg_info[reg2].cpu_reg; x86_mov_mem_reg(inst, reg, reg2, 4); } gen->posn.ptr = inst; } else { reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); if(!(insn->value1->is_constant)) { reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; x86_mov_membase_reg(inst, reg, insn->value2->address, reg2, 4); gen->posn.ptr = inst; } else { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_mov_membase_imm(inst, reg, insn->value2->address, insn->value1->address, 4); gen->posn.ptr = inst; } } } } break; case JIT_OP_STORE_RELATIVE_LONG: { #line 2566 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); int reg2, reg3; int frame_offset; if(!(insn->value1->is_constant)) { _jit_regs_get_reg_pair(gen, reg, -1, -1, ®2, ®3); _jit_gen_fix_value(insn->value1); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; reg3 = _jit_reg_info[reg3].cpu_reg; frame_offset = insn->value1->frame_offset; x86_mov_reg_membase(inst, reg2, X86_EBP, frame_offset, 4); x86_mov_reg_membase(inst, reg3, X86_EBP, frame_offset + 4, 4); x86_mov_membase_reg(inst, reg, insn->value2->address, reg2, 4); x86_mov_membase_reg(inst, reg, insn->value2->address + 4, reg3, 4); gen->posn.ptr = inst; } else { jit_long const_value = jit_value_get_long_constant(insn->value1); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_mov_membase_imm (inst, reg, insn->value2->address, (jit_int)(const_value & jit_max_uint), 4); x86_mov_membase_imm (inst, reg, insn->value2->address, (jit_int)((const_value >> 32) & jit_max_uint), 4); gen->posn.ptr = inst; } } } break; case JIT_OP_STORE_RELATIVE_FLOAT32: { #line 2615 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); if(!(insn->value1->is_constant)) { _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_fst_membase(inst, reg, insn->value2->address, 0, 1); gen->posn.ptr = inst; } else { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_mov_membase_imm(inst, reg, insn->value2->address, *((int *)(insn->value1->address)), 4); gen->posn.ptr = inst; } } } break; case JIT_OP_STORE_RELATIVE_FLOAT64: { #line 2653 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); if(!(insn->value1->is_constant)) { _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_fst_membase(inst, reg, insn->value2->address, 1, 1); gen->posn.ptr = inst; } else { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_mov_membase_imm(inst, reg, insn->value2->address, ((int *)(insn->value1->address))[0], 4); x86_mov_membase_imm(inst, reg, insn->value2->address + 4, ((int *)(insn->value1->address))[1], 4); gen->posn.ptr = inst; } } } break; case JIT_OP_STORE_RELATIVE_NFLOAT: { #line 2693 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); if(!(insn->value1->is_constant)) { _jit_regs_load_to_top (gen, insn->value1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)), 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; if(sizeof(jit_nfloat) != sizeof(jit_float64)) { x86_fst80_membase(inst, reg, insn->value2->address); } else { x86_fst_membase(inst, reg, insn->value2->address, 1, 1); } gen->posn.ptr = inst; } else { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; x86_mov_membase_imm(inst, reg, insn->value2->address, ((int *)(insn->value1->address))[0], 4); x86_mov_membase_imm(inst, reg, insn->value2->address + 4, ((int *)(insn->value1->address))[1], 4); if(sizeof(jit_nfloat) != sizeof(jit_float64)) { x86_mov_membase_imm(inst, reg, insn->value2->address + 8, ((int *)(insn->value1->address))[2], 4); } gen->posn.ptr = inst; } } } break; case JIT_OP_STORE_RELATIVE_STRUCT: { #line 2745 "./jit-rules-x86.sel" { unsigned char *inst; int reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); _jit_regs_spill_all(gen); _jit_gen_fix_value(insn->value1); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 128)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; inst = memory_copy(gen, inst, reg, (int)(insn->value2->address), X86_EBP, insn->value1->frame_offset, jit_type_get_size(jit_value_get_type(insn->value1))); gen->posn.ptr = inst; } } break; case JIT_OP_ADD_RELATIVE: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2767 "./jit-rules-x86.sel" { if(insn->value2->address != 0) { x86_alu_reg_imm(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, insn->value2->address); } } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_ELEMENT_SBYTE: { unsigned char * inst; int reg; int reg2; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2779 "./jit-rules-x86.sel" { x86_widen_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 0, 1, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_ELEMENT_UBYTE: { unsigned char * inst; int reg; int reg2; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2784 "./jit-rules-x86.sel" { x86_widen_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 0, 0, 0); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_ELEMENT_SHORT: { unsigned char * inst; int reg; int reg2; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2789 "./jit-rules-x86.sel" { x86_widen_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 1, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_ELEMENT_USHORT: { unsigned char * inst; int reg; int reg2; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2794 "./jit-rules-x86.sel" { x86_widen_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 1, 0, 1); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_ELEMENT_INT: { unsigned char * inst; int reg; int reg2; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2799 "./jit-rules-x86.sel" { x86_mov_reg_memindex(inst, _jit_reg_info[reg].cpu_reg, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 2, 4); } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_LOAD_ELEMENT_LONG: { #line 2804 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2, temp_reg, offset; _jit_regs_force_out(gen, insn->dest, 1); _jit_gen_fix_value(insn->dest); reg = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg2 = _jit_regs_load_value (gen, insn->value2, 1, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_get_reg_pair(gen, reg, reg2, -1, &temp_reg, 0); offset = insn->dest->frame_offset; inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; temp_reg = _jit_reg_info[temp_reg].cpu_reg; x86_mov_reg_memindex(inst, temp_reg, reg, 0, reg2, 3, 4); x86_mov_reg_memindex(inst, reg2, reg, 4, reg2, 3, 4); x86_mov_membase_reg(inst, X86_EBP, offset, temp_reg, 4); x86_mov_membase_reg(inst, X86_EBP, offset + 4, reg2, 4); gen->posn.ptr = inst; } } break; case JIT_OP_LOAD_ELEMENT_FLOAT32: { #line 2836 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); _jit_regs_new_top(gen, insn->dest, 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; x86_fld_memindex(inst, reg, 0, reg2, 2, 0); gen->posn.ptr = inst; } } break; case JIT_OP_LOAD_ELEMENT_FLOAT64: { #line 2862 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2, reg3; reg = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg2 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); reg3 = _jit_regs_new_top(gen, insn->dest, 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; x86_fld_memindex(inst, reg, 0, reg2, 3, 1); gen->posn.ptr = inst; } } break; case JIT_OP_LOAD_ELEMENT_NFLOAT: { #line 2888 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2, reg3; reg = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg2 = _jit_regs_load_value (gen, insn->value2, sizeof(jit_nfloat) != sizeof(jit_float64), (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); reg3 = _jit_regs_new_top(gen, insn->dest, 8); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; if(sizeof(jit_nfloat) != sizeof(jit_float64)) { /* lea reg2, [reg2 + reg2 * 2] */ x86_lea_memindex(inst, reg2, reg2, 0, reg2, 1); /* fld [reg2 * 4] */ x86_fld80_memindex(inst, reg, 0, reg2, 2); } else { x86_fld_memindex(inst, reg, 0, reg2, 3, 1); } gen->posn.ptr = inst; } } break; case JIT_OP_STORE_ELEMENT_BYTE: { unsigned char * inst; int reg; int reg2; int reg3; { reg = _jit_regs_load_value(gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2926 "./jit-rules-x86.sel" { inst = mov_memindex_reg_byte(inst, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, _jit_reg_info[reg3].cpu_reg); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_STORE_ELEMENT_SHORT: { unsigned char * inst; int reg; int reg2; int reg3; { reg = _jit_regs_load_value(gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2931 "./jit-rules-x86.sel" { x86_mov_memindex_reg(inst, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 1, _jit_reg_info[reg3].cpu_reg, 2); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_STORE_ELEMENT_INT: { unsigned char * inst; int reg; int reg2; int reg3; { reg = _jit_regs_load_value(gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2936 "./jit-rules-x86.sel" { x86_mov_memindex_reg(inst, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 2, _jit_reg_info[reg3].cpu_reg, 4); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_STORE_ELEMENT_LONG: { #line 2941 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2, reg3, reg4; int frame_offset; _jit_regs_force_out(gen, insn->value2, 1); _jit_gen_fix_value(insn->value2); reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); _jit_regs_get_reg_pair(gen, reg, reg2, -1, ®3, ®4); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; reg3 = _jit_reg_info[reg3].cpu_reg; reg4 = _jit_reg_info[reg4].cpu_reg; frame_offset = insn->value2->frame_offset; x86_mov_reg_membase(inst, reg3, X86_EBP, frame_offset, 4); x86_mov_reg_membase(inst, reg4, X86_EBP, frame_offset + 4, 4); x86_mov_memindex_reg(inst, reg, 0, reg2, 3, reg3, 4); x86_mov_memindex_reg(inst, reg, 4, reg2, 3, reg4, 4); gen->posn.ptr = inst; } } break; case JIT_OP_STORE_ELEMENT_FLOAT32: { unsigned char * inst; int reg; int reg2; int reg3; { reg = _jit_regs_load_value(gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2979 "./jit-rules-x86.sel" { x86_fst_memindex(inst, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 2, 0, 1); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_STORE_ELEMENT_FLOAT64: { unsigned char * inst; int reg; int reg2; int reg3; { reg = _jit_regs_load_value(gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value(gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value(gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 2984 "./jit-rules-x86.sel" { x86_fst_memindex(inst, _jit_reg_info[reg].cpu_reg, 0, _jit_reg_info[reg2].cpu_reg, 3, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_STORE_ELEMENT_NFLOAT: { #line 2989 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2, reg3; reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value (gen, insn->value1, sizeof(jit_nfloat) != sizeof(jit_float64), (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value (gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; if(sizeof(jit_nfloat) != sizeof(jit_float64)) { /* lea reg2, [reg2 + reg2 * 2] */ x86_lea_memindex(inst, reg2, reg2, 0, reg2, 1); /* fst [reg2 * 4] */ x86_fst80_memindex(inst, reg, 0, reg2, 2); } else { x86_fst_memindex(inst, reg, 0, reg2, 3, 1, 1); } gen->posn.ptr = (unsigned char *)inst; } } break; case JIT_OP_MEMCPY: { #line 3033 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2, reg3; int regi, save_reg3; int disp; if(insn->value2->is_constant && insn->value2->address <= 0) { } else if(insn->value2->is_constant && insn->value2->address <= 32) { reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = -1; save_reg3 = 0; for(regi = 0; regi < 4; regi++) { if(regi != reg && regi != reg2) { if(gen->contents[regi].num_values == 0 && !gen->contents[regi].used_for_temp && !gen->contents[reg].is_long_end) { reg3 = regi; break; } if(reg3 == -1) { reg3 = regi; } } } if(gen->contents[reg3].num_values > 0 || gen->contents[regi].used_for_temp || gen->contents[reg].is_long_end) { save_reg3 = 1; } inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 256)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; reg3 = _jit_reg_info[reg3].cpu_reg; if(save_reg3) { x86_push_reg(inst, reg3); } disp = 0; while(insn->value2->address >= (disp + 4)) { x86_mov_reg_membase(inst, reg3, reg2, disp, 4); x86_mov_membase_reg(inst, reg, disp, reg3, 4); disp += 4; } if(insn->value2->address >= (disp + 2)) { x86_mov_reg_membase(inst, reg3, reg2, disp, 2); x86_mov_membase_reg(inst, reg, disp, reg3, 2); disp += 2; } if(insn->value2->address > disp) { x86_mov_reg_membase(inst, reg3, reg2, disp, 1); x86_mov_membase_reg(inst, reg, disp, reg3, 1); } if(save_reg3) { x86_pop_reg(inst, reg3); } gen->posn.ptr = inst; } else { reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value (gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); /* A function call may destroy EAX,EBX,ECX,EDX registers. */ /* TODO: do not spill ESI and EDI. */ _jit_regs_spill_all(gen); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_push_reg(inst, _jit_reg_info[reg3].cpu_reg); x86_push_reg(inst, _jit_reg_info[reg2].cpu_reg); x86_push_reg(inst, _jit_reg_info[reg].cpu_reg); x86_call_code(inst, jit_memcpy); x86_alu_reg_imm(inst, X86_ADD, X86_ESP, 3 * sizeof(void *)); gen->posn.ptr = inst; } } } break; case JIT_OP_MEMMOVE: { #line 3153 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2, reg3; reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value (gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); /* A function call may destroy EAX,EBX,ECX,EDX registers. */ /* TODO: do not spill ESI and EDI. */ _jit_regs_spill_all(gen); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_push_reg(inst, _jit_reg_info[reg3].cpu_reg); x86_push_reg(inst, _jit_reg_info[reg2].cpu_reg); x86_push_reg(inst, _jit_reg_info[reg].cpu_reg); x86_call_code(inst, jit_memmove); x86_alu_reg_imm(inst, X86_ADD, X86_ESP, 3 * sizeof(void *)); gen->posn.ptr = inst; } } break; case JIT_OP_MEMSET: { #line 3188 "./jit-rules-x86.sel" { unsigned char *inst; int reg, reg2, reg3; int regi, save_reg3; int disp; if(insn->value2->is_constant && insn->value2->address <= 0) { } else if(insn->value2->is_constant && insn->value2->address <= 32) { reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = -1; reg3 = -1; save_reg3 = 0; if(insn->value1->is_constant) { inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 256)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; } else { reg2 = _jit_regs_load_value (gen, insn->value1, insn->value2->address >= 4, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); if(insn->value2->address >= 2 || !X86_IS_BYTE_REG(reg2)) { reg3 = -1; for(regi = 0; regi < 4; regi++) { if(regi != reg && regi != reg2) { if(gen->contents[regi].num_values == 0 && !gen->contents[regi].used_for_temp && !gen->contents[reg].is_long_end) { reg3 = regi; break; } if(reg3 == -1) { reg3 = regi; } } } if(gen->contents[reg3].num_values > 0 || gen->contents[regi].used_for_temp || gen->contents[reg].is_long_end) { save_reg3 = 1; } } inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 256)) { jit_cache_mark_full(&(gen->posn)); return; } reg = _jit_reg_info[reg].cpu_reg; reg2 = _jit_reg_info[reg2].cpu_reg; if(insn->value2->address >= 2 || !X86_IS_BYTE_REG(reg2)) { reg3 = _jit_reg_info[reg3].cpu_reg; if(save_reg3) { x86_push_reg(inst, reg3); } x86_mov_reg_reg(inst, reg3, reg2, 4); if(insn->value2->address >= 2) { x86_shift_reg_imm(inst, X86_SHL, reg3, 8); x86_alu_reg_reg(inst, X86_OR, reg3, reg2); if(insn->value2->address >= 4) { x86_mov_reg_reg(inst, reg2, reg3, 4); x86_shift_reg_imm(inst, X86_SHL, reg3, 16); x86_alu_reg_reg(inst, X86_OR, reg3, reg2); } } } } disp = 0; while(insn->value2->address >= (disp + 4)) { if(insn->value1->is_constant) { x86_mov_membase_imm (inst, reg, disp, insn->value1->address * 0x01010101, 4); } else { x86_mov_membase_reg(inst, reg, disp, reg3, 4); } disp += 4; } if(insn->value2->address >= (disp + 2)) { if(insn->value1->is_constant) { x86_mov_membase_imm (inst, reg, disp, insn->value1->address * 0x0101, 2); } else { x86_mov_membase_reg(inst, reg, disp, reg3, 2); } disp += 2; } if(insn->value2->address > disp) { if(insn->value1->is_constant) { x86_mov_membase_imm (inst, reg, disp, insn->value1->address, 1); } else if(insn->value2->address >= 2 || !X86_IS_BYTE_REG(reg2)) { x86_mov_membase_reg(inst, reg, disp, reg3, 1); } else { x86_mov_membase_reg(inst, reg, disp, reg2, 1); } } if(save_reg3) { x86_pop_reg(inst, reg3); } gen->posn.ptr = inst; } else { reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); reg2 = _jit_regs_load_value (gen, insn->value1, 0, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); reg3 = _jit_regs_load_value (gen, insn->value2, 0, (insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE))); /* A function call may destroy EAX,EBX,ECX,EDX registers. */ /* TODO: do not spill ESI and EDI. */ _jit_regs_spill_all(gen); inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } x86_push_reg(inst, _jit_reg_info[reg3].cpu_reg); x86_push_reg(inst, _jit_reg_info[reg2].cpu_reg); x86_push_reg(inst, _jit_reg_info[reg].cpu_reg); x86_call_code(inst, jit_memset); x86_alu_reg_imm(inst, X86_ADD, X86_ESP, 3 * sizeof(void *)); gen->posn.ptr = inst; } } } break; case JIT_OP_ALLOCA: { unsigned char * inst; int reg; reg = _jit_regs_load_value(gen, insn->value1, 1, (insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE))); { inst = (unsigned char *)(gen->posn.ptr); if(!jit_cache_check_for_n(&(gen->posn), 32)) { jit_cache_mark_full(&(gen->posn)); return; } #line 3377 "./jit-rules-x86.sel" { x86_alu_reg_imm(inst, X86_ADD, _jit_reg_info[reg].cpu_reg, 15); x86_alu_reg_imm(inst, X86_AND, _jit_reg_info[reg].cpu_reg, ~15); x86_alu_reg_reg(inst, X86_SUB, X86_ESP, _jit_reg_info[reg].cpu_reg); x86_mov_reg_reg(inst, _jit_reg_info[reg].cpu_reg, X86_ESP, 4); gen->stack_changed = 1; } gen->posn.ptr = (unsigned char *)inst; } if((insn->flags & JIT_INSN_DEST_NEXT_USE) != 0) { _jit_regs_set_value(gen, reg, insn->dest, 0); } else { int other_reg; if(gen->contents[reg].is_long_start) { other_reg = _jit_reg_info[reg].other_reg; } else { other_reg = -1; } _jit_gen_spill_reg(gen, reg, other_reg, insn->dest); if(insn->dest->has_global_register) insn->dest->in_global_register = 1; else insn->dest->in_frame = 1; _jit_regs_free_reg(gen, reg, 1); } } break; case JIT_OP_JUMP_TABLE: { #line 3386 "./jit-rules-x86.sel" { unsigned char *inst; unsigned char *patch_jump_table; unsigned char *patch_fall_through; int reg; int index; jit_label_t *labels; jit_nint num_labels; jit_block_t block; int address; reg = _jit_regs_load_value (gen, insn->dest, 0, (insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE))); _jit_regs_spill_all(gen); labels = (jit_label_t *) insn->value1->address; num_labels = insn->value2->address; inst = gen->posn.ptr; if(!jit_cache_check_for_n(&(gen->posn), 32 + sizeof(void) * num_labels)) { jit_cache_mark_full(&(gen->posn)); return; } x86_alu_reg_imm(inst, X86_CMP, reg, num_labels); patch_fall_through = inst; x86_branch32(inst, X86_CC_GE, 0, 1); patch_jump_table = inst; x86_jump_memindex(inst, X86_NOBASEREG, 0, reg, 2); while(((jit_nint) inst & (sizeof(void*) - 1)) != 0) { x86_nop(inst); } // displacement goes after opcode. ModR/M, and SIB bytes *((void **)(patch_jump_table + 3)) = inst; for(index = 0; index < num_labels; index++) { block = jit_block_from_label(func, labels[index]); if(!block) { return; } if(block->address) { x86_imm_emit32(inst, address); } else { /* Output a placeholder and record on the block's fixup list */ x86_imm_emit32(inst, (int)(block->fixup_absolute_list)); block->fixup_absolute_list = (void *)(inst - 4); } } x86_patch(patch_fall_through, inst); gen->posn.ptr = inst; } } break; #elif defined(JIT_INCLUDE_SUPPORTED) case JIT_OP_TRUNC_SBYTE: case JIT_OP_TRUNC_UBYTE: case JIT_OP_TRUNC_SHORT: case JIT_OP_TRUNC_USHORT: case JIT_OP_CHECK_SBYTE: case JIT_OP_CHECK_UBYTE: case JIT_OP_CHECK_SHORT: case JIT_OP_CHECK_USHORT: case JIT_OP_CHECK_INT: case JIT_OP_CHECK_UINT: case JIT_OP_NFLOAT_TO_FLOAT32: case JIT_OP_NFLOAT_TO_FLOAT64: case JIT_OP_FLOAT32_TO_NFLOAT: case JIT_OP_FLOAT64_TO_NFLOAT: case JIT_OP_IADD: case JIT_OP_ISUB: case JIT_OP_IMUL: case JIT_OP_IDIV: case JIT_OP_IDIV_UN: case JIT_OP_IREM: case JIT_OP_IREM_UN: case JIT_OP_INEG: case JIT_OP_LADD: case JIT_OP_LSUB: case JIT_OP_LNEG: case JIT_OP_FADD: case JIT_OP_DADD: case JIT_OP_NFADD: case JIT_OP_FSUB: case JIT_OP_DSUB: case JIT_OP_NFSUB: case JIT_OP_FMUL: case JIT_OP_DMUL: case JIT_OP_NFMUL: case JIT_OP_FDIV: case JIT_OP_DDIV: case JIT_OP_NFDIV: case JIT_OP_FREM: case JIT_OP_DREM: case JIT_OP_NFREM: case JIT_OP_FNEG: case JIT_OP_DNEG: case JIT_OP_NFNEG: case JIT_OP_IAND: case JIT_OP_IOR: case JIT_OP_IXOR: case JIT_OP_INOT: case JIT_OP_ISHL: case JIT_OP_ISHR: case JIT_OP_ISHR_UN: case JIT_OP_LAND: case JIT_OP_LOR: case JIT_OP_LXOR: case JIT_OP_LNOT: case JIT_OP_BR: case JIT_OP_BR_IFALSE: case JIT_OP_BR_ITRUE: case JIT_OP_BR_IEQ: case JIT_OP_BR_INE: case JIT_OP_BR_ILT: case JIT_OP_BR_ILT_UN: case JIT_OP_BR_ILE: case JIT_OP_BR_ILE_UN: case JIT_OP_BR_IGT: case JIT_OP_BR_IGT_UN: case JIT_OP_BR_IGE: case JIT_OP_BR_IGE_UN: case JIT_OP_IEQ: case JIT_OP_INE: case JIT_OP_ILT: case JIT_OP_ILT_UN: case JIT_OP_ILE: case JIT_OP_ILE_UN: case JIT_OP_IGT: case JIT_OP_IGT_UN: case JIT_OP_IGE: case JIT_OP_IGE_UN: case JIT_OP_FATAN: case JIT_OP_DATAN: case JIT_OP_NFATAN: case JIT_OP_FCOS: case JIT_OP_DCOS: case JIT_OP_NFCOS: case JIT_OP_FSIN: case JIT_OP_DSIN: case JIT_OP_NFSIN: case JIT_OP_FSQRT: case JIT_OP_DSQRT: case JIT_OP_NFSQRT: case JIT_OP_FABS: case JIT_OP_DABS: case JIT_OP_NFABS: case JIT_OP_CHECK_NULL: case JIT_OP_CALL: case JIT_OP_CALL_TAIL: case JIT_OP_CALL_INDIRECT: case JIT_OP_CALL_INDIRECT_TAIL: case JIT_OP_CALL_VTABLE_PTR: case JIT_OP_CALL_VTABLE_PTR_TAIL: case JIT_OP_CALL_EXTERNAL: case JIT_OP_CALL_EXTERNAL_TAIL: case JIT_OP_RETURN: case JIT_OP_RETURN_INT: case JIT_OP_RETURN_LONG: case JIT_OP_RETURN_FLOAT32: case JIT_OP_RETURN_FLOAT64: case JIT_OP_RETURN_NFLOAT: case JIT_OP_RETURN_SMALL_STRUCT: case JIT_OP_SETUP_FOR_NESTED: case JIT_OP_SETUP_FOR_SIBLING: case JIT_OP_IMPORT: case JIT_OP_THROW: case JIT_OP_RETHROW: case JIT_OP_LOAD_PC: case JIT_OP_LOAD_EXCEPTION_PC: case JIT_OP_ENTER_FINALLY: case JIT_OP_LEAVE_FINALLY: case JIT_OP_CALL_FINALLY: case JIT_OP_ENTER_FILTER: case JIT_OP_LEAVE_FILTER: case JIT_OP_CALL_FILTER: case JIT_OP_CALL_FILTER_RETURN: case JIT_OP_ADDRESS_OF_LABEL: case JIT_OP_COPY_LOAD_SBYTE: case JIT_OP_COPY_LOAD_UBYTE: case JIT_OP_COPY_LOAD_SHORT: case JIT_OP_COPY_LOAD_USHORT: case JIT_OP_COPY_INT: case JIT_OP_COPY_LONG: case JIT_OP_COPY_FLOAT32: case JIT_OP_COPY_FLOAT64: case JIT_OP_COPY_NFLOAT: case JIT_OP_COPY_STRUCT: case JIT_OP_COPY_STORE_BYTE: case JIT_OP_COPY_STORE_SHORT: case JIT_OP_ADDRESS_OF: case JIT_OP_RETURN_REG: case JIT_OP_PUSH_INT: case JIT_OP_PUSH_LONG: case JIT_OP_PUSH_FLOAT32: case JIT_OP_PUSH_FLOAT64: case JIT_OP_PUSH_NFLOAT: case JIT_OP_PUSH_STRUCT: case JIT_OP_POP_STACK: case JIT_OP_FLUSH_SMALL_STRUCT: case JIT_OP_LOAD_RELATIVE_SBYTE: case JIT_OP_LOAD_RELATIVE_UBYTE: case JIT_OP_LOAD_RELATIVE_SHORT: case JIT_OP_LOAD_RELATIVE_USHORT: case JIT_OP_LOAD_RELATIVE_INT: case JIT_OP_LOAD_RELATIVE_LONG: case JIT_OP_LOAD_RELATIVE_FLOAT32: case JIT_OP_LOAD_RELATIVE_FLOAT64: case JIT_OP_LOAD_RELATIVE_NFLOAT: case JIT_OP_LOAD_RELATIVE_STRUCT: case JIT_OP_STORE_RELATIVE_BYTE: case JIT_OP_STORE_RELATIVE_SHORT: case JIT_OP_STORE_RELATIVE_INT: case JIT_OP_STORE_RELATIVE_LONG: case JIT_OP_STORE_RELATIVE_FLOAT32: case JIT_OP_STORE_RELATIVE_FLOAT64: case JIT_OP_STORE_RELATIVE_NFLOAT: case JIT_OP_STORE_RELATIVE_STRUCT: case JIT_OP_ADD_RELATIVE: case JIT_OP_LOAD_ELEMENT_SBYTE: case JIT_OP_LOAD_ELEMENT_UBYTE: case JIT_OP_LOAD_ELEMENT_SHORT: case JIT_OP_LOAD_ELEMENT_USHORT: case JIT_OP_LOAD_ELEMENT_INT: case JIT_OP_LOAD_ELEMENT_LONG: case JIT_OP_LOAD_ELEMENT_FLOAT32: case JIT_OP_LOAD_ELEMENT_FLOAT64: case JIT_OP_LOAD_ELEMENT_NFLOAT: case JIT_OP_STORE_ELEMENT_BYTE: case JIT_OP_STORE_ELEMENT_SHORT: case JIT_OP_STORE_ELEMENT_INT: case JIT_OP_STORE_ELEMENT_LONG: case JIT_OP_STORE_ELEMENT_FLOAT32: case JIT_OP_STORE_ELEMENT_FLOAT64: case JIT_OP_STORE_ELEMENT_NFLOAT: case JIT_OP_MEMCPY: case JIT_OP_MEMMOVE: case JIT_OP_MEMSET: case JIT_OP_ALLOCA: case JIT_OP_JUMP_TABLE: return 1; #endif