public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* VEC re-write [patch 01/25]
@ 2012-11-15 21:53 Diego Novillo
       [not found] ` <50A61414.8070908@redhat.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Diego Novillo @ 2012-11-15 21:53 UTC (permalink / raw)
  To: joern.rennecke, nathan, gingold, nickc, dje.gcc, law,
	rdsandiford, dj, wilson, rth, echristo, bernds, mikestump, aph,
	iant, paul, jason, joseph, ebotcazou, laurynas.biveinis,
	rguenther, gcc-patches

I have split the VEC rewrite into 25 patches.  The only patches that
make actual changes are #1 (vec.c and vec.h) and #2 (gengtype).  All
the others are mechanical side-effects from the first patch.

I will still appreciate if maintainers can take a look at the other
patches to make sure I have not introduced anything strange.  Some of
the changes were done with sed.  I've fixed up the formatting
manually, but I may have missed the odd thing.

All the folks in the CC list: expect to receive at least one of the
patches in the patchset.  The changes in every area other than
vec.[ch] are mechanical, so I am not really looking for an approval.
But, if you spot something fishy, please let me know.

I have tested the patch pretty extensively:

- Regular bootstraps on x86_64, ppc, ia64, sparc and hppa.
- Bootstraps with --enable-checking=release
- Bootstraps with --enable-checking=gc,gcac
- Basic builds on all targets (using contrib/config-list.mk).

I'm now doing build-time comparisons, but I do not expect changes.

I've documented the changes from a user's perspective on
http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec.  This should help
reading te new vec code for the first time.

We no longer access the vectors via VEC_* macros.  The pattern is
"VEC_operation (T, A, V, args)" becomes "V.operation (args)".

The only thing I could not do is create proper ctors and dtors for the
vec class.  Since these vectors are stored in unions, we
have to keep them as PODs (C++03 does not allow non-PODs in unions).

This means that creation and destruction must be explicit.  There is a
new method vec<type, allocation, layout>::create() and another vec<type,
allocation, layout>::destroy() to allocate the internal vector.

For vectors that must be pointers, there is a family of free functions
that implement the operations that need to tolerate NULL vectors.
These functions all start with the prefix 'vec_safe_'.  See the wiki
page for details.

I would like to commit the patch this weekend.  This will increase the
chances of not conflicting with any other patches going in.  I do not
expect any breakage to occur, but the patch is massive.  Once the
patch is in, please CC me on any bug reports that are caused by vec
changes.

Typical problems include:

- An ICE inside a vec function member because 'this' is NULL.  These
  are the easiest to fix.  You simply look in the backtrace for the
  first entry that is outside of vec.h.  That's the line you need to
  modify to use one of the 'vec_safe_*' functions.

- A syntax error in calling a vec function member.  These should not
  occur, as I have pruned all the ones that occurred in
  config-list.mk, but if it happens this is often a vector that was a
  pointer and its function is being accessed with '.'.  If the vector
  is a GC vector, then it may need to be accessed with 'vec_safe_*'

In any case, just forward me the failure and I will deal with it.

Richi, I've added vec::quick_grow and vec::quick_grow_cleared.  This
will let you change that FIXME comment in PRE, I think.


Thanks.  Diego.

[ The patch is too big for e-mail.  It's available at http://www.airs.com/~dnovillo/pub/vec-rewrite/01vec.diff ]

2012-11-15  Diego Novillo  <dnovillo@google.com>

	* vec.c (register_overhead): Convert it into
	member function of vec_prefix.
	(release_overhead): Likewise.
	(calculate_allocation): Likewise.
	(vec_heap_free): Remove.
	(vec_gc_o_reserve_1): Remove.
	(vec_heap_o_reserve_1): Remove.
	(vec_stack_o_reserve_1): Remove.
	(vec_stack_o_reserve_exact): Remove.
	(register_stack_vec): New.
	(stack_vec_register_index): New.
	(unregister_stack_vec): New.
	(vec_assert_fail): Remove.
	* vec.h: Conditionally include ggc.h.  Document conditional
	hackery.
	Update top-level documentation.
	(ALONE_VEC_CHECK_INFO): Remove.
	(VEC_CHECK_INFO): Remove.
	(ALONE_VEC_CHECK_DECL): Remove.
	(VEC_CHECK_DECL): Remove.
	(ALONE_VEC_CHECK_PASS): Remove.
	(VEC_CHECK_PASS): Remove.
	(VEC_ASSERT): Remove.
	(vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and
	va_stack.
	Mark fields alloc_ and num_ as protected.
	(struct vec_t): Remove.  Remove all function members.
	(struct vl_embed): Declare.
	(struct vl_ptr): Declare.
	(free): Remove.
	(reserve_exact): Remove.
	(reserve): Remove.
	(safe_splice): Remove.
	(safe_push): Remove.
	(safe_grow): Remove.
	(safe_grow_cleared): Remove.
	(safe_insert): Remove.
	(DEF_VEC_I): Remove.
	(DEF_VEC_ALLOC_I): Remove.
	(DEF_VEC_P): Remove.
	(DEF_VEC_ALLOC_P): Remove.
	(DEF_VEC_O): Remove.
	(DEF_VEC_ALLOC_O): Remove.
	(DEF_VEC_ALLOC_P_STACK): Remove.
	(DEF_VEC_ALLOC_O_STACK): Remove.
	(DEF_VEC_ALLOC_I_STACK): Remove.
	(DEF_VEC_A): Remove.
	(DEF_VEC_ALLOC_A): Remove.
	(vec_stack_p_reserve_exact_1): Remove.
	(vec_stack_o_reserve): Remove.
	(vec_stack_o_reserve_exact): Remove.
	(VEC_length): Remove.
	(VEC_empty): Remove.
	(VEC_address): Remove.
	(vec_address): Remove.
	(VEC_last): Remove.
	(VEC_index): Remove.
	(VEC_iterate): Remove.
	(VEC_embedded_size): Remove.
	(VEC_embedded_init): Remove.
	(VEC_free): Remove.
	(VEC_copy): Remove.
	(VEC_space): Remove.
	(VEC_reserve): Remove.
	(VEC_reserve_exact): Remove.
	(VEC_splice): Remove.
	(VEC_safe_splice): Remove.
	(VEC_quick_push): Remove.
	(VEC_safe_push): Remove.
	(VEC_pop): Remove.
	(VEC_truncate): Remove.
	(VEC_safe_grow): Remove.
	(VEC_replace): Remove.
	(VEC_quick_insert): Remove.
	(VEC_safe_insert): Remove.
	(VEC_ordered_remove): Remove.
	(VEC_unordered_remove): Remove.
	(VEC_block_remove): Remove.
	(VEC_lower_bound): Remove.
	(VEC_alloc): Remove.
	(VEC_qsort): Remove.

	(va_heap): Declare.
	(va_heap::default_layout): New typedef to vl_ptr.
	(va_heap::reserve): New.
	(va_heap::release): New.
	(va_gc): Declare.
	(va_gc::default_layout): New typedef to vl_embed.
	(va_gc::reserve): New.
	(va_gc::release): New.
	(va_gc_atomic): Declare.  Inherit from va_gc.
	(va_stack): Declare.
	(va_stack::default_layout): New typedef to vl_ptr.
	(va_stack::alloc): New.
	(va_stack::reserve): New.
	(va_stack::release): New.
	(register_stack_vec): Declare.
	(stack_vec_register_index): Declare.
	(unregister_stack_vec): Declare.

	(vec<T, A = va_heap, L = typename A::default_layout>): Declare
	empty vec template.
	(vec<T, A, vl_embed>): Partial specialization for embedded
	layout.
	(vec<T, A, vl_embed>::allocated): New.
	(vec<T, A, vl_embed>::length): New.
	(vec<T, A, vl_embed>::is_empty): New.
	(vec<T, A, vl_embed>::address): New.
	(vec<T, A, vl_embed>::operator[]): New.
	(vec<T, A, vl_embed>::last New.
	(vec<T, A, vl_embed>::space): New.
	(vec<T, A, vl_embed>::iterate): New.
	(vec<T, A, vl_embed>::iterate): New.
	(vec<T, A, vl_embed>::copy): New.
	(vec<T, A, vl_embed>::splice): New.
	(vec<T, A, vl_embed>::quick_push New.
	(vec<T, A, vl_embed>::pop New.
	(vec<T, A, vl_embed>::truncate): New.
	(vec<T, A, vl_embed>::quick_insert): New.
	(vec<T, A, vl_embed>::ordered_remove): New.
	(vec<T, A, vl_embed>::unordered_remove): New.
	(vec<T, A, vl_embed>::block_remove): New.
	(vec<T, A, vl_embed>::qsort): New.
	(vec<T, A, vl_embed>::lower_bound): New.
	(vec<T, A, vl_embed>::embedded_size): New.
	(vec<T, A, vl_embed>::embedded_init): New.
	(vec<T, A, vl_embed>::quick_grow): New.
	(vec<T, A, vl_embed>::quick_grow_cleared): New.
	(vec_safe_space): New.
	(vec_safe_length): New.
	(vec_safe_address): New.
	(vec_safe_is_empty): New.
	(vec_safe_reserve): New.
	(vec_safe_reserve_exact): New.
	(vec_alloc): New.
	(vec_free): New.
	(vec_safe_grow): New.
	(vec_safe_grow_cleared): New.
	(vec_safe_iterate): New.
	(vec_safe_push): New.
	(vec_safe_insert): New.
	(vec_safe_truncate): New.
	(vec_safe_copy): New.
	(vec_safe_splice): New.

	(vec<T, A, vl_ptr>): New partial specialization for the space
	efficient layout.
	(vec<T, A, vl_embed>::exists): New.
	(vec<T, A, vl_embed>::is_empty): New.
	(vec<T, A, vl_embed>::length): New.
	(vec<T, A, vl_embed>::address): New.
	(vec<T, A, vl_embed>::operator[]): New.
	(vec<T, A, vl_embed>::operator!=): New.
	(vec<T, A, vl_embed>::operator==): New.
	(vec<T, A, vl_embed>::last New.
	(vec<T, A, vl_embed>::space): New.
	(vec<T, A, vl_embed>::iterate): New.
	(vec<T, A, vl_embed>::copy): New.
	(vec<T, A, vl_embed>::reserve): New.
	(vec<T, A, vl_embed>::reserve_exact): New.
	(vec<T, A, vl_embed>::splice): New.
	(vec<T, A, vl_embed>::safe_splice): New.
	(vec<T, A, vl_embed>::quick_push): New.
	(vec<T, A, vl_embed>::safe_push): New.
	(vec<T, A, vl_embed>::pop New.
	(vec<T, A, vl_embed>::truncate): New.
	(vec<T, A, vl_embed>::safe_grow): New.
	(vec<T, A, vl_embed>::safe_grow_cleared): New.
	(vec<T, A, vl_embed>::quick_grow): New.
	(vec<T, A, vl_embed>::quick_grow_cleared): New.
	(vec<T, A, vl_embed>::quick_insert): New.
	(vec<T, A, vl_embed>::safe_insert): New.
	(vec<T, A, vl_embed>::ordered_remove): New.
	(vec<T, A, vl_embed>::unordered_remove): New.
	(vec<T, A, vl_embed>::block_remove): New.
	(vec<T, A, vl_embed>::qsort): New.
	(vec<T, A, vl_embed>::lower_bound): New.
	(vec_stack_alloc): Define.
	(FOR_EACH_VEC_SAFE_ELT): Define.
	* vecir.h: Remove.  Update all users.
	* vecprim.h: Remove.  Update all users.
	Move uchar to coretypes.h.

	* Makefile.in (VEC_H): Add $(GGC_H).
	Remove vecir.h and vecprim.h dependencies everywhere.

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: VEC re-write [patch 01/25]
@ 2012-11-18 21:28 David Edelsohn
  2012-11-19  1:04 ` Diego Novillo
  0 siblings, 1 reply; 24+ messages in thread
