From patchwork Tue Jan 17 15:18:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 136491 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 0867BB6EFF for ; Wed, 18 Jan 2012 02:18:53 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1327418334; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=o6pPWiq vqJcZ8XPX9j9XmR/vAsQ=; b=FydBvohHSaQxZ+kh2MEQrHAxOmWk7gBMXZ6ml5E yWCNqwNvJbxDzmiNYxRRYbdA6605T4+J0+sqZFSc957dU6JECg4JjByIQleraCrw FURasH3FbuvxpLDCXUNuUWlS/KEX3EWGp+BKk2Ru4aRbpuOny1jy5mv5xL/Wmiib gt9k= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NYsC1IUIuqWV5/Ru58htAn9ErobNq2GbXG9iDtYYhLokr555yMUXWsZDwwj9RZ 6Sa0Vfh8AGuzgj7M8SDSZo6n275a3vBQL0KTTRnKUYZufDuOaffMg/f8iH/cc2yw sgZZ+Q0lZbs5QD4TYraznh+YZ38EP6qRXT/G29ibCIXQA=; Received: (qmail 7325 invoked by alias); 17 Jan 2012 15:18:49 -0000 Received: (qmail 7316 invoked by uid 22791); 17 Jan 2012 15:18:48 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, TW_SV, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-ey0-f201.google.com (HELO mail-ey0-f201.google.com) (209.85.215.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Jan 2012 15:18:35 +0000 Received: by eaac10 with SMTP id c10so67564eaa.2 for ; Tue, 17 Jan 2012 07:18:34 -0800 (PST) Received: by 10.213.28.6 with SMTP id k6mr550308ebc.11.1326813514454; Tue, 17 Jan 2012 07:18:34 -0800 (PST) Received: by 10.213.28.6 with SMTP id k6mr550296ebc.11.1326813514187; Tue, 17 Jan 2012 07:18:34 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id m16si15092617eei.3.2012.01.17.07.18.34 (version=TLSv1/SSLv3 cipher=AES128-SHA); Tue, 17 Jan 2012 07:18:34 -0800 (PST) Received: from tobiano.tor.corp.google.com (tobiano.tor.corp.google.com [172.29.41.6]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 04A8A20004E; Tue, 17 Jan 2012 07:18:34 -0800 (PST) Received: by tobiano.tor.corp.google.com (Postfix, from userid 54752) id 20853AE1D7; Tue, 17 Jan 2012 10:18:31 -0500 (EST) To: reply@codereview.appspotmail.com, crowl@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Fix marking of in-memory streams (issue5544085) Message-Id: <20120117151831.20853AE1D7@tobiano.tor.corp.google.com> Date: Tue, 17 Jan 2012 10:18:31 -0500 (EST) From: dnovillo@google.com (Diego Novillo) 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 marking STREAM in-memory too late. This was causing repeated attempts to open the same PPH stream more than once. Leading to confusion. * pph-in.c (pph_read_file_1): Move in-memory marking for STREAM... * pph-core.c (pph_stream_register): ... here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/pph@183250 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog.pph | 5 +++++ gcc/cp/pph-core.c | 4 ++++ gcc/cp/pph-in.c | 8 ++------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/cp/ChangeLog.pph b/gcc/cp/ChangeLog.pph index 6d3debe..88bc68f 100644 --- a/gcc/cp/ChangeLog.pph +++ b/gcc/cp/ChangeLog.pph @@ -1,3 +1,8 @@ +2012-01-17 Diego Novillo + + * pph-in.c (pph_read_file_1): Move in-memory marking for STREAM... + * pph-core.c (pph_stream_register): ... here. + 2012-01-16 Diego Novillo * name-lookup.c (pph_set_global_identifier_bindings): Make diff --git a/gcc/cp/pph-core.c b/gcc/cp/pph-core.c index 6d34bd0..9f7f063 100644 --- a/gcc/cp/pph-core.c +++ b/gcc/cp/pph-core.c @@ -953,6 +953,10 @@ pph_stream_register (pph_stream *stream) /* Add a mapping between STREAM's PPH file name and STREAM. */ pph_stream_registry_add_name (stream, stream->name); + + /* Mark this file as being in memory. This prevents opening the + same file more than twice. */ + stream->in_memory_p = true; } diff --git a/gcc/cp/pph-in.c b/gcc/cp/pph-in.c index 6a8fbf8..e9a5563 100644 --- a/gcc/cp/pph-in.c +++ b/gcc/cp/pph-in.c @@ -2839,8 +2839,8 @@ pph_read_file_1 (pph_stream *stream) VEC(tree,gc) *file_unemitted_tinfo_decls; source_location cpp_token_replay_loc; - /* If we have read STREAM before, we do not need to re-read the rest - of its body. We only needed to read its line table. */ + /* If we have opened STREAM before, we do not need to re-read the rest + of its body. */ if (stream->in_memory_p) return; @@ -2890,10 +2890,6 @@ pph_read_file_1 (pph_stream *stream) /* Read and process the symbol table. */ pph_in_symtab (stream); - /* Mark this file as read. If other images need to access its contents, - we will not need to actually read it again. */ - stream->in_memory_p = true; - if (flag_pph_dump_tree) pph_dump_namespace (pph_logfile, global_namespace); }