Fix JIT use of BitScan* APIs (#84915)
authorBruce Forstall <brucefo@microsoft.com>
Mon, 17 Apr 2023 21:05:07 +0000 (14:05 -0700)
committerGitHub <noreply@github.com>
Mon, 17 Apr 2023 21:05:07 +0000 (14:05 -0700)
commit1212946a276b1356b982c005893a2dd9fbf98793
tree5201f42863c8bbf7c63a4f7cfbc79bfac9292753
parent63b9a3ae133942f4f8ea64f057f82f5fd8a2ffe5
Fix JIT use of BitScan* APIs (#84915)

* Fix JIT use of BitScan* APIs

windows.h defines the BitScan* APIs with a leading underscore
and includes `#define` definitions of non-underscore versions
to the underscore versions.

This is annoying in the JIT, where we have a BitOperations class that
uses these same names; the class members end up with leading underscores
and it confuses Visual Studio source browsing.

In the JIT, `#undef` the windows.h underscore defines. Define pass-through
non-underscore functions to call the actual functions. (We need to always
call the non-underscore versions because that is what is defined in the PAL.)
Replace usage of bitposition.h in the JIT and remove it from utilcode.h
(only one other place in the CLR uses it and they already include it.)

* Fixes

1. Remove unused genFindHighestBit
2. Remove genFindLowestReg
3. Remove BitScanForwardPtr
4. Put BitScanForward64/BitScanReverse64 under `HOST_64BIT`
src/coreclr/inc/utilcode.h
src/coreclr/jit/compiler.cpp
src/coreclr/jit/compiler.hpp
src/coreclr/jit/emit.cpp
src/coreclr/jit/emitarm.cpp
src/coreclr/jit/gcencode.cpp
src/coreclr/jit/hashbv.h
src/coreclr/jit/jitpch.h
src/coreclr/jit/utils.h