[PING^3] Generalize 'gcc/input.h:struct location_hash' (was: [Committed] [PATCH 2/4] (v4) On-demand locations within string-literals)
Commit Message
Hi!
On 2021-09-17T13:16:14+0200, I wrote:
> On 2021-09-10T09:48:56+0200, I wrote:
>> Ping. My patches again attached, for easy reference.
>
> Ping once again.
Jeff had ACKed "Don't record string concatenation data for
'RESERVED_LOCATION_P'" (thanks!), but "Generalize 'gcc/input.h:struct
location_hash'" is still awaiting review:
>> On 2021-09-03T18:33:37+0200, I wrote:
>>> On 2021-09-02T21:09:54+0200, I wrote:
>>>> On 2021-09-02T15:59:14+0200, I wrote:
>>>>> On 2016-08-05T14:16:58-0400, David Malcolm <dmalcolm@redhat.com> wrote:
>>>>>> Committed to trunk as r239175; I'm attaching the final version of the
>>>>>> patch for reference.
>>>>>
>>>>> David, you've added here 'gcc/input.h:struct location_hash' (see quoted
>>>>> below), which will be useful elsewhere, so:
>>>>>> --- a/gcc/input.h
>>>>>> +++ b/gcc/input.h
>>>>>
>>>>>> +struct location_hash : int_hash <location_t, UNKNOWN_LOCATION> { };
>>>>>> +
>>>>>> +class GTY(()) string_concat_db
>>>>>> +{
>>>>>> +[...]
>>>>>> + hash_map <location_hash, string_concat *> *m_table;
>>>>>> +};
>>>>>
>>>>> OK to push the attached
>>>>> "Generalize 'gcc/input.h:struct location_hash'"?
Attached again, for easy reference.
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
Comments
On 9/30/2021 12:47 AM, Thomas Schwinge wrote:
> Hi!
>
> On 2021-09-17T13:16:14+0200, I wrote:
>> On 2021-09-10T09:48:56+0200, I wrote:
>>> Ping. My patches again attached, for easy reference.
>> Ping once again.
> Jeff had ACKed "Don't record string concatenation data for
> 'RESERVED_LOCATION_P'" (thanks!), but "Generalize 'gcc/input.h:struct
> location_hash'" is still awaiting review:
>
>>> On 2021-09-03T18:33:37+0200, I wrote:
>>>> On 2021-09-02T21:09:54+0200, I wrote:
>>>>> On 2021-09-02T15:59:14+0200, I wrote:
>>>>>> On 2016-08-05T14:16:58-0400, David Malcolm <dmalcolm@redhat.com> wrote:
>>>>>>> Committed to trunk as r239175; I'm attaching the final version of the
>>>>>>> patch for reference.
>>>>>> David, you've added here 'gcc/input.h:struct location_hash' (see quoted
>>>>>> below), which will be useful elsewhere, so:
>>>>>>> --- a/gcc/input.h
>>>>>>> +++ b/gcc/input.h
>>>>>>> +struct location_hash : int_hash <location_t, UNKNOWN_LOCATION> { };
>>>>>>> +
>>>>>>> +class GTY(()) string_concat_db
>>>>>>> +{
>>>>>>> +[...]
>>>>>>> + hash_map <location_hash, string_concat *> *m_table;
>>>>>>> +};
>>>>>> OK to push the attached
>>>>>> "Generalize 'gcc/input.h:struct location_hash'"?
> Attached again, for easy reference.
>
>
> Grüße
> Thomas
>
>
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
>
> 0002-Generalize-gcc-input.h-struct-location_hash.patch
>
> From 349a3172f64db93ee98ea39b36489b702b6596ab Mon Sep 17 00:00:00 2001
> From: Thomas Schwinge <thomas@codesourcery.com>
> Date: Tue, 31 Aug 2021 23:30:25 +0200
> Subject: [PATCH 2/2] Generalize 'gcc/input.h:struct location_hash'
>
> This is currently only used here ('gcc/input.h:class string_concat_db'), but is
> actually generally useful, so advertize it as such.
>
> Per the rationale given, we may use 'BUILTINS_LOCATION' as spare value for
> 'Deleted', in addition to the existing use of 'UNKNOWN_LOCATION' as spare value
> for 'Empty'.
>
> gcc/
> * input.h (location_hash): Use 'BUILTINS_LOCATION' as spare value
> for 'Deleted'. Turn into a '#define'.
OK
jeff
Hi!
On 2021-10-17T16:33:03-0600, Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> On 9/30/2021 12:47 AM, Thomas Schwinge wrote:
>> On 2021-09-17T13:16:14+0200, I wrote:
>>> On 2021-09-10T09:48:56+0200, I wrote:
>>>> On 2021-09-03T18:33:37+0200, I wrote:
>>>>> On 2021-09-02T21:09:54+0200, I wrote:
>>>>>> On 2021-09-02T15:59:14+0200, I wrote:
>>>>>>> On 2016-08-05T14:16:58-0400, David Malcolm <dmalcolm@redhat.com> wrote:
>>>>>>>> Committed to trunk as r239175; I'm attaching the final version of the
>>>>>>>> patch for reference.
>>>>>>> David, you've added here 'gcc/input.h:struct location_hash' (see quoted
>>>>>>> below), which will be useful elsewhere, so:
>>>>>>>> --- a/gcc/input.h
>>>>>>>> +++ b/gcc/input.h
>>>>>>>> +struct location_hash : int_hash <location_t, UNKNOWN_LOCATION> { };
>>>>>>>> +
>>>>>>>> +class GTY(()) string_concat_db
>>>>>>>> +{
>>>>>>>> +[...]
>>>>>>>> + hash_map <location_hash, string_concat *> *m_table;
>>>>>>>> +};
>>>>>>> OK to push the attached
>>>>>>> "Generalize 'gcc/input.h:struct location_hash'"?
> OK
Thanks. With the commentary slightly updated for PR103157 "'gengtype':
'typedef' causing infinite-recursion code to be generated", I've pushed
to master branch commit 088199e5d0fc0d54f48af0783a2630a773bbb387
"Generalize 'gcc/input.h:struct location_hash'", see attached.
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
From 349a3172f64db93ee98ea39b36489b702b6596ab Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 31 Aug 2021 23:30:25 +0200
Subject: [PATCH 2/2] Generalize 'gcc/input.h:struct location_hash'
This is currently only used here ('gcc/input.h:class string_concat_db'), but is
actually generally useful, so advertize it as such.
Per the rationale given, we may use 'BUILTINS_LOCATION' as spare value for
'Deleted', in addition to the existing use of 'UNKNOWN_LOCATION' as spare value
for 'Empty'.
gcc/
* input.h (location_hash): Use 'BUILTINS_LOCATION' as spare value
for 'Deleted'. Turn into a '#define'.
---
gcc/input.h | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
@@ -36,6 +36,25 @@ extern GTY(()) class line_maps *saved_line_table;
both UNKNOWN_LOCATION and BUILTINS_LOCATION fit into that. */
STATIC_ASSERT (BUILTINS_LOCATION < RESERVED_LOCATION_COUNT);
+/* Hasher for 'location_t' values satisfying '!RESERVED_LOCATION_P', thus able
+ to use 'UNKNOWN_LOCATION'/'BUILTINS_LOCATION' as spare values for
+ 'Empty'/'Deleted'. */
+/* If the following is used more than once, 'gengtype' generates duplicate
+ functions (thus: "error: redefinition of 'void gt_ggc_mx(location_hash&)'"
+ etc.):
+
+ struct location_hash
+ : int_hash<location_t, UNKNOWN_LOCATION, BUILTINS_LOCATION> {};
+
+ Likewise for this:
+
+ typedef int_hash<location_t, UNKNOWN_LOCATION, BUILTINS_LOCATION>
+ location_hash;
+
+ Thus, use a plain ol' '#define':
+*/
+#define location_hash int_hash<location_t, UNKNOWN_LOCATION, BUILTINS_LOCATION>
+
extern bool is_location_from_builtin_token (location_t);
extern expanded_location expand_location (location_t);
@@ -230,8 +249,6 @@ public:
location_t * GTY ((atomic)) m_locs;
};
-struct location_hash : int_hash <location_t, UNKNOWN_LOCATION> { };
-
class GTY(()) string_concat_db
{
public:
--
2.33.0