inline void _emitJne(uint8_t* dest_addr, bool unlikely) { _emitJmpCond(dest_addr, X86::COND_NOT_EQUAL, unlikely); int offset = dest_addr - addr - 2; if (unlikely) offset -= 1; if (offset >= -0x80 && offset < 0x80) { if (unlikely) _emitByte(0x2e); _emitByte(0x75); _emitByte(offset); } else { offset -= 4; if (unlikely) _emitByte(0x2e); _emitByte(0x0f); _emitByte(0x85); for (int i = 0; i < 4; i++) { _emitByte(offset & 0xff); offset >>= 8; } } }
virtual void _emitAttrGuard(int argnum, int offset, int64_t value, int npops, X86::ConditionCode slowpath_condition) { assert(slowpath_condition == X86::COND_EQUAL || slowpath_condition == X86::COND_NOT_EQUAL && "not sure if the cmp operands are in the right order"); assert(argnum <= X86::NUM_ARG_REGS); int argreg = convertArgnum(argnum); if (value < (-1l << 31) || value >= (1l << 31)) { //assert(0 && "can use r10 or r11"); int cmpreg = 5; assert(argreg != cmpreg); _emitPush(cmpreg); _emitMoveImm64(cmpreg, value); _emitAttrCmp(argreg, offset, cmpreg); _emitPop(cmpreg); } else { _emitAttrCmpImm(argreg, offset, value); } this->pops_required = std::max(this->pops_required, npops); _emitJmpCond(end_addr - X86::BYTES_PER_POP * npops, slowpath_condition, true); }