Branch: Tag:

2014-08-07

2014-08-07 16:24:31 by Per Hedbor <ph@opera.com>

Changed fast_call_threads_etc handling with valgrind

Instead of disabling it entirely, clear it at function entry.
This gets rid of the uninitialized value, and slows things down less
than not doing the optimization.

585:    low_add_mem_imm( 1, reg, offset, imm32 );   }    - #ifndef USE_VALGRIND +    static void add_mem8_imm( enum amd64_reg reg, int offset, int imm32 )   {    int r2 = imm32 == -1 ? 1 : 0;
605: Inside #if undefined(USE_VALGRIND)
   ib( imm32 );    }   } - #endif +       static void sub_reg_imm( enum amd64_reg reg, int imm32 )   {
985:    push(P_REG_R12);    push(P_REG_RBX);    sub_reg_imm(P_REG_RSP, 8); /* Align on 16 bytes. */ + #ifdef USE_VALGRIND +  mov_imm_mem32(0, P_REG_RSP, 0 ); /* clear counter used by check_threads_etc */ + #endif    mov_reg_reg(ARG1_REG, Pike_interpreter_reg);    amd64_flush_code_generator_state();   }
1483:    {    LABEL_A;    /* Use C-stack for counter. We have padding added in entry */ - #ifndef USE_VALGRIND +     add_mem8_imm( P_REG_RSP, 0, 1 );    jno( &label_B ); - #endif +     call_rel_imm32( branch_check_threads_update_etc ); - #ifndef USE_VALGRIND +     LABEL_B; - #endif +     }   }