diff options
author | William Godbe <william.godbe@comcast.net> | 2015-12-30 14:16:10 -0800 |
---|---|---|
committer | William Godbe <william.godbe@comcast.net> | 2016-01-06 17:17:03 -0800 |
commit | 17b6b066cf8cebe40ce9b6f219d3b8fb74fe8ad1 (patch) | |
tree | 93b49eb4d0371a13e16bdaf6ca5ed112c6f0878f /src/strongname/api/common.h | |
parent | b74cd1d74e7c968f8a8368498ad37fc6a5dd8577 (diff) | |
download | coreclr-17b6b066cf8cebe40ce9b6f219d3b8fb74fe8ad1.tar.gz coreclr-17b6b066cf8cebe40ce9b6f219d3b8fb74fe8ad1.tar.bz2 coreclr-17b6b066cf8cebe40ce9b6f219d3b8fb74fe8ad1.zip |
Audit usage of memcpy in PAL for Debug
Diffstat (limited to 'src/strongname/api/common.h')
-rw-r--r-- | src/strongname/api/common.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/strongname/api/common.h b/src/strongname/api/common.h index ea315e44ac..43920e5021 100644 --- a/src/strongname/api/common.h +++ b/src/strongname/api/common.h @@ -10,7 +10,7 @@ #define _common_h_ #if defined(_MSC_VER) && defined(_X86_) && !defined(FPO_ON) -#pragma optimize("y", on) // Small critical routines, don't put in EBP frame +#pragma optimize("y", on) // Small critical routines, don't put in EBP frame #define FPO_ON 1 #define COMMON_TURNED_FPO_ON 1 #endif @@ -227,25 +227,38 @@ inline void* memcpyUnsafe(void *dest, const void *src, size_t len) // #if defined(_DEBUG) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) + //If memcpy has been defined to PAL_memcpy, we undefine it so that this case + //can be covered by the if !defined(memcpy) block below + #ifdef FEATURE_PAL + #if IS_REDEFINED_IN_PAL(memcpy) + #undef memcpy + #endif //IS_REDEFINED_IN_PAL + #endif //FEATURE_PAL + // You should be using CopyValueClass if you are doing an memcpy // in the CG heap. - #if !defined(memcpy) + #if !defined(memcpy) inline void* memcpyNoGCRefs(void * dest, const void * src, size_t len) { WRAPPER_NO_CONTRACT; + + #ifndef FEATURE_PAL + return memcpy(dest, src, len); + #else //FEATURE_PAL + return PAL_memcpy(dest, src, len); + #endif //FEATURE_PAL - return memcpy(dest, src, len); } extern "C" void * __cdecl GCSafeMemCpy(void *, const void *, size_t); #define memcpy(dest, src, len) GCSafeMemCpy(dest, src, len) #endif // !defined(memcpy) + #if !defined(CHECK_APP_DOMAIN_LEAKS) #define CHECK_APP_DOMAIN_LEAKS 1 #endif #else // !_DEBUG && !DACCESS_COMPILE && !CROSSGEN_COMPILE inline void* memcpyNoGCRefs(void * dest, const void * src, size_t len) { WRAPPER_NO_CONTRACT; - return memcpy(dest, src, len); } #endif // !_DEBUG && !DACCESS_COMPILE && !CROSSGEN_COMPILE @@ -399,7 +412,7 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOL); #include "pedecoder.h" #if defined(COMMON_TURNED_FPO_ON) -#pragma optimize("", on) // Go back to command line default optimizations +#pragma optimize("", on) // Go back to command line default optimizations #undef COMMON_TURNED_FPO_ON #undef FPO_ON #endif |