aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/sys.h
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-10-22 17:15:31 +0200
committerLukas Larsson <[email protected]>2016-02-02 10:45:21 +0100
commitd76ee58c07f32dfc0652844ec2b513af2105ffa1 (patch)
treeac6d50ec60414c7433508196410b22216493209d /erts/emulator/beam/sys.h
parent1a6ec7c7eb20bb2b8300e7e59196c49ca63775b0 (diff)
downloadotp-d76ee58c07f32dfc0652844ec2b513af2105ffa1.tar.gz
otp-d76ee58c07f32dfc0652844ec2b513af2105ffa1.tar.bz2
otp-d76ee58c07f32dfc0652844ec2b513af2105ffa1.zip
erts: Add ERTS_WRITE_UNLIKELY
ERTS_WRITE_UNLIKELY can be used to place global variables in a specific section where only data that is very rarely modified sits. This is used to improve cache locality.
Diffstat (limited to 'erts/emulator/beam/sys.h')
-rw-r--r--erts/emulator/beam/sys.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h
index 279e4db0af..e77b4b2dc8 100644
--- a/erts/emulator/beam/sys.h
+++ b/erts/emulator/beam/sys.h
@@ -136,6 +136,17 @@ typedef ERTS_SYS_FD_TYPE ErtsSysFdType;
# define ERTS_LIKELY(BOOL) (BOOL)
# define ERTS_UNLIKELY(BOOL) (BOOL)
#endif
+
+#if ERTS_AT_LEAST_GCC_VSN__(2, 96, 0)
+#ifndef __llvm__
+# define ERTS_WRITE_UNLIKELY(X) X __attribute__ ((section ("ERTS_LOW_WRITE") ))
+#else
+# define ERTS_WRITE_UNLIKELY(X) X __attribute__ ((section ("__DATA,ERTS_LOW_WRITE") ))
+#endif
+#else
+# define ERTS_WRITE_UNLIKELY(X) X
+#endif
+
#ifdef __GNUC__
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
# define ERTS_DECLARE_DUMMY(X) X __attribute__ ((unused))