This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Add comments to some string pool PCH routines


I thought these probably should have some more comments.

Tested with 'make quickstrap' on powerpc-darwin.

===File ~/patches/gcc-stringpoolcomment.patch===============
2004-05-28  Geoffrey Keating  <geoffk@apple.com>

	* stringpool.c: Add comments to PCH saving/restoring routines.

*** stringpool.c.~1.23.~	Wed May 26 14:18:55 2004
--- stringpool.c	Fri May 28 14:28:09 2004
***************
*** 146,152 ****
  {
    ht_dump_statistics (ident_hash);
  }
! 
  /* Mark an identifier for GC.  */
  
  static int
--- 146,152 ----
  {
    ht_dump_statistics (ident_hash);
  }
! 
  /* Mark an identifier for GC.  */
  
  static int
***************
*** 193,201 ****
  {
    gt_pch_note_object ((void *)x, (void *)x, &gt_pch_p_S);
  }
! 
  /* Handle saving and restoring the string pool for PCH.  */
  
  struct string_pool_data GTY(())
  {
    tree * GTY((length ("%h.nslots"))) entries;
--- 193,204 ----
  {
    gt_pch_note_object ((void *)x, (void *)x, &gt_pch_p_S);
  }
! 
  /* Handle saving and restoring the string pool for PCH.  */
  
+ /* SPD is saved in the PCH file and holds the information needed
+    to restore the string pool.  */
+ 
  struct string_pool_data GTY(())
  {
    tree * GTY((length ("%h.nslots"))) entries;
***************
*** 205,210 ****
--- 208,216 ----
  
  static GTY(()) struct string_pool_data * spd;
  
+ /* Copy HP into the corresponding entry in HT2, and then clear
+    the cpplib parts of HP.  */
+ 
  static int
  ht_copy_and_clear (cpp_reader *r ATTRIBUTE_UNUSED, hashnode hp, const void *ht2_p)
  {
***************
*** 227,234 ****
--- 233,247 ----
    return 1;
  }
  
+ /* The hash table as it was before gt_pch_save_stringpool was called.  */
+ 
  static struct ht *saved_ident_hash;
  
+ /* The hash table contains pointers to the cpp_hashnode inside the
+    lang_identifier.  The PCH machinery can't handle pointers that refer
+    to the inside of an object, so to save the hash table for PCH the
+    pointers are adjusted and stored in the variable SPD.  */
+ 
  void
  gt_pch_save_stringpool (void)
  {
***************
*** 249,254 ****
--- 262,270 ----
    ht_forall (ident_hash, ht_copy_and_clear, saved_ident_hash);
  }
  
+ /* Return the stringpool to its state before gt_pch_save_stringpool
+    was called.  */
+ 
  void
  gt_pch_fixup_stringpool (void)
  {
***************
*** 256,261 ****
--- 272,280 ----
    ht_destroy (saved_ident_hash);
    saved_ident_hash = 0;
  }
+ 
+ /* A PCH file has been restored, which loaded SPD; fill the real hash table
+    with adjusted pointers from SPD.  */
  
  void
  gt_pch_restore_stringpool (void)
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]