diff --git a/mps/src/config.h b/mps/src/config.h index 121cd14b438..a9a237b065e 100644 --- a/mps/src/config.h +++ b/mps/src/config.h @@ -1,7 +1,7 @@ /* impl.h.config: MPS CONFIGURATION * * Copyright (C) 1997 Harlequin Group, all rights reserved. - * $HopeName: MMsrc!config.h(trunk.16) $ + * $HopeName: MMsrc!config.h(trunk.17) $ * * .readership: MPS developers. */ @@ -189,4 +189,26 @@ #define EVENT_HEADER_SIZE ((Count)3) +/* memcpy configuration + * + * PoolClass AMC requires an efficient memcpy routine. + * In general we cannot use the ANSI memcpy function as that + * would not be freestanding. However, on some platforms + * memcpy is inlined by the compiler and so does not actually + * create a dependence on an external library. + * + * Code here selects a memcpy function to use depending on + * various platform and variety configurations. + */ + +#if defined(MPS_PF_W3I3MV) && defined(MPS_HOT) +/* MSVC on Intel inlines memcpy when optimizing */ +#define MPS_MEMCPY memcpy +/* prototype ANSI memcpy */ +#include +#else +#define MPS_MEMCPY mps_lib_memcpy +#endif + + #endif /* config_h */ diff --git a/mps/src/mpslib.h b/mps/src/mpslib.h index b033b90c805..ae607369f0c 100644 --- a/mps/src/mpslib.h +++ b/mps/src/mpslib.h @@ -1,6 +1,6 @@ /* impl.h.mpslib: HARLEQUIN MEMORY POOL SYSTEM LIBRARY INTERFACE * - * $HopeName: MMsrc!mpslib.h(trunk.3) $ + * $HopeName: MMsrc!mpslib.h(trunk.4) $ * Copyright (C) 1996,1997 Harlequin Group, all rights reserved. * * .readership: MPS client application developers, MPS developers. @@ -39,6 +39,7 @@ extern int mps_lib_fputs(const char *, mps_lib_FILE *); extern void mps_lib_abort(void); extern void *mps_lib_memset(void *, int, size_t); +extern void *mps_lib_memcpy(void *, const void *, size_t); /*@@@@*/ typedef unsigned long mps_clock_t; diff --git a/mps/src/mpsliban.c b/mps/src/mpsliban.c index d70c3427f7e..058dadda011 100644 --- a/mps/src/mpsliban.c +++ b/mps/src/mpsliban.c @@ -1,6 +1,6 @@ /* impl.c.mpsliban: HARLEQUIN MEMORY POOL SYSTEM LIBRARY INTERFACE (ANSI) * - * $HopeName: MMsrc!mpsliban.c(trunk.4) $ + * $HopeName: MMsrc!mpsliban.c(trunk.5) $ * Copyright (C) 1996,1997 Harlequin Group, all rights reserved. * * PURPOSE @@ -78,6 +78,11 @@ void *mps_lib_memset(void *s, int c, size_t n) return memset(s, c, n); } +void *mps_lib_memcpy(void *s1, const void *s2, size_t n) +{ + return memcpy(s1, s2, n); +} + /* @@@@ Platform specific conversion? */ /* See http://devworld.apple.com/dev/techsupport/insidemac/OSUtilities/OSUtilities-94.html#MARKER-9-32 */ mps_clock_t mps_clock(void)