From patchwork Fri Jun 24 23:13:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gab Charette X-Patchwork-Id: 101924 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 1686AB6F70 for ; Sat, 25 Jun 2011 09:13:44 +1000 (EST) Received: (qmail 18708 invoked by alias); 24 Jun 2011 23:13:41 -0000 Received: (qmail 18700 invoked by uid 22791); 24 Jun 2011 23:13:40 -0000 X-SWARE-Spam-Status: No, hits=-1.4 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; Fri, 24 Jun 2011 23:13:25 +0000 Received: from wpaz24.hot.corp.google.com (wpaz24.hot.corp.google.com [172.24.198.88]) by smtp-out.google.com with ESMTP id p5ONDMC7025894; Fri, 24 Jun 2011 16:13:23 -0700 Received: from gchare.mtv.corp.google.com (gchare.mtv.corp.google.com [172.18.111.122]) by wpaz24.hot.corp.google.com with ESMTP id p5ONDLQ1006419; Fri, 24 Jun 2011 16:13:21 -0700 Received: by gchare.mtv.corp.google.com (Postfix, from userid 138564) id D05F61C0DAE; Fri, 24 Jun 2011 16:13:20 -0700 (PDT) To: reply@codereview.appspotmail.com, crowl@google.com, dnovillo@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Stream chain of struct fields (issue4631072) Message-Id: <20110624231320.D05F61C0DAE@gchare.mtv.corp.google.com> Date: Fri, 24 Jun 2011 16:13:20 -0700 (PDT) From: gchare@google.com (Gabriel Charette) 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 We were only streaming the first field of every struct. Struct fields have a chain link to the next field, thus we need to stream the DECL_CHAIN of every field as well recursively. I limited this to VAR_DECL and FUNCTION_DECL for now (which fixes all of our current bugs in regards to the struct fields issues), are there any other DECLs that can potentially be fields of a struct? I was tempted to stream the DECL_CHAIN for the whole "group" VAR_DECL belongs to in pph_read_tree, but as it turns out we don't want to do this for NAMESPACE_DECL as it gets a new chain link when re-added to the bindings early on and changing it here causes an ICE in one of the test cases. Hence, I reverted to the conservative way of only streaming it for what we know we need it for. Syntax-wise: Is it ok to play this 'case' fall through trick with VAR_DECL or should I make a separate case entry with it's own break? 2011-06-24 Gabriel Charette * gcc/cp/pph-streamer-in.c (pph_read_tree): Stream in DECL_CHAIN of VAR_DECL. Stream in DECL_CHAIN of FUNCTION_DECL. * gcc/cp/pph-streamer-out.c (pph_write_tree): Stream out DECL_CHAIN of VAR_DECL. Stream out DECL_CHAIN of FUNCTION_DECL. * gcc/testsuite/g++.dg/pph/x1functions.cc: Fixed bogus, now asm diff. * gcc/testsuite/g++.dg/pph/x1variables.cc: Fixed bogus, now asm diff. --- This patch is available for review at http://codereview.appspot.com/4631072 diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c index 0e6763f..8d12839 100644 --- a/gcc/cp/pph-streamer-in.c +++ b/gcc/cp/pph-streamer-in.c @@ -1216,12 +1216,13 @@ pph_read_tree (struct lto_input_block *ib ATTRIBUTE_UNUSED, DECL_INITIAL (expr) = pph_in_tree (stream); break; + case VAR_DECL: + DECL_CHAIN (expr) = pph_in_tree (stream); case CONST_DECL: case FIELD_DECL: case NAMESPACE_DECL: case PARM_DECL: case USING_DECL: - case VAR_DECL: /* FIXME pph: Should we merge DECL_INITIAL into lang_specific? */ DECL_INITIAL (expr) = pph_in_tree (stream); pph_in_lang_specific (stream, expr); @@ -1232,6 +1233,7 @@ pph_read_tree (struct lto_input_block *ib ATTRIBUTE_UNUSED, pph_in_lang_specific (stream, expr); DECL_SAVED_TREE (expr) = pph_in_tree (stream); DECL_STRUCT_FUNCTION (expr) = pph_in_struct_function (stream); + DECL_CHAIN (expr) = pph_in_tree (stream); break; case TYPE_DECL: diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c index 613cdcd..e85a629 100644 --- a/gcc/cp/pph-streamer-out.c +++ b/gcc/cp/pph-streamer-out.c @@ -1062,12 +1062,13 @@ pph_write_tree (struct output_block *ob, tree expr, bool ref_p) pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3); break; + case VAR_DECL: + pph_out_tree_or_ref_1 (stream, DECL_CHAIN (expr), ref_p, 3); case CONST_DECL: case FIELD_DECL: case NAMESPACE_DECL: case PARM_DECL: case USING_DECL: - case VAR_DECL: /* FIXME pph: Should we merge DECL_INITIAL into lang_specific? */ pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3); pph_out_lang_specific (stream, expr, ref_p); @@ -1078,6 +1079,7 @@ pph_write_tree (struct output_block *ob, tree expr, bool ref_p) pph_out_lang_specific (stream, expr, ref_p); pph_out_tree_or_ref_1 (stream, DECL_SAVED_TREE (expr), ref_p, 3); pph_out_struct_function (stream, DECL_STRUCT_FUNCTION (expr), ref_p); + pph_out_tree_or_ref_1 (stream, DECL_CHAIN (expr), ref_p, 3); break; case TYPE_DECL: diff --git a/gcc/testsuite/g++.dg/pph/x1functions.cc b/gcc/testsuite/g++.dg/pph/x1functions.cc index 20cde5c..78df01b 100644 --- a/gcc/testsuite/g++.dg/pph/x1functions.cc +++ b/gcc/testsuite/g++.dg/pph/x1functions.cc @@ -1,5 +1,4 @@ -// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-bogus "'mbr_decl_inline' was not declared in this scope" "" { xfail *-*-* } 0 } +// pph asm xdiff #include "x1functions.h" diff --git a/gcc/testsuite/g++.dg/pph/x1variables.cc b/gcc/testsuite/g++.dg/pph/x1variables.cc index bac3136..0f0814f 100644 --- a/gcc/testsuite/g++.dg/pph/x1variables.cc +++ b/gcc/testsuite/g++.dg/pph/x1variables.cc @@ -1,6 +1,4 @@ -// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-bogus "c1variables.h:5:8: error: 'int D::mbr_uninit_plain' is not a static member of 'struct D'" "" { xfail *-*-* } 0 } -// { dg-bogus "c1variables.h:6:14: error: 'const int D::mbr_init_const' is not a static member of 'struct D'" "" { xfail *-*-* } 0 } +// pph asm xdiff #include "x1variables.h"