public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: gchare@google.com (Gabriel Charette)
To: reply@codereview.appspotmail.com, crowl@google.com,
	dnovillo@google.com,        gcc-patches@gcc.gnu.org
Subject: [pph] Stream first/weak_object_global_name (issue4641086)
Date: Thu, 30 Jun 2011 21:09:00 -0000	[thread overview]
Message-ID: <20110630202408.D5A291C1942@gchare.mtv.corp.google.com> (raw)

first/weak_global_object_name are part of the global state.

This seems to be used to produce the assembler names. They are set only once as early as possible in the parsing; thus we should define it to be whatever it was in the first pph (or even in the C file if it was set before any pph was even loaded.

I'm not sure exactly what this does, but trying to find a fix for the asm diffs this is the first thing that I hit in the compiler logic that was different in the good compiler vs the pph compiler. With this fix this bit of logic is now correct.
However, this doesn't fix any pph test (nor does it even change any pph asm (I diff'ed the old bad assemblies (*.s+pph) with the new ones)).

Tested with bootstrap build and pph regression testing.

2011-06-30  Gabriel Charette  <gchare@google.com>

	* Make-lang.in (pph-streamer-out.o): Add dependence on output.h
	(pph-streamer-in.o): Add dependence on output.h
	* pph-streamer-in.c (pph_read_file_contents): Stream in
	first_global_object_name and weak_global_object_name.
	* gcc/cp/pph-streamer-out.c (pph_write_file_contents): Stream out
	first_global_object_name and weak_global_object_name.

diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 0bb1a15..ec7596a 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -350,8 +350,8 @@ cp/pph-streamer.o: cp/pph-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 cp/pph-streamer-out.o: cp/pph-streamer-out.c $(CONFIG_H) $(SYSTEM_H) \
 	coretypes.h $(TREE_H) tree-pretty-print.h $(LTO_STREAMER_H) \
 	$(CXX_PPH_STREAMER_H) $(CXX_PPH_H) $(TREE_PASS_H) version.h \
-	cppbuiltin.h tree-iterator.h
+	cppbuiltin.h tree-iterator.h output.h
 cp/pph-streamer-in.o: cp/pph-streamer-in.c $(CONFIG_H) $(SYSTEM_H) \
 	coretypes.h $(TREE_H) tree-pretty-print.h $(LTO_STREAMER_H) \
 	$(CXX_PPH_STREAMER_H) $(CXX_PPH_H) $(TREE_PASS_H) version.h \
-	cppbuiltin.h tree-iterator.h
+	cppbuiltin.h tree-iterator.h output.h
diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index 3ac5243..c341d50 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-pass.h"
 #include "version.h"
 #include "cppbuiltin.h"
+#include "output.h"
 
 /* Wrapper for memory allocation calls that should have their results
    registered in the PPH streamer cache.  DATA is the pointer returned
@@ -1309,7 +1310,7 @@ pph_read_file_contents (pph_stream *stream)
 {
   bool verified;
   cpp_ident_use *bad_use;
-  const char *cur_def;
+  const char *cur_def, *pph_fgon, *pph_wgon;
   cpp_idents_used idents_used;
   tree fndecl;
   unsigned i;
@@ -1325,6 +1326,16 @@ pph_read_file_contents (pph_stream *stream)
   /* Re-instantiate all the pre-processor symbols defined by STREAM.  */
   cpp_lt_replay (parse_in, &idents_used);
 
+  /* If first_global_object_name is not set yet, set it to the pph one.  */
+  pph_fgon = pph_in_string (stream);
+  if (!first_global_object_name)
+    first_global_object_name = pph_fgon;
+
+  /* If weak_global_object_name is not set yet, set it to the pph one.  */
+  pph_wgon = pph_in_string (stream);
+  if (!weak_global_object_name)
+    weak_global_object_name = pph_wgon;
+
   /* Read the bindings from STREAM and merge them with the current bindings.  */
   pph_in_scope_chain (stream);
 
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index acc0352..0d29f0b 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-pass.h"
 #include "version.h"
 #include "cppbuiltin.h"
+#include "output.h"
 
 /* FIXME pph.  This holds the FILE handle for the current PPH file
    that we are writing.  It is necessary because the LTO callbacks do
@@ -1197,9 +1198,14 @@ static void
 pph_write_file_contents (pph_stream *stream, cpp_idents_used *idents_used)
 { 
   pph_out_identifiers (stream, idents_used);
+
+  pph_out_string (stream, first_global_object_name);
+  pph_out_string (stream, weak_global_object_name);
+
   pph_out_scope_chain (stream, scope_chain, false);
   if (flag_pph_dump_tree)
     pph_dump_namespace (pph_logfile, global_namespace);
+
   pph_out_tree (stream, keyed_classes, false);
   pph_out_tree_vec (stream, unemitted_tinfo_decls, false);
 }

--
This patch is available for review at http://codereview.appspot.com/4641086

             reply	other threads:[~2011-06-30 20:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-30 21:09 Gabriel Charette [this message]
     [not found] ` <CAD_=9DTSjfGrSQ3v5an0DK02x9PzfeiH7B1bEAKQDngJ++cJBg@mail.gmail.com>
2011-07-01  1:27   ` Gabriel Charette
2011-07-02  1:37 gchare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110630202408.D5A291C1942@gchare.mtv.corp.google.com \
    --to=gchare@google.com \
    --cc=crowl@google.com \
    --cc=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=reply@codereview.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).