This is the final merge from trunk before I start sending the
branch->trunk merge patches.

This merge required some non-mechanical fixes.  A recent patch
introduced DEF_VEC_A() for vectors of atomic types.  When a VEC
of an atomic type needs to be GC/PCH marked, the marker
needs to do nothing.

In trunk, this is done by creating a separate vec_t structure
that declares the type with GTY((atomic)).  In the branch, we can
do it a little simpler by providing explicit template
instantiations for the atomic type that do nothing.

The patch below does that.  When the user declares a vector with
DEF_VEC_A(), the macro expands to 3 instances of the gt_ggc_mx
and gt_pch_nx functions that do nothing.

After I get rid of the DEF_VEC_* macros in trunk, I will probably
provide the same feature by adding an additional parameter to the
vec_t class.

Tested on x86_64.  Committed to branch.


Diego.



        * vec.h (DEF_VEC_A): Provide template instantiations for
        GC/PCH markers that do not traverse the vector.

diff --git a/svnclient/gcc/vec.h b/svnclient/gcc/vec.h
index b139053..5fdb859 100644
--- a/svnclient/gcc/vec.h
+++ b/svnclient/gcc/vec.h
@@ -231,8 +231,36 @@ gt_pch_nx (vec_t<T> *v, gt_pointer_operator op, void 
*cookie)
 #define DEF_VEC_ALLOC_O_STACK(T)       struct vec_swallow_trailing_semi
 #define DEF_VEC_ALLOC_I_STACK(T)       struct vec_swallow_trailing_semi
 
-/* Vectors of atomic types.  */
-#define DEF_VEC_A(T)                   struct vec_swallow_trailing_semi
+/* Vectors of atomic types.  Atomic types do not need to have its
+   elements marked for GC and PCH.  To avoid unnecessary traversals,
+   we provide template instantiations for the GC/PCH functions that
+   do not traverse the vector.
+
+   FIXME cxx-conversion - Once vec_t users are converted this can
+   be provided in some other way (e.g., adding an additional template
+   parameter to the vec_t class).  */
+#define DEF_VEC_A(TYPE)                                                \
+template<typename T>                                           \
+void                                                           \
+gt_ggc_mx (vec_t<TYPE> *v ATTRIBUTE_UNUSED)                    \
+{                                                              \
+}                                                              \
+                                                               \
+template<typename T>                                           \
+void                                                           \
+gt_pch_nx (vec_t<TYPE> *v ATTRIBUTE_UNUSED)                    \
+{                                                              \
+}                                                              \
+                                                               \
+template<typename T>                                           \
+void                                                           \
+gt_pch_nx (vec_t<TYPE> *v ATTRIBUTE_UNUSED,                    \
+          gt_pointer_operator op ATTRIBUTE_UNUSED,             \
+          void *cookie ATTRIBUTE_UNUSED)                       \
+{                                                              \
+}                                                              \
+struct vec_swallow_trailing_semi
+
 #define DEF_VEC_ALLOC_A(T,A)           struct vec_swallow_trailing_semi
 
 /* Support functions for stack vectors.  */

Reply via email to