From 843adf8844d4ec43d13dd05f7269cabc7058c027 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 25 Jun 2015 17:06:02 +0000 Subject: gcc/ * hash-traits.h (pointer_hash::mark_deleted, pointer_hash::mark_empty) (pointer_hash::is_deleted, pointer_hash::is_empty): New functions. From-SVN: r224956 --- gcc/ChangeLog | 5 +++++ gcc/hash-traits.h | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 32cecf1..a9220e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2015-06-25 Richard Sandiford + * hash-traits.h (pointer_hash::mark_deleted, pointer_hash::mark_empty) + (pointer_hash::is_deleted, pointer_hash::is_empty): New functions. + +2015-06-25 Richard Sandiford + * hash-traits.h (ggc_hasher::remove): Take a reference parameter. (ggc_hasher::ggc_mx): Likewise. (ggc_cache_hasher): Inherit from ggc_hasher. Remove definitions diff --git a/gcc/hash-traits.h b/gcc/hash-traits.h index 1d1a220..65ed32c 100644 --- a/gcc/hash-traits.h +++ b/gcc/hash-traits.h @@ -66,9 +66,12 @@ struct pointer_hash : typed_noop_remove typedef Type *compare_type; static inline hashval_t hash (const value_type &); - static inline bool equal (const value_type &existing, const compare_type &candidate); + static inline void mark_deleted (Type *&); + static inline void mark_empty (Type *&); + static inline bool is_deleted (Type *); + static inline bool is_empty (Type *); }; template @@ -88,6 +91,34 @@ pointer_hash ::equal (const value_type &existing, return existing == candidate; } +template +inline void +pointer_hash ::mark_deleted (Type *&e) +{ + e = reinterpret_cast (1); +} + +template +inline void +pointer_hash ::mark_empty (Type *&e) +{ + e = NULL; +} + +template +inline bool +pointer_hash ::is_deleted (Type *e) +{ + return e == reinterpret_cast (1); +} + +template +inline bool +pointer_hash ::is_empty (Type *e) +{ + return e == NULL; +} + /* Hasher for entry in gc memory. */ template -- cgit v1.1