This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] rewrite stack vectors

On 2013-10-10 14:07 , wrote:
This makes the implementation of stack vectors simpler and easier to use.  This                                                                                                                                                    works by making the size of the on stack storage a template argument, so the
size is embedded in the type.  This allows you to implicitly convert a
stack_vec<T, N> to a vec<T, va_heap> *, and it will just work.  Because there's
no need to support stack vectors in unions we can make them be a more normal
c++ class with a constructor and destructor that are nontrivial.

Thanks. This looks much simpler, indeed. The patch is fine to commit. Just a couple of observations/questions:

@@ -638,7 +638,7 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
- vec<tree, va_stack> fewvars = vNULL;
+  stack_vec<tree, alloc_count> fewvars;
    pointer_set_t *vars = NULL;

Hm, what will happen now if alloc_count == 0? If I'm following the logic, this is tied to the presence of the 'vars' local, so it seems that we are fine. Otherwise, the quick_push operation will run into trouble.
/* If we're already starting with 3/4 of alloc_count, go for a
@@ -646,8 +646,6 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
       VEC.  */
    if (i * 4 > alloc_count * 3)
      vars = pointer_set_create ();
-  else if (alloc_count)
-    vec_stack_alloc (tree, fewvars, alloc_count);
/* Now go through the initial debug stmts in DEST again, this time
       actually inserting in VARS or FEWVARS.  Don't bother checking for
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 574446a..4a14607 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -107,7 +107,7 @@ typedef struct
     with a PHI DEF that would soon become non-dominant, and when we got
     to the suitable one, it wouldn't have anything to substitute any
     more.  */
-static vec<adjust_info, va_stack> adjust_vec;
+static vec<adjust_info, va_heap> adjust_vec;

A file global was declared as a stack vector?  Sigh.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]