* [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructure
@ 2020-05-09 6:34 Zhang, Shenglei
2020-05-11 1:48 ` [edk2-devel] " Liming Gao
0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Shenglei @ 2020-05-09 6:34 UTC (permalink / raw)
To: devel; +Cc: Jian J Wang, Hao A Wu
OnigurumaIntrinsics.c is now not used. So the implement of function
'memcpy' is now not., which causes build failure with CLANG9 and
XCODE. I remove OnigurumaIntrinsics.c and move the necessary function
implement to OnigurumaUefiPort.c/h.
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
.../OnigurumaIntrinsics.c | 48 -------------------
.../RegularExpressionDxe/OnigurumaUefiPort.c | 5 ++
.../RegularExpressionDxe/OnigurumaUefiPort.h | 1 +
.../RegularExpressionDxe.inf | 1 -
4 files changed, 6 insertions(+), 49 deletions(-)
delete mode 100644 MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c
deleted file mode 100644
index 536c7e0f1b26..000000000000
--- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
-
- Provide intrinsics within Oniguruma
-
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
- Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include <Library/BaseMemoryLib.h>
-
-//
-// From CryptoPkg/IntrinsicLib
-//
-
-/* Copies bytes between buffers */
-#pragma function(memcpy)
-void * memcpy (void *dest, const void *src, unsigned int count)
-{
- return CopyMem (dest, src, (UINTN)count);
-}
-
-/* Sets buffers to a specified character */
-#pragma function(memset)
-void * memset (void *dest, char ch, unsigned int count)
-{
- //
- // NOTE: Here we use one base implementation for memset, instead of the direct
- // optimized SetMem() wrapper. Because the IntrinsicLib has to be built
- // without whole program optimization option, and there will be some
- // potential register usage errors when calling other optimized codes.
- //
-
- //
- // Declare the local variables that actually move the data elements as
- // volatile to prevent the optimizer from replacing this function with
- // the intrinsic memset()
- //
- volatile UINT8 *Pointer;
-
- Pointer = (UINT8 *)dest;
- while (count-- != 0) {
- *(Pointer++) = ch;
- }
-
- return dest;
-}
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
index b1604b378af3..a893ac86959f 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
@@ -86,3 +86,8 @@ void * realloc (void *ptr, size_t size)
return NULL;
}
+void * memcpy (void *dest, const void *src, unsigned int count)
+{
+ return CopyMem (dest, src, (UINTN)count);
+}
+
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
index 1a0b2daf473d..dfe4498ce57f 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
@@ -96,6 +96,7 @@ int EFIAPI sprintf_s (char *str, size_t sizeOfBuffer, char const *fmt, ...);
int strlen(const char* str);
void* malloc(size_t size);
void* realloc(void *ptr, size_t size);
+void * memcpy (void *dest, const void *src, unsigned int count);
#define exit(n) ASSERT(FALSE);
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
index da63aa6eb418..84489c294279 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
@@ -20,7 +20,6 @@ [Sources]
RegularExpressionDxe.h
OnigurumaUefiPort.h
OnigurumaUefiPort.c
- OnigurumaIntrinsics.c | MSFT
# Wrapper header files start #
stdio.h
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructure
2020-05-09 6:34 [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructure Zhang, Shenglei
@ 2020-05-11 1:48 ` Liming Gao
0 siblings, 0 replies; 2+ messages in thread
From: Liming Gao @ 2020-05-11 1:48 UTC (permalink / raw)
To: devel@edk2.groups.io, Zhang, Shenglei; +Cc: Wang, Jian J, Wu, Hao A
Reviewed-by: Liming Gao <liming.gao@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zhang, Shenglei
Sent: 2020年5月9日 14:34
To: devel@edk2.groups.io
Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructure
OnigurumaIntrinsics.c is now not used. So the implement of function 'memcpy' is now not., which causes build failure with CLANG9 and XCODE. I remove OnigurumaIntrinsics.c and move the necessary function implement to OnigurumaUefiPort.c/h.
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
.../OnigurumaIntrinsics.c | 48 -------------------
.../RegularExpressionDxe/OnigurumaUefiPort.c | 5 ++ .../RegularExpressionDxe/OnigurumaUefiPort.h | 1 +
.../RegularExpressionDxe.inf | 1 -
4 files changed, 6 insertions(+), 49 deletions(-) delete mode 100644 MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c
deleted file mode 100644
index 536c7e0f1b26..000000000000
--- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaIntrinsics.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
-
- Provide intrinsics within Oniguruma
-
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
- Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent -**/
-
-#include <Library/BaseMemoryLib.h>
-
-//
-// From CryptoPkg/IntrinsicLib
-//
-
-/* Copies bytes between buffers */
-#pragma function(memcpy)
-void * memcpy (void *dest, const void *src, unsigned int count) -{
- return CopyMem (dest, src, (UINTN)count); -}
-
-/* Sets buffers to a specified character */ -#pragma function(memset) -void * memset (void *dest, char ch, unsigned int count) -{
- //
- // NOTE: Here we use one base implementation for memset, instead of the direct
- // optimized SetMem() wrapper. Because the IntrinsicLib has to be built
- // without whole program optimization option, and there will be some
- // potential register usage errors when calling other optimized codes.
- //
-
- //
- // Declare the local variables that actually move the data elements as
- // volatile to prevent the optimizer from replacing this function with
- // the intrinsic memset()
- //
- volatile UINT8 *Pointer;
-
- Pointer = (UINT8 *)dest;
- while (count-- != 0) {
- *(Pointer++) = ch;
- }
-
- return dest;
-}
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
index b1604b378af3..a893ac86959f 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c
@@ -86,3 +86,8 @@ void * realloc (void *ptr, size_t size)
return NULL;
}
+void * memcpy (void *dest, const void *src, unsigned int count) {
+ return CopyMem (dest, src, (UINTN)count); }
+
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
index 1a0b2daf473d..dfe4498ce57f 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h
@@ -96,6 +96,7 @@ int EFIAPI sprintf_s (char *str, size_t sizeOfBuffer, char const *fmt, ...); int strlen(const char* str);
void* malloc(size_t size);
void* realloc(void *ptr, size_t size);
+void * memcpy (void *dest, const void *src, unsigned int count);
#define exit(n) ASSERT(FALSE);
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
index da63aa6eb418..84489c294279 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.i
+++ nf
@@ -20,7 +20,6 @@ [Sources]
RegularExpressionDxe.h
OnigurumaUefiPort.h
OnigurumaUefiPort.c
- OnigurumaIntrinsics.c | MSFT
# Wrapper header files start #
stdio.h
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-11 1:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-09 6:34 [PATCH 1/1] MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructure Zhang, Shenglei
2020-05-11 1:48 ` [edk2-devel] " Liming Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox