]> granicus.if.org Git - gc/commitdiff
Prefix PREFETCH_FOR_WRITE with GC_ as used in gc_inline.h public header
authorIvan Maidanski <ivmai@mail.ru>
Mon, 28 Dec 2015 16:11:43 +0000 (19:11 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 28 Dec 2015 16:11:43 +0000 (19:11 +0300)
* doc/porting.html: Rename PREFETCH_FOR_WRITE to GC_PREFETCH_FOR_WRITE.
* fnlz_mlc.c (GC_finalized_malloc): Likewise.
* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Likewise.
* include/private/gcconfig.h: Likewise.
* new_hblk.c (GC_build_fl_clear4, GC_build_fl4, GC_build_fl): Likewise.
* include/gc_inline.h (GC_PREFETCH_FOR_WRITE): Define to no-op if
undefined.

doc/porting.html
fnlz_mlc.c
include/gc_inline.h
include/private/gcconfig.h
new_hblk.c

index f22f654e9b078126a75774bea24ee673111589bd..751cbc5953a1b0f81075249985ccfde85b435fb7 100644 (file)
@@ -181,7 +181,7 @@ allows incremental/generational garbage collection.
 <TT>MPROTECT_VDB</tt> identifies modified pages by
 write protecting the heap and catching faults.
 <TT>PROC_VDB</tt> uses the /proc primitives to read dirty bits.
-<DT><TT>PREFETCH, PREFETCH_FOR_WRITE</tt>
+<DT><TT>PREFETCH, GC_PREFETCH_FOR_WRITE</tt>
 <DD>
 The collector uses <TT>PREFETCH</tt>(<I>x</i>) to preload the cache
 with *<I>x</i>.
index 4648ca967536c43eb2982405dbbcde5598bcb77b..1b1688742e30237aa232d9fba825a6676aeabb2a 100644 (file)
@@ -162,7 +162,7 @@ GC_API void GC_CALL GC_register_disclaim_proc(int kind, GC_disclaim_proc proc,
     *my_fl = next;
     obj_link(result) = 0;
     *(word *)result = (word)fclos | 1;
-    PREFETCH_FOR_WRITE(next);
+    GC_PREFETCH_FOR_WRITE(next);
     return (word *)result + 1;
   }
 #endif /* THREAD_LOCAL_ALLOC */
index 01d4b0584241d7795524cc1ab6dc14b0563b99d3..5c49e0e5ff68499ea857ca90c9ba81fe56f4a985 100644 (file)
 # define GC_ASSERT(expr) /* empty */
 #endif
 
+#ifndef GC_PREFETCH_FOR_WRITE
+# define GC_PREFETCH_FOR_WRITE(x) (void)0
+#endif
+
 /* Store a pointer to a list of newly allocated objects of kind k and   */
 /* size lb in *result.  The caller must make sure that *result is       */
 /* traced even if objects are ptrfree.                                  */
@@ -83,7 +87,7 @@ GC_API void GC_CALL GC_generic_malloc_many(size_t /* lb */, int /* k */,
                 result = (void *)my_entry; \
                 *my_fl = next; \
                 init; \
-                PREFETCH_FOR_WRITE(next); \
+                GC_PREFETCH_FOR_WRITE(next); \
                 GC_ASSERT(GC_size(result) >= (granules)*GC_GRANULE_BYTES); \
                 GC_ASSERT((kind) == PTRFREE || ((GC_word *)result)[1] == 0); \
                 break; \
index 80fb448c8bc9e86f3a933c87846ceb60c97b7bac..ca42efa86b448655ed5c63dfc459af597ffdcde3 100644 (file)
  * An architecture may define PREFETCH(x) to preload the cache with *x.
  * This defaults to GCC built-in operation (or a no-op for other compilers).
  *
- * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
+ * GC_PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
  *
  * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
  * clear the two words at GC_malloc-aligned address x.  By default,
         /* The performance impact of prefetches is untested */
 #       define PREFETCH(x) \
           __asm__ __volatile__ ("dcbt 0,%0" : : "r" ((const void *) (x)))
-#       define PREFETCH_FOR_WRITE(x) \
+#       define GC_PREFETCH_FOR_WRITE(x) \
           __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
 #     endif
       /* There seems to be some issues with trylock hanging on darwin.  */
 #         ifdef FORCE_WRITE_PREFETCH
             /* Using prefetches for write seems to have a slight negative    */
             /* impact on performance, at least for a PIII/500.               */
-#           define PREFETCH_FOR_WRITE(x) \
+#           define GC_PREFETCH_FOR_WRITE(x) \
               __asm__ __volatile__ ("prefetcht0 %0" : : "m"(*(char *)(x)))
 #         else
 #           define NO_PREFETCH_FOR_WRITE
 #       elif defined(USE_3DNOW_PREFETCH)
 #         define PREFETCH(x) \
             __asm__ __volatile__ ("prefetch %0" : : "m"(*(char *)(x)))
-#         define PREFETCH_FOR_WRITE(x) \
+#         define GC_PREFETCH_FOR_WRITE(x) \
             __asm__ __volatile__ ("prefetchw %0" : : "m"(*(char *)(x)))
 #       endif
 #       if defined(__GLIBC__)
 #         ifndef __INTEL_COMPILER
 #           define PREFETCH(x) \
               __asm__ ("        lfetch  [%0]": : "r"(x))
-#           define PREFETCH_FOR_WRITE(x) \
+#           define GC_PREFETCH_FOR_WRITE(x) \
               __asm__ ("        lfetch.excl     [%0]": : "r"(x))
 #           define CLEAR_DOUBLE(x) \
               __asm__ ("        stf.spill       [%0]=f0": : "r"((void *)(x)))
 #         else
 #           include <ia64intrin.h>
 #           define PREFETCH(x) __lfetch(__lfhint_none, (x))
-#           define PREFETCH_FOR_WRITE(x) __lfetch(__lfhint_nta, (x))
+#           define GC_PREFETCH_FOR_WRITE(x) __lfetch(__lfhint_nta, (x))
 #           define CLEAR_DOUBLE(x) __stf_spill((void *)(x), 0)
 #         endif /* __INTEL_COMPILER */
 #       endif
 # endif
 #endif
 
-#ifndef PREFETCH_FOR_WRITE
+#ifndef GC_PREFETCH_FOR_WRITE
 # if defined(__GNUC__) && __GNUC__ >= 3 && !defined(NO_PREFETCH_FOR_WRITE)
-#   define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
+#   define GC_PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
 # else
-#   define PREFETCH_FOR_WRITE(x) (void)0
+#   define GC_PREFETCH_FOR_WRITE(x) (void)0
 # endif
 #endif
 
index 05c4abff56e864d38aa9b46074bf5fd18fdbc920..ac6a118d4d7592f4159c7bc25631487c6bfbca9a 100644 (file)
@@ -58,7 +58,7 @@
     p[3] = 0;
     p += 4;
     for (; (word)p < (word)lim; p += 4) {
-        PREFETCH_FOR_WRITE((ptr_t)(p+64));
+        GC_PREFETCH_FOR_WRITE((ptr_t)(p + 64));
         p[0] = (word)(p-4);
         p[1] = 0;
         CLEAR_DOUBLE(p+2);
@@ -92,7 +92,7 @@
     p[4] = (word)p;
     p += 8;
     for (; (word)p < (word)lim; p += 8) {
-        PREFETCH_FOR_WRITE((ptr_t)(p+64));
+        GC_PREFETCH_FOR_WRITE((ptr_t)(p + 64));
         p[0] = (word)(p-4);
         p[4] = (word)p;
     };
@@ -116,10 +116,10 @@ GC_INNER ptr_t GC_build_fl(struct hblk *h, size_t sz, GC_bool clear,
   /* If we were more serious about it, these should go inside   */
   /* the loops.  But write prefetches usually don't seem to     */
   /* matter much.                                               */
-    PREFETCH_FOR_WRITE((ptr_t)h);
-    PREFETCH_FOR_WRITE((ptr_t)h + 128);
-    PREFETCH_FOR_WRITE((ptr_t)h + 256);
-    PREFETCH_FOR_WRITE((ptr_t)h + 378);
+    GC_PREFETCH_FOR_WRITE((ptr_t)h);
+    GC_PREFETCH_FOR_WRITE((ptr_t)h + 128);
+    GC_PREFETCH_FOR_WRITE((ptr_t)h + 256);
+    GC_PREFETCH_FOR_WRITE((ptr_t)h + 378);
 # ifndef SMALL_CONFIG
     /* Handle small objects sizes more efficiently.  For larger objects */
     /* the difference is less significant.                              */