Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2034)

Issue 5544085: [pph] Fix marking of in-memory streams (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 3 months ago by Diego Novillo
Modified:
13 years, 1 month ago
Reviewers:
CC:
Lawrence Crowl, gcc-patches_gcc.gnu.org
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -7 lines) Patch
M gcc/cp/ChangeLog.pph View 1 chunk +5 lines, -0 lines 0 comments Download
M gcc/cp/pph-core.c View 1 chunk +4 lines, -0 lines 0 comments Download
M gcc/cp/pph-in.c View 2 chunks +2 lines, -7 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
13 years, 3 months ago (2012-01-17 15:18:34 UTC) #1
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  <dnovillo@google.com>
+
+	* 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  <dnovillo@google.com>
 
 	* 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);
 }
-- 
1.7.7.3


--
This patch is available for review at http://codereview.appspot.com/5544085
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b