From patchwork Wed Jul 6 04:08:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 103410 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B31821007D5 for ; Wed, 6 Jul 2011 14:08:45 +1000 (EST) Received: (qmail 7182 invoked by alias); 6 Jul 2011 04:08:43 -0000 Received: (qmail 7161 invoked by uid 22791); 6 Jul 2011 04:08:41 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Jul 2011 04:08:26 +0000 Received: from wpaz13.hot.corp.google.com (wpaz13.hot.corp.google.com [172.24.198.77]) by smtp-out.google.com with ESMTP id p6648Osj022557; Tue, 5 Jul 2011 21:08:24 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by wpaz13.hot.corp.google.com with ESMTP id p6648Mx4013018; Tue, 5 Jul 2011 21:08:22 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id 573AA1DA1D1; Wed, 6 Jul 2011 00:08:22 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gchare@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Stream and restore static_aggregates (issue4626096) Message-Id: <20110706040822.573AA1DA1D1@topo.tor.corp.google.com> Date: Wed, 6 Jul 2011 00:08:22 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch is a partial fix for c1eabi1.cc. We were missing static initializers. There is another source of assembly difference in that file, so I still need to dig some more. This fixes x2nontrivinit.cc, however. I am still not happy with the way we add bindings and symbols to namespaces. We are missing several things, but I'm not quite sure what yet. We'll need to restructure pph_add_bindings_to_namespace. Tested on x86_64. Committed to branch. Diego. * pph-streamer-in.c (pph_add_bindings_to_namespace): Recurse into each namespace bindings, if needed. (pph_read_file_contents): Add static aggregates from STREAM into static_aggregates. * pph-streamer-out.c (pph_write_file_contents): Write static_aggregates. testsuite/ChangeLog.pph * g++.dg/pph/x2nontrivinit.cc: Mark fixed. --- This patch is available for review at http://codereview.appspot.com/4626096 diff --git a/gcc/cp/ChangeLog.pph b/gcc/cp/ChangeLog.pph index 46b18be..a70ab0e 100644 --- a/gcc/cp/ChangeLog.pph +++ b/gcc/cp/ChangeLog.pph @@ -1,3 +1,12 @@ +2011-07-05 Diego Novillo + + * pph-streamer-in.c (pph_add_bindings_to_namespace): Recurse into + each namespace bindings, if needed. + (pph_read_file_contents): Add static aggregates from STREAM into + static_aggregates. + * pph-streamer-out.c (pph_write_file_contents): Write + static_aggregates. + 2011-07-04 Gabriel Charette * pph-streamer-in.c (pph_add_bindings_to_namespace): diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c index 72536a5..0bab93b 100644 --- a/gcc/cp/pph-streamer-in.c +++ b/gcc/cp/pph-streamer-in.c @@ -1167,11 +1167,9 @@ pph_add_bindings_to_namespace (struct cp_binding_level *bl, tree ns) /* Pushing a decl into a scope clobbers its DECL_CHAIN. Preserve it. */ chain = DECL_CHAIN (t); - - /* FIXME pph: we should first check to see if it isn't already there. - If it is, we should use this function recursively to merge - the bindings in T in the corresponding namespace. */ pushdecl_into_namespace (t, ns); + if (NAMESPACE_LEVEL (t)) + pph_add_bindings_to_namespace (NAMESPACE_LEVEL (t), t); } } @@ -1314,7 +1312,7 @@ pph_read_file_contents (pph_stream *stream) cpp_ident_use *bad_use; const char *cur_def; cpp_idents_used idents_used; - tree fndecl, t, file_keyed_classes; + tree fndecl, t, file_keyed_classes, file_static_aggregates; unsigned i; VEC(tree,gc) *file_unemitted_tinfo_decls; @@ -1342,6 +1340,9 @@ pph_read_file_contents (pph_stream *stream) for (i = 0; VEC_iterate (tree, file_unemitted_tinfo_decls, i, t); i++) VEC_safe_push (tree, gc, unemitted_tinfo_decls, t); + file_static_aggregates = pph_in_tree (stream); + static_aggregates = chainon (file_static_aggregates, static_aggregates); + /* Expand all the functions with bodies that we read from STREAM. */ for (i = 0; VEC_iterate (tree, stream->fns_to_expand, i, fndecl); i++) { diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c index acc0352..abe05a2 100644 --- a/gcc/cp/pph-streamer-out.c +++ b/gcc/cp/pph-streamer-out.c @@ -1202,6 +1202,7 @@ pph_write_file_contents (pph_stream *stream, cpp_idents_used *idents_used) pph_dump_namespace (pph_logfile, global_namespace); pph_out_tree (stream, keyed_classes, false); pph_out_tree_vec (stream, unemitted_tinfo_decls, false); + pph_out_tree (stream, static_aggregates, false); } diff --git a/gcc/testsuite/ChangeLog.pph b/gcc/testsuite/ChangeLog.pph index 530adb5..da45f01 100644 --- a/gcc/testsuite/ChangeLog.pph +++ b/gcc/testsuite/ChangeLog.pph @@ -1,3 +1,7 @@ +2011-07-05 Diego Novillo + + * g++.dg/pph/x2nontrivinit.cc: Mark fixed. + 2011-07-04 Diego Novillo * g++.dg/pph/pph.map: Sort. diff --git a/gcc/testsuite/g++.dg/pph/x2nontrivinit.cc b/gcc/testsuite/g++.dg/pph/x2nontrivinit.cc index b142ac2..96ecce2 100644 --- a/gcc/testsuite/g++.dg/pph/x2nontrivinit.cc +++ b/gcc/testsuite/g++.dg/pph/x2nontrivinit.cc @@ -1,3 +1 @@ -// pph asm xdiff - #include "x2nontrivinit.h"