diff options
author | Geoffrey Keating <geoffk@apple.com> | 2004-05-28 21:41:42 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2004-05-28 21:41:42 +0000 |
commit | 4bb4ae964aaf3ef1dd86d2b595a022a9961aee5b (patch) | |
tree | 9af1763376fdecf50a07b197c0ceaf66f27f32b8 | |
parent | 711e31876fc9c16f921891603abd8fd4c2f26857 (diff) | |
download | gcc-4bb4ae964aaf3ef1dd86d2b595a022a9961aee5b.zip gcc-4bb4ae964aaf3ef1dd86d2b595a022a9961aee5b.tar.gz gcc-4bb4ae964aaf3ef1dd86d2b595a022a9961aee5b.tar.bz2 |
* stringpool.c: Add comments to PCH saving/restoring routines.
From-SVN: r82380
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/stringpool.c | 23 |
2 files changed, 25 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f7f078..1fa48e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2004-05-28 Geoffrey Keating <geoffk@apple.com> + + * stringpool.c: Add comments to PCH saving/restoring routines. + 2004-05-28 Andrew Pinski <pinskia@physics.uc.edu> * c-common.c (c_estimate_num_insns_1): Kill. diff --git a/gcc/stringpool.c b/gcc/stringpool.c index 3592d4e..781518b 100644 --- a/gcc/stringpool.c +++ b/gcc/stringpool.c @@ -146,7 +146,7 @@ stringpool_statistics (void) { ht_dump_statistics (ident_hash); } - + /* Mark an identifier for GC. */ static int @@ -193,9 +193,12 @@ gt_pch_n_S (const void *x) { gt_pch_note_object ((void *)x, (void *)x, >_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,6 +208,9 @@ struct string_pool_data GTY(()) 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,8 +233,15 @@ ht_copy_and_clear (cpp_reader *r ATTRIBUTE_UNUSED, hashnode hp, const void *ht2_ 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,6 +262,9 @@ gt_pch_save_stringpool (void) 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) { @@ -257,6 +273,9 @@ gt_pch_fixup_stringpool (void) 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) { |