Closed zhanggenex closed 4 years ago
the cur_loc values are generated by rand() % MAP_SIZE
and prev_loc by a right shift of cur_loc. Hence the calculated map location can not be larger than the MAP_SIZE.
@vanhauser-thc
The xor result is this:
ConstantInt *CurLoc = ConstantInt::get(Int32Ty, cur_loc);
Value *PrevLocCasted = IRB.CreateZExt(PrevLoc, IRB.getInt32Ty());
IRB.CreateXor(PrevLocCasted, CurLoc)
It seems like they are all int 32 type.
Could you please look into this? Thanks for the discussion.
I know the code very well. try yourself ... select two values of your choice that are "rand() % MAP_SIZE", xor them and see if they can be larger than MAP_SIZE. they can't :) it is math. It needs to be an Int32 instead of Int16 because the MAP_SIZE is configurable in config.h
@vanhauser-thc Thanks.
Hi, guys. In LLVM instrumentation mode, I noticed that the result of cur_location ^ prev_location is stored in a 32 bit int type. However, the size of SHM is 64KB, whose is index is a 64K (64KB divided by 8) type, which is 16 bit type. And I did not see any codes in the pass to translate 32 bit to 16 bit. Will this be a problem?