core/x86/interp.c
/* 32-bit only: inserts a comparison to speculative_tag with no side effect and
 * if value is matched continue target is assumed to be immediately
 * after targeter (which must be < 127 bytes away).
 * returns size to be added to trace 
 */
32-bit only: inserts a comparison to speculative_tag with no side effect and
if value is matched continue target is assumed to be immediately
after targeter (which must be < 127 bytes away).
returns size to be added to trace
32 - bit only : inserts a comparison to speculative_tag with no side effect and if value is matched continue target is assumed to be immediately after targeter ( which must be < 127 bytes away ) . returns size to be added to trace
static int
insert_transparent_comparison(dcontext_t *dcontext, instrlist_t *trace,
                              instr_t *targeter, 
                              app_pc speculative_tag)
{
    int added_size = 0;
    instr_t *jecxz;
    instr_t *continue_label = INSTR_CREATE_label(dcontext);
    added_size += tracelist_add
        (dcontext, trace, targeter,
         INSTR_CREATE_lea
         (dcontext, opnd_create_reg(REG_ECX),
          opnd_create_base_disp(REG_ECX, REG_NULL, 0,
                                -((int)(ptr_int_t)speculative_tag), OPSZ_lea)));
    jecxz = INSTR_CREATE_jecxz(dcontext, opnd_create_instr(continue_label));
    instr_set_ok_to_mangle(jecxz, false);
    added_size += tracelist_add(dcontext, trace, targeter, jecxz);
    IF_X64(ASSERT_NOT_IMPLEMENTED(false));
    added_size += tracelist_add
        (dcontext, trace, targeter,
         INSTR_CREATE_lea
         (dcontext, opnd_create_reg(REG_ECX),
          opnd_create_base_disp(REG_ECX, REG_NULL, 0,
                                ((int)(ptr_int_t)speculative_tag), OPSZ_lea)));
    added_size += tracelist_add_after(dcontext, trace, targeter, continue_label);
    return added_size;
}
static int insert_transparent_comparison ( dcontext_t * dcontext , instrlist_t * trace , instr_t * targeter , app_pc speculative_tag ) { int added_size = 0 ; instr_t * jecxz ; instr_t * continue_label = INSTR_CREATE_label ( dcontext ) ; added_size += tracelist_add ( dcontext , trace , targeter , INSTR_CREATE_lea ( dcontext , opnd_create_reg ( REG_ECX ) , opnd_create_base_disp ( REG_ECX , REG_NULL , 0 , - ( ( int ) ( ptr_int_t ) speculative_tag ) , OPSZ_lea ) ) ) ; jecxz = INSTR_CREATE_jecxz ( dcontext , opnd_create_instr ( continue_label ) ) ; instr_set_ok_to_mangle ( jecxz , false ) ; added_size += tracelist_add ( dcontext , trace , targeter , jecxz ) ; IF_X64 ( ASSERT_NOT_IMPLEMENTED ( false ) ) ; added_size += tracelist_add ( dcontext , trace , targeter , INSTR_CREATE_lea ( dcontext , opnd_create_reg ( REG_ECX ) , opnd_create_base_disp ( REG_ECX , REG_NULL , 0 , ( ( int ) ( ptr_int_t ) speculative_tag ) , OPSZ_lea ) ) ) ; added_size += tracelist_add_after ( dcontext , trace , targeter , continue_label ) ; return added_size ; }
32-bit only: inserts a comparison to speculative_tag with no side effect and
 if value is matched continue target is assumed to be immediately
 after targeter (which must be < 127 bytes away).
32 - bit only : inserts a comparison to speculative_tag with no side effect and if value is matched continue target is assumed to be immediately after targeter ( which must be < 127 bytes away ) .
/* exit CTI */ /* instead of:
     *   cmp ecx,const
     * we use:
     *   lea -const(ecx) -> ecx
     *   jecxz continue
     *   lea const(ecx) -> ecx
     *   jmp exit   # usual targeter for stay on trace comparison
     * continue:    # if match, we target post-targeter
     *
     * we have to use the landing pad b/c we don't know whether the
     * stub will be <128 away
     */ /* lea requires OPSZ_lea operand */ /* do not treat jecxz as exit cti! */ /* need to recover address in ecx */