Why memcpy is not inlined?

Could anyone tell why calls to memcpy are not inlined?

I’m building a driver with WDK 7600, x86.
Compiler Version 15.00.30729.207
This is release build, compiled with options /Oxs /Oy-

But memcpy and memcmp are still called as external functions
and not inlined.

Tried to add #pragma intrinsic(memcpy, memset)
and /Oi to MSC_OPTIMIZATION - - does not help.

Regards,
Pavel

I think that the wdk does some #define magic depending on whether the build
is CHK. You might want to take a look in WDM.H.

#if DBG_MEMCPY_INLINE && !defined(MIDL_PASS) && !defined(MEMCPY_INLINE)
&& !defined(_CRTBLD)
#define MEMCPY_INLINE
FORCEINLINE
PVOID
__cdecl
memcpy_inline (
__out_bcount_full(size) void *dst,
__in_bcount(size) const void *src,
__in size_t size
)
{
//
// Make sure the source and destination do not overlap such that the
// move destroys the destination.
//
if (((char *)dst > (char *)src) &&
((char *)dst < ((char *)src + size))) {
__debugbreak();
}
return memcpy(dst, src, size);
}
#define memcpy memcpy_inline
#endif

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@fastmail.fm
Sent: Sunday, July 18, 2010 5:24 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Why memcpy is not inlined?

Could anyone tell why calls to memcpy are not inlined?

I’m building a driver with WDK 7600, x86.
Compiler Version 15.00.30729.207
This is release build, compiled with options /Oxs /Oy-

But memcpy and memcmp are still called as external functions and not
inlined.

Tried to add #pragma intrinsic(memcpy, memset) and /Oi to MSC_OPTIMIZATION -

  • does not help.

Regards,
Pavel


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

That is to say that I’m not really sure if this is the issue or not, but it
seems like it could be - I really have no idea.

mm

-----Original Message-----
From: M. M. O’Brien [mailto:xxxxx@gmail.com]
Sent: Sunday, July 18, 2010 8:15 PM
To: ‘Windows System Software Devs Interest List’
Subject: RE: [ntdev] Why memcpy is not inlined?

I think that the wdk does some #define magic depending on whether the build
is CHK. You might want to take a look in WDM.H.

#if DBG_MEMCPY_INLINE && !defined(MIDL_PASS) && !defined(MEMCPY_INLINE)
&& !defined(_CRTBLD) #define MEMCPY_INLINE FORCEINLINE PVOID __cdecl
memcpy_inline (
__out_bcount_full(size) void *dst,
__in_bcount(size) const void *src,
__in size_t size
)
{
//
// Make sure the source and destination do not overlap such that the
// move destroys the destination.
//
if (((char *)dst > (char *)src) &&
((char *)dst < ((char *)src + size))) {
__debugbreak();
}
return memcpy(dst, src, size);
}
#define memcpy memcpy_inline
#endif

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@fastmail.fm
Sent: Sunday, July 18, 2010 5:24 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Why memcpy is not inlined?

Could anyone tell why calls to memcpy are not inlined?

I’m building a driver with WDK 7600, x86.
Compiler Version 15.00.30729.207
This is release build, compiled with options /Oxs /Oy-

But memcpy and memcmp are still called as external functions and not
inlined.

Tried to add #pragma intrinsic(memcpy, memset) and /Oi to MSC_OPTIMIZATION -

  • does not help.

Regards,
Pavel


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer