aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorJani Hakala <[email protected]>2014-02-27 15:23:44 +0200
committerJani Hakala <[email protected]>2014-02-28 11:05:13 +0200
commitadb5dc0090bc419e2c4c1250653badbddeb6263b (patch)
treed7f304279daafc26ec5ed3093614afe1b8851b33 /erts
parenta74e66a68f3b4ed590f928b4fd4f0808c6287a32 (diff)
downloadotp-adb5dc0090bc419e2c4c1250653badbddeb6263b.tar.gz
otp-adb5dc0090bc419e2c4c1250653badbddeb6263b.tar.bz2
otp-adb5dc0090bc419e2c4c1250653badbddeb6263b.zip
Add ETHR_FORCE_INLINE define to hide compiler specific directives
Some win32 specific code does not compile with gcc (mingw-w64) since '__forceinline' is not supported by gcc. This can be avoided by defining a new macro ETHR_FORCE_INLINE similar to ETHR_INLINE.
Diffstat (limited to 'erts')
-rw-r--r--erts/include/internal/ethread.h3
-rw-r--r--erts/include/internal/win/ethr_membar.h8
-rw-r--r--erts/lib_src/common/erl_misc_utils.c7
-rw-r--r--erts/lib_src/common/ethr_mutex.c6
4 files changed, 14 insertions, 10 deletions
diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h
index 64f1fae6d8..6f9bc184ef 100644
--- a/erts/include/internal/ethread.h
+++ b/erts/include/internal/ethread.h
@@ -54,13 +54,16 @@
#undef ETHR_INLINE
#if defined(__GNUC__)
# define ETHR_INLINE __inline__
+# define ETHR_FORCE_INLINE __inline__ __attribute__((__always_inline__))
#elif defined(__WIN32__)
# define ETHR_INLINE __forceinline
+# define ETHR_FORCE_INLINE __forceinline
#endif
#if defined(ETHR_DEBUG) || !defined(ETHR_INLINE) || ETHR_XCHK \
|| (defined(__GNUC__) && defined(ERTS_MIXED_CYGWIN_VC))
# undef ETHR_INLINE
# define ETHR_INLINE
+# define ETHR_FORCE_INLINE
# undef ETHR_TRY_INLINE_FUNCS
#endif
diff --git a/erts/include/internal/win/ethr_membar.h b/erts/include/internal/win/ethr_membar.h
index 8237660b2c..a17f2459fc 100644
--- a/erts/include/internal/win/ethr_membar.h
+++ b/erts/include/internal/win/ethr_membar.h
@@ -63,13 +63,13 @@ do { \
#pragma intrinsic(_mm_sfence)
#pragma intrinsic(_mm_lfence)
-static __forceinline void
+static ETHR_FORCE_INLINE void
ethr_cfence__(void)
{
_ReadWriteBarrier();
}
-static __forceinline void
+static ETHR_FORCE_INLINE void
ethr_mfence__(void)
{
#if ETHR_SIZEOF_PTR == 4
@@ -80,7 +80,7 @@ ethr_mfence__(void)
_mm_mfence();
}
-static __forceinline void
+static ETHR_FORCE_INLINE void
ethr_sfence__(void)
{
#if ETHR_SIZEOF_PTR == 4
@@ -91,7 +91,7 @@ ethr_sfence__(void)
_mm_sfence();
}
-static __forceinline void
+static ETHR_FORCE_INLINE void
ethr_lfence__(void)
{
#if ETHR_SIZEOF_PTR == 4
diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c
index 5a271c5268..8bf7656bb0 100644
--- a/erts/lib_src/common/erl_misc_utils.c
+++ b/erts/lib_src/common/erl_misc_utils.c
@@ -25,6 +25,7 @@
# include <windows.h>
#endif
+#include "ethread.h"
#include "erl_misc_utils.h"
#if defined(__WIN32__)
@@ -191,7 +192,7 @@ struct erts_cpu_info_t_ {
#if defined(__WIN32__)
-static __forceinline int
+static ETHR_FORCE_INLINE int
get_proc_affinity(erts_cpu_info_t *cpuinfo, cpu_set_t *cpuset)
{
DWORD_PTR pamask;
@@ -206,7 +207,7 @@ get_proc_affinity(erts_cpu_info_t *cpuinfo, cpu_set_t *cpuset)
}
}
-static __forceinline int
+static ETHR_FORCE_INLINE int
set_thr_affinity(cpu_set_t *set)
{
if (*set == (cpu_set_t) 0)
@@ -1157,7 +1158,7 @@ read_topology(erts_cpu_info_t *cpuinfo)
#define ERTS_MU_RELATION_CACHE 2 /* RelationCache */
#define ERTS_MU_RELATION_PROCESSOR_PACKAGE 3 /* RelationProcessorPackage */
-static __forceinline int
+static ETHR_FORCE_INLINE int
rel_cmp_val(int r)
{
switch (r) {
diff --git a/erts/lib_src/common/ethr_mutex.c b/erts/lib_src/common/ethr_mutex.c
index 72b44033ad..4e56efaf8b 100644
--- a/erts/lib_src/common/ethr_mutex.c
+++ b/erts/lib_src/common/ethr_mutex.c
@@ -1433,7 +1433,7 @@ void LeaveCriticalSection(CRITICAL_SECTION *cs)
#define ETHR_CND_WAIT__ ((ethr_sint32_t) 0x11dead11)
#define ETHR_CND_WAKEUP__ ((ethr_sint32_t) 0x11beef11)
-static __forceinline void
+static ETHR_FORCE_INLINE void
cond_wakeup(ethr_ts_event *tse)
{
ETHR_ASSERT(ethr_atomic32_read(&tse->uaflgs) == ETHR_CND_WAIT__);
@@ -1574,7 +1574,7 @@ ethr_cond_wait(ethr_cond *cnd, ethr_mutex *mtx)
return 0;
}
-static __forceinline void
+static ETHR_FORCE_INLINE void
posix_compliant_mtx_enqueue(ethr_mutex *mtx,
ethr_ts_event *tse_start,
ethr_ts_event *tse_end)
@@ -1614,7 +1614,7 @@ posix_compliant_mtx_enqueue(ethr_mutex *mtx,
}
}
-static __forceinline void
+static ETHR_FORCE_INLINE void
enqueue_cond_wakeups(ethr_ts_event *queue, int posix_compliant)
{
if (queue) {