From: David Edelsohn @ 2012-11-18 21:28 UTC (permalink / raw)
  To: Diego Novillo; +Cc: GCC Patches

Files were changed in gcc/c-family with no associated ChangeLog entry.
 And now bootstrap fails on AIX using GCC 4.6.3 with the error:

/nasfarm/dje/src/src/gcc/c-family/c-lex.c: In function 'c_fileinfo*
get_fileinfo(const char*)':
/nasfarm/dje/src/src/gcc/c-family/c-lex.c:107:39: error: overloaded
function with no contextual type information

which is

    file_info_tree = splay_tree_new ((splay_tree_compare_fn) strcmp,
                                     0,
                                     (splay_tree_delete_value_fn) free);

- David

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2012-11-25 15:25 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 21:53 VEC re-write [patch 01/25] Diego Novillo
     [not found] ` <50A61414.8070908@redhat.com>
2012-11-16 12:13   ` Diego Novillo
2012-11-16 12:22     ` Pedro Alves
2012-11-16 23:16 ` Ian Lance Taylor
2012-11-18  2:57 ` Diego Novillo
2012-11-18 17:05   ` Hans-Peter Nilsson
2012-11-18 17:12     ` Diego Novillo
2012-11-18 17:43       ` Hans-Peter Nilsson
2012-11-18 17:48         ` Diego Novillo
2012-11-18 19:15       ` Andrew Pinski
2012-11-19 19:57         ` Jack Howarth
2012-11-19 20:16           ` Jack Howarth
2012-11-25 13:11       ` Richard Biener
2012-11-25 15:25         ` Diego Novillo
2012-11-18 18:25     ` Andreas Tobler
2012-11-18 19:12       ` Hans-Peter Nilsson
2012-11-18 19:32         ` Andreas Tobler
2012-11-18 19:50           ` Hans-Peter Nilsson
2012-11-20 13:57   ` Ulrich Weigand
2012-11-18 21:28 David Edelsohn
2012-11-19  1:04 ` Diego Novillo
2012-11-19  1:14   ` David Edelsohn
2012-11-19  3:18     ` Ian Lance Taylor
2012-11-19 14:46       ` David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).