[Openmp-commits] [openmp] r241833 - Follow up to safe API patch
Jonathan Peyton
jonathan.l.peyton at intel.com
Thu Jul 9 11:20:51 PDT 2015
Author: jlpeyton
Date: Thu Jul 9 13:20:51 2015
New Revision: 241833
URL: http://llvm.org/viewvc/llvm-project?rev=241833&view=rev
Log:
Follow up to safe API patch
A while back, we made an initial change where dangerous C API functions were
replaced with macros that translated the dangerous API function calls to safer
function calls e.g., sprintf() replaced with KMP_SPRINTF() which translates to
sprintf_s() on Windows. Currently, the only operating system where this is
applicable is Windows. Unix-like systems are still using the dangerous API
e.g., KMP_SPRINTF() translates to sprintf(). Our own testing showed no
performance differences.
Differential Revision: http://reviews.llvm.org/D9918
Modified:
openmp/trunk/runtime/src/kmp_barrier.cpp
openmp/trunk/runtime/src/kmp_safe_c_api.h
Modified: openmp/trunk/runtime/src/kmp_barrier.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_barrier.cpp?rev=241833&r1=241832&r2=241833&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_barrier.cpp (original)
+++ openmp/trunk/runtime/src/kmp_barrier.cpp Thu Jul 9 13:20:51 2015
@@ -32,7 +32,7 @@
#else
#define ngo_load(src) ((void)0)
#define ngo_store_icvs(dst, src) copy_icvs((dst), (src))
-#define ngo_store_go(dst, src) memcpy((dst), (src), CACHE_LINE)
+#define ngo_store_go(dst, src) KMP_MEMCPY((dst), (src), CACHE_LINE)
#define ngo_sync() ((void)0)
#endif /* KMP_MIC && USE_NGO_STORES */
Modified: openmp/trunk/runtime/src/kmp_safe_c_api.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_safe_c_api.h?rev=241833&r1=241832&r2=241833&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_safe_c_api.h (original)
+++ openmp/trunk/runtime/src/kmp_safe_c_api.h Thu Jul 9 13:20:51 2015
@@ -23,9 +23,7 @@
# define RSIZE_MAX_STR ( 4UL << 10 ) // 4KB
// _malloca was suggested, but it is not a drop-in replacement for _alloca
-// TODO: test performance and replace with _alloca (as below)
-# define KMP_ALLOCA alloca
-//# define KMP_ALLOCA _alloca
+# define KMP_ALLOCA _alloca
# define KMP_MEMCPY_S memcpy_s
# define KMP_SNPRINTF sprintf_s
More information about the Openmp-commits
mailing list