Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226228/?format=api
{ "id": 2226228, "url": "http://patchwork.ozlabs.org/api/patches/2226228/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.9@forge-stage.sourceware.org/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.9@forge-stage.sourceware.org>", "list_archive_url": null, "date": "2026-04-22T10:25:18", "name": "[v1,09/12] libstdc++: Remove _Equality base class from _Hashtable", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ed4cad27dcc996ef92eb8dc3f6ac033f1f98bb9f", "submitter": { "id": 93210, "url": "http://patchwork.ozlabs.org/api/people/93210/?format=api", "name": "Jonathan Wakely via Sourceware Forge", "email": "forge-bot+redi@forge-stage.sourceware.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.9@forge-stage.sourceware.org/mbox/", "series": [ { "id": 500966, "url": "http://patchwork.ozlabs.org/api/series/500966/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500966", "date": "2026-04-22T10:25:11", "name": "WIP: libstdc++: Refactor hash table code", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500966/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226228/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226228/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org", "sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org", "server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0wp73DCRz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 20:44:31 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id CF13543E2156\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 10:44:28 +0000 (GMT)", "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 1FC4E4BBCDCC\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:26:18 +0000 (GMT)", "from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id 3182E405A8\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:26:15 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org CF13543E2156", "OpenDKIM Filter v2.11.0 sourceware.org 1FC4E4BBCDCC" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 1FC4E4BBCDCC", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 1FC4E4BBCDCC", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776853578; cv=none;\n b=iAJZQLecJLmoKFQVHcZxbYgELmYzN6LQ69vlmGmsTMTvBm8sPenvO0U1zGlOwzaMDDtUmOtYRPd5c2KAnmxXhR9g7ihQz+ab8/ZsSRaErNx+1lblMBQpi9Dh1xQiuQyt+fFF0wf1Us/v5IaYSg3RXm24lQHmb+s6l2pmbOFyPWk=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776853578; c=relaxed/simple;\n bh=j0N3ZFp7ixkg48aNGdLUHQXmsc2juJW2sqAEFRy1bww=;\n h=From:Date:Subject:To:Message-ID;\n b=RGVYbXQFdPSf9PrhevSd1Q6+WsG95f1jQra6x5U2Ayo52MIbIUGKPp5h0pM4VGhQSkDF+y2qhn+YTehdqzNqpxBx0ef955WMoadDIjN+96ADgW3b1fPo5qkQPdamkrGQG1tGAtyOrAv5ZAHqvn2IG4l9MAnNG1PUeLAeAI7FcwA=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "From": "Jonathan Wakely via Sourceware Forge\n <forge-bot+redi@forge-stage.sourceware.org>", "Date": "Wed, 22 Apr 2026 10:25:18 +0000", "Subject": "[PATCH v1 09/12] libstdc++: Remove _Equality base class from\n _Hashtable", "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>", "Message-ID": "\n <bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.9@forge-stage.sourceware.org>", "X-Mailer": "batrachomyomachia", "X-Requested-Reviewer": "fdumont", "X-Pull-Request-Organization": "gcc", "X-Pull-Request-Repository": "gcc-TEST", "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/15", "References": "\n <bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.0@forge-stage.sourceware.org>", "In-Reply-To": "\n <bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.0@forge-stage.sourceware.org>", "X-Patch-URL": "\n https://forge.sourceware.org/redi/gcc/commit/d6efb153d00fa8f12da0c50025022dcb90c91394", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Reply-To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>, redi@gcc.gnu.org", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "From: Jonathan Wakely <jwakely@redhat.com>\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/hashtable.h (_Hashtable): Remove _Equality base\n\tclass.\n\t(_Hashtable::_M_equal): Define equality comparison here instead\n\tof in _Equality::_M_equal.\n\t* include/bits/hashtable_policy.h (_Equality): Remove.\n---\n libstdc++-v3/include/bits/hashtable.h | 111 +++++++++++---\n libstdc++-v3/include/bits/hashtable_policy.h | 147 -------------------\n 2 files changed, 94 insertions(+), 164 deletions(-)", "diff": "diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h\nindex 9db568a1f633..7b0a684a2d29 100644\n--- a/libstdc++-v3/include/bits/hashtable.h\n+++ b/libstdc++-v3/include/bits/hashtable.h\n@@ -168,8 +168,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n * not throw and this is enforced by a static assertion.\n *\n * Functionality is implemented by decomposition into base classes,\n- * where the derived _Hashtable class is used in _Map_base,\n- * _Rehash_base, and _Equality base classes to access the\n+ * where the derived _Hashtable class is used in _Map_base and\n+ * _Rehash_base base classes to access the\n * \"this\" pointer. _Hashtable_base is used in the base classes as a\n * non-recursive, fully-completed-type so that detailed nested type\n * information, such as iterator type and node type, can be\n@@ -181,7 +181,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n * - __detail::_Hashtable_base\n * - __detail::_Map_base\n * - __detail::_Rehash_base\n- * - __detail::_Equality\n */\n template<typename _Key, typename _Value, typename _Alloc,\n \t typename _ExtractKey, typename _Equal,\n@@ -196,9 +195,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n public __detail::_Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n \t\t\t\t _Hash, _RangeHash, _Unused,\n \t\t\t\t _RehashPolicy, _Traits>,\n- public __detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n-\t\t\t\t _Hash, _RangeHash, _Unused,\n-\t\t\t\t _RehashPolicy, _Traits>,\n private __detail::_Hashtable_alloc<\n \t__alloc_rebind<_Alloc,\n \t\t __detail::_Hash_node<_Value,\n@@ -293,10 +289,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t\t\t\t\t\t _Hash, _RangeHash, _Unused,\n \t\t\t\t\t\t _RehashPolicy, _Traits>;\n \n- using __eq_base = __detail::_Equality<_Key, _Value, _Alloc, _ExtractKey,\n-\t\t\t\t\t _Equal, _Hash, _RangeHash, _Unused,\n-\t\t\t\t\t _RehashPolicy, _Traits>;\n-\n using __node_builder_t = __detail::_NodeBuilder<_ExtractKey>;\n \n // Simple RAII type for managing a node containing an element\n@@ -353,13 +345,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t bool _Unique_keysa>\n \tfriend struct __detail::_Map_base;\n \n- template<typename _Keya, typename _Valuea, typename _Alloca,\n-\t typename _ExtractKeya, typename _Equala,\n-\t typename _Hasha, typename _RangeHasha, typename _Unuseda,\n-\t typename _RehashPolicya, typename _Traitsa,\n-\t bool _Unique_keysa>\n-\tfriend struct __detail::_Equality;\n-\n public:\n using size_type = typename __hashtable_base::size_type;\n using difference_type = typename __hashtable_base::difference_type;\n@@ -1300,6 +1285,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t}\n #endif // C++17 __glibcxx_node_extract\n \n+ bool\n+ _M_equal(const _Hashtable& __other) const;\n+\n private:\n // Helper rehash method used when keys are unique.\n void _M_rehash(size_type __bkt_count, true_type __uks);\n@@ -2798,6 +2786,95 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n _M_buckets = __new_buckets;\n }\n \n+#pragma GCC diagnostic push\n+#pragma GCC diagnostic ignored \"-Wc++17-extensions\" // if constexpr\n+\n+ // This is for implementing equality comparison for unordered containers,\n+ // per N3068, by John Lakos and Pablo Halpern.\n+ // Algorithmically, we follow closely the reference implementations therein.\n+ template<typename _Key, typename _Value, typename _Alloc,\n+\t typename _ExtractKey, typename _Equal,\n+\t typename _Hash, typename _RangeHash, typename _Unused,\n+\t typename _RehashPolicy, typename _Traits>\n+ bool\n+ _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n+\t _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::\n+ _M_equal(const _Hashtable& __other) const\n+ {\n+ if (size() != __other.size())\n+\treturn false;\n+\n+ if constexpr (__unique_keys::value)\n+\tfor (auto __x_n = _M_begin(); __x_n; __x_n = __x_n->_M_next())\n+\t {\n+\t std::size_t __ybkt = __other._M_bucket_index(*__x_n);\n+\t auto __prev_n = __other._M_buckets[__ybkt];\n+\t if (!__prev_n)\n+\t return false;\n+\n+\t for (__node_ptr __n = static_cast<__node_ptr>(__prev_n->_M_nxt);;\n+\t\t __n = __n->_M_next())\n+\t {\n+\t\tif (__n->_M_v() == __x_n->_M_v())\n+\t\t break;\n+\n+\t\tif (!__n->_M_nxt\n+\t\t || __other._M_bucket_index(*__n->_M_next()) != __ybkt)\n+\t\t return false;\n+\t }\n+\t }\n+ else // non-unique keys\n+\tfor (auto __x_n = _M_begin(); __x_n;)\n+\t {\n+\t std::size_t __x_count = 1;\n+\t auto __x_n_end = __x_n->_M_next();\n+\t for (; __x_n_end\n+\t\t && key_eq()(_ExtractKey{}(__x_n->_M_v()),\n+\t\t\t _ExtractKey{}(__x_n_end->_M_v()));\n+\t\t __x_n_end = __x_n_end->_M_next())\n+\t ++__x_count;\n+\n+\t std::size_t __ybkt = __other._M_bucket_index(*__x_n);\n+\t auto __y_prev_n = __other._M_buckets[__ybkt];\n+\t if (!__y_prev_n)\n+\t return false;\n+\n+\t __node_ptr __y_n = static_cast<__node_ptr>(__y_prev_n->_M_nxt);\n+\t for (;;)\n+\t {\n+\t\tif (key_eq()(_ExtractKey{}(__y_n->_M_v()),\n+\t\t\t _ExtractKey{}(__x_n->_M_v())))\n+\t\t break;\n+\n+\t\tauto __y_ref_n = __y_n;\n+\t\tfor (__y_n = __y_n->_M_next(); __y_n; __y_n = __y_n->_M_next())\n+\t\t if (!__other._M_node_equals(*__y_ref_n, *__y_n))\n+\t\t break;\n+\n+\t\tif (!__y_n || __other._M_bucket_index(*__y_n) != __ybkt)\n+\t\t return false;\n+\t }\n+\n+\t auto __y_n_end = __y_n;\n+\t for (; __y_n_end; __y_n_end = __y_n_end->_M_next())\n+\t if (--__x_count == 0)\n+\t\tbreak;\n+\n+\t if (__x_count != 0)\n+\t return false;\n+\n+\t const_iterator __itx(__x_n), __itx_end(__x_n_end);\n+\t const_iterator __ity(__y_n);\n+\t if (!std::is_permutation(__itx, __itx_end, __ity))\n+\t return false;\n+\n+\t __x_n = __x_n_end;\n+\t }\n+\n+ return true;\n+ }\n+#pragma GCC diagnostic pop\n+\n #if __cplusplus > 201402L\n template<typename, typename, typename> class _Hash_merge_helper { };\n #endif // C++17\ndiff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h\nindex 3fd85bff01d5..c3d89a1101c6 100644\n--- a/libstdc++-v3/include/bits/hashtable_policy.h\n+++ b/libstdc++-v3/include/bits/hashtable_policy.h\n@@ -1568,153 +1568,6 @@ namespace __detail\n _M_eq() const { return _EqualEBO::_M_cget(); }\n };\n \n- /**\n- * Primary class template _Equality.\n- *\n- * This is for implementing equality comparison for unordered\n- * containers, per N3068, by John Lakos and Pablo Halpern.\n- * Algorithmically, we follow closely the reference implementations\n- * therein.\n- */\n- template<typename _Key, typename _Value, typename _Alloc,\n-\t typename _ExtractKey, typename _Equal,\n-\t typename _Hash, typename _RangeHash, typename _Unused,\n-\t typename _RehashPolicy, typename _Traits,\n-\t bool _Unique_keys = _Traits::__unique_keys::value>\n- struct _Equality;\n-\n- /// unordered_map and unordered_set specializations.\n- template<typename _Key, typename _Value, typename _Alloc,\n-\t typename _ExtractKey, typename _Equal,\n-\t typename _Hash, typename _RangeHash, typename _Unused,\n-\t typename _RehashPolicy, typename _Traits>\n- struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n-\t\t _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>\n- {\n- using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n-\t\t\t\t _Hash, _RangeHash, _Unused,\n-\t\t\t\t _RehashPolicy, _Traits>;\n-\n- bool\n- _M_equal(const __hashtable&) const;\n- };\n-\n- template<typename _Key, typename _Value, typename _Alloc,\n-\t typename _ExtractKey, typename _Equal,\n-\t typename _Hash, typename _RangeHash, typename _Unused,\n-\t typename _RehashPolicy, typename _Traits>\n- bool\n- _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n-\t _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, true>::\n- _M_equal(const __hashtable& __other) const\n- {\n- using __node_ptr = typename __hashtable::__node_ptr;\n- const __hashtable* __this = static_cast<const __hashtable*>(this);\n- if (__this->size() != __other.size())\n-\treturn false;\n-\n- for (auto __x_n = __this->_M_begin(); __x_n; __x_n = __x_n->_M_next())\n-\t{\n-\t std::size_t __ybkt = __other._M_bucket_index(*__x_n);\n-\t auto __prev_n = __other._M_buckets[__ybkt];\n-\t if (!__prev_n)\n-\t return false;\n-\n-\t for (__node_ptr __n = static_cast<__node_ptr>(__prev_n->_M_nxt);;\n-\t __n = __n->_M_next())\n-\t {\n-\t if (__n->_M_v() == __x_n->_M_v())\n-\t\tbreak;\n-\n-\t if (!__n->_M_nxt\n-\t\t || __other._M_bucket_index(*__n->_M_next()) != __ybkt)\n-\t\treturn false;\n-\t }\n-\t}\n-\n- return true;\n- }\n-\n- /// unordered_multiset and unordered_multimap specializations.\n- template<typename _Key, typename _Value, typename _Alloc,\n-\t typename _ExtractKey, typename _Equal,\n-\t typename _Hash, typename _RangeHash, typename _Unused,\n-\t typename _RehashPolicy, typename _Traits>\n- struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n-\t\t _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, false>\n- {\n- using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n-\t\t\t\t _Hash, _RangeHash, _Unused,\n-\t\t\t\t _RehashPolicy, _Traits>;\n-\n- bool\n- _M_equal(const __hashtable&) const;\n- };\n-\n- template<typename _Key, typename _Value, typename _Alloc,\n-\t typename _ExtractKey, typename _Equal,\n-\t typename _Hash, typename _RangeHash, typename _Unused,\n-\t typename _RehashPolicy, typename _Traits>\n- bool\n- _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal,\n-\t _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits, false>::\n- _M_equal(const __hashtable& __other) const\n- {\n- using __node_ptr = typename __hashtable::__node_ptr;\n- using const_iterator = typename __hashtable::const_iterator;\n- const __hashtable* __this = static_cast<const __hashtable*>(this);\n- if (__this->size() != __other.size())\n-\treturn false;\n-\n- for (auto __x_n = __this->_M_begin(); __x_n;)\n-\t{\n-\t std::size_t __x_count = 1;\n-\t auto __x_n_end = __x_n->_M_next();\n-\t for (; __x_n_end\n-\t\t && __this->key_eq()(_ExtractKey{}(__x_n->_M_v()),\n-\t\t\t\t _ExtractKey{}(__x_n_end->_M_v()));\n-\t __x_n_end = __x_n_end->_M_next())\n-\t ++__x_count;\n-\n-\t std::size_t __ybkt = __other._M_bucket_index(*__x_n);\n-\t auto __y_prev_n = __other._M_buckets[__ybkt];\n-\t if (!__y_prev_n)\n-\t return false;\n-\n-\t __node_ptr __y_n = static_cast<__node_ptr>(__y_prev_n->_M_nxt);\n-\t for (;;)\n-\t {\n-\t if (__this->key_eq()(_ExtractKey{}(__y_n->_M_v()),\n-\t\t\t\t _ExtractKey{}(__x_n->_M_v())))\n-\t\tbreak;\n-\n-\t auto __y_ref_n = __y_n;\n-\t for (__y_n = __y_n->_M_next(); __y_n; __y_n = __y_n->_M_next())\n-\t\tif (!__other._M_node_equals(*__y_ref_n, *__y_n))\n-\t\t break;\n-\n-\t if (!__y_n || __other._M_bucket_index(*__y_n) != __ybkt)\n-\t\treturn false;\n-\t }\n-\n-\t auto __y_n_end = __y_n;\n-\t for (; __y_n_end; __y_n_end = __y_n_end->_M_next())\n-\t if (--__x_count == 0)\n-\t break;\n-\n-\t if (__x_count != 0)\n-\t return false;\n-\n-\t const_iterator __itx(__x_n), __itx_end(__x_n_end);\n-\t const_iterator __ity(__y_n);\n-\t if (!std::is_permutation(__itx, __itx_end, __ity))\n-\t return false;\n-\n-\t __x_n = __x_n_end;\n-\t}\n- return true;\n- }\n-\n /**\n * This type deals with all allocation and keeps an allocator instance\n * through inheritance to benefit from EBO when possible.\n", "prefixes": [ "v1", "09/12" ] }