Define GC_PREFETCH_FOR_WRITE to __builtin_prefetch in gc_inline.h (GCC)
authorIvan Maidanski <ivmai@mail.ru>
Tue, 28 Feb 2017 20:41:03 +0000 (23:41 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 28 Feb 2017 20:41:03 +0000 (23:41 +0300)
Also add GC_ prefix to NO_PREFETCH_FOR_WRITE.

* include/gc_inline.h [!GC_PREFETCH_FOR_WRITE] (GC_PREFETCH_FOR_WRITE):
Copy the definition from gcconfig.h.
* include/private/gcconfig.h (NO_PREFETCH_FOR_WRITE): Rename to
GC_NO_PREFETCH_FOR_WRITE.

include/gc_inline.h
include/private/gcconfig.h

index a4fb4e3..71f9f90 100644 (file)
 #endif
 
 #ifndef GC_PREFETCH_FOR_WRITE
-# define GC_PREFETCH_FOR_WRITE(x) (void)0
+# if defined(__GNUC__) && __GNUC__ >= 3 && !defined(GC_NO_PREFETCH_FOR_WRITE)
+#   define GC_PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
+# else
+#   define GC_PREFETCH_FOR_WRITE(x) (void)0
+# endif
 #endif
 
 /* Object kinds; must match PTRFREE, NORMAL in gc_priv.h.       */
index af7ff3e..6016b47 100644 (file)
 #           define GC_PREFETCH_FOR_WRITE(x) \
               __asm__ __volatile__ ("prefetcht0 %0" : : "m"(*(char *)(x)))
 #         else
-#           define NO_PREFETCH_FOR_WRITE
+#           define GC_NO_PREFETCH_FOR_WRITE
 #         endif
 #       elif defined(USE_3DNOW_PREFETCH)
 #         define PREFETCH(x) \
 #endif
 
 #ifndef GC_PREFETCH_FOR_WRITE
-# if defined(__GNUC__) && __GNUC__ >= 3 && !defined(NO_PREFETCH_FOR_WRITE)
+# if defined(__GNUC__) && __GNUC__ >= 3 && !defined(GC_NO_PREFETCH_FOR_WRITE)
 #   define GC_PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
 # else
 #   define GC_PREFETCH_FOR_WRITE(x) (void)0