From patchwork Wed Jun 29 20:50:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 102663 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 75A96B6F59 for ; Thu, 30 Jun 2011 06:51:05 +1000 (EST) Received: (qmail 4207 invoked by alias); 29 Jun 2011 20:51:02 -0000 Received: (qmail 4193 invoked by uid 22791); 29 Jun 2011 20:51:01 -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) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Jun 2011 20:50:46 +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 p5TKojWb010213; Wed, 29 Jun 2011 13:50:45 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by wpaz24.hot.corp.google.com with ESMTP id p5TKoi9e017271; Wed, 29 Jun 2011 13:50:44 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id CF5281DA1C6; Wed, 29 Jun 2011 16:50:43 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gchare@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Allow DECL_LANG_SPECIFIC to be shared (issue4667049) Message-Id: <20110629205043.CF5281DA1C6@topo.tor.corp.google.com> Date: Wed, 29 Jun 2011 16:50:43 -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 is a patch that Lawrence and I were working on yesterday that I need for my next patch. We were not expecting DECL_LANG_SPECIFIC to be shared, but in fact there are several occasions (thunks, aliases) where it is shared. By itself, this does not fix any tests, but it fixes a problem exposed by the next patch. Tested on x86_64. Committed to the branch. 2011-06-29 Diego Novillo Lawrence Crowl * pph-streamer-in.c (pph_in_lang_specific): Expect shared DECL_LANG_SPECIFIC fields. --- This patch is available for review at http://codereview.appspot.com/4667049 diff --git a/gcc/cp/ChangeLog.pph b/gcc/cp/ChangeLog.pph index a62dd66..9465484 100644 --- a/gcc/cp/ChangeLog.pph +++ b/gcc/cp/ChangeLog.pph @@ -1,4 +1,10 @@ 2011-06-29 Diego Novillo + Lawrence Crowl + + * pph-streamer-in.c (pph_in_lang_specific): Expect shared + DECL_LANG_SPECIFIC fields. + +2011-06-29 Diego Novillo * pph-streamer-in.c (pph_read_tree): Call append_to_statement_list_force instead of append_to_statement_list. diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c index 1a59640..1c71c30 100644 --- a/gcc/cp/pph-streamer-in.c +++ b/gcc/cp/pph-streamer-in.c @@ -881,18 +881,23 @@ pph_in_lang_specific (pph_stream *stream, tree decl) marker = pph_in_start_record (stream, &ix); if (marker == PPH_RECORD_END) return; - - /* Since lang_decl is embedded in every decl, LD cannot - be shared. */ - gcc_assert (marker != PPH_RECORD_SHARED); + else if (marker == PPH_RECORD_SHARED) + { + DECL_LANG_SPECIFIC (decl) = + (struct lang_decl *) pph_in_shared_data (stream, ix); + return; + } /* Allocate a lang_decl structure for DECL. */ retrofit_lang_decl (decl); - ld = DECL_LANG_SPECIFIC (decl); - ldb = &ld->u.base; + + /* Now register it. We would normally use ALLOC_AND_REGISTER, + but retrofit_lang_decl does not return a pointer. */ + pph_register_shared_data (stream, ld, ix); /* Read all the fields in lang_decl_base. */ + ldb = &ld->u.base; pph_in_ld_base (stream, ldb); if (ldb->selector == 0)