Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806610/?format=api
{ "id": 806610, "url": "http://patchwork.ozlabs.org/api/patches/806610/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/dde1aa25-42bc-2884-d497-fa87163ce2e1@acm.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": "<dde1aa25-42bc-2884-d497-fa87163ce2e1@acm.org>", "list_archive_url": null, "date": "2017-08-28T14:54:16", "name": "[C++] Move field_vec creation", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d8cc709f293609e8cd6e16fdaad0d6c1347d60ee", "submitter": { "id": 9970, "url": "http://patchwork.ozlabs.org/api/people/9970/?format=api", "name": "Nathan Sidwell", "email": "nathan@acm.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/dde1aa25-42bc-2884-d497-fa87163ce2e1@acm.org/mbox/", "series": [ { "id": 186, "url": "http://patchwork.ozlabs.org/api/series/186/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=186", "date": "2017-08-28T14:54:16", "name": "[C++] Move field_vec creation", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/186/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806610/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806610/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-461021-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461021-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"IlypsuCg\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xgvtv5YBzz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Aug 2017 00:54:46 +1000 (AEST)", "(qmail 66637 invoked by alias); 28 Aug 2017 14:54:38 -0000", "(qmail 66055 invoked by uid 89); 28 Aug 2017 14:54:37 -0000", "from mail-yw0-f176.google.com (HELO mail-yw0-f176.google.com)\n\t(209.85.161.176) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 28 Aug 2017 14:54:26 +0000", "by mail-yw0-f176.google.com with SMTP id t188so3701097ywb.1 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 28 Aug 2017 07:54:25 -0700 (PDT)", "from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254?\n\t([2620:10d:c091:200::1:d19a]) by smtp.googlemail.com with\n\tESMTPSA id n77sm215162ywd.42.2017.08.28.07.54.22\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256\n\tbits=128/128); Mon, 28 Aug 2017 07:54:23 -0700 (PDT)" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:to\n\t:from:subject:message-id:date:mime-version:content-type; q=dns;\n\ts=default; b=HfpddULuYrBoXTune2CH5GPZKPjf+Uc+Mi5OYJv7FYOAjaG8w+\n\tJLnVdRh/FwknXp1xQdjtEyzwQ/EiE93s7Saqn+b3z1OZJFDqnp0T6nlbwzqIPObl\n\tN3T1y1v0cL+WeeDibibFGpJ58RuhiwDtlPIJjK8IA3p4tGMBvrPUU7CwU=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:to\n\t:from:subject:message-id:date:mime-version:content-type; s=\n\tdefault; bh=7zhAH1O4Xf+AeYo9/JqblzcDXqs=; b=IlypsuCg4LgmQX9aa0Z3\n\taHT5AraSIKeCtnXPU3JfoTAToWWLDZkSsOw6zaHGZJi7WAj8IDyvCWRVmcV7azTw\n\tmEdpnluHz8SyosUJ9wxkbgfKPbkS6bXkPuZM3tWbNzSqD9ynPtjatIy89mL+V7xl\n\tj9tYgCTCmZ69QHwFURwoAhs=", "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>", "Sender": "gcc-patches-owner@gcc.gnu.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-15.6 required=5.0 tests=BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=bores", "X-HELO": "mail-yw0-f176.google.com", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:sender:to:from:subject:message-id:date\n\t:user-agent:mime-version:content-language;\n\tbh=ZEq2nnuYxafwPqJ2r55/VZMXW8jlFoz83VUThezjOhA=;\n\tb=fek8fjUQtHXNPW7VcJr5XU12Vlk/HogcxFsl6cJzKLnZNBKrdHPUjUKWRwOW0S5m+w\n\t89JVd79dz3URK+FC6NtjbiP0hnwACgxPcnI2M9428i5pvnSI8hJSYEXwBVwmVTFnC9lL\n\tbjd746S1Amjw8av3LxqLB4QfiCiL+/9yU45c9Aix7bDm2bszF/5C/emprbzVUw+3rh4R\n\tVcWae47ky8/LBb91aVj1txWqqYc2LZXk01YkSE3ULx4upHV3O18x04nJAt4Q+02gKUUE\n\tqi4CCpbHe/FxOILrsVB7QPPjkuKAmmmfYPdY4nw6rZdC+2uayrQstkz5V21qnhyOR6Dy\n\t/vIQ==", "X-Gm-Message-State": "AHYfb5jJN0YOwnBqjC+3FVeenxqtItHUEGlEJDBDDNQ5dGyJAp847i+F\t5GBuaT0+dBUUpA==", "X-Received": "by 10.13.221.21 with SMTP id g21mr781345ywe.392.1503932064332;\n\tMon, 28 Aug 2017 07:54:24 -0700 (PDT)", "To": "GCC Patches <gcc-patches@gcc.gnu.org>", "From": "Nathan Sidwell <nathan@acm.org>", "Subject": "[C++ PATCH] Move field_vec creation", "Message-ID": "<dde1aa25-42bc-2884-d497-fa87163ce2e1@acm.org>", "Date": "Mon, 28 Aug 2017 10:54:16 -0400", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.2.1", "MIME-Version": "1.0", "Content-Type": "multipart/mixed;\n\tboundary=\"------------6D9841F74154825FACDEAEEA\"" }, "content": "this patch moves the FIELD_VEC creation routines from class.c to \nname-lookup.c\n\nIt's slightly more than a simple move as I include the following renaming:\ninsert_into_classtype_sorted_fields -> set_class_bindings\ninsert_late_enum_def_into_classtype_sorted_fields -> \ninsert_late_enum_def_bindings\n\nMost of this should eventually evaporate, as I intend adding the \nbindings progressively during class definition. (and late bindings \nduring their definition). But we'll see how far that gets ...\n\nnathan", "diff": "2017-08-28 Nathan Sidwell <nathan@acm.org>\n\n\t* cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):\n\tDelete.\n\t* name-lookup.h (set_class_bindings,\n\tinsert_late_enum_def_bindings): Declare.\n\t* decl.c (finish_enum_value_list): Adjust for\n\tinsert_late_enum_def_bindings name change.\n\t* class.c (finish_struct_1): Call set_class_bindings.\n\t(count_fields, add_fields_to_record_type,\n\tadd_enum_fields_to_record_type, sorted_fields_type_new,\n\tinsert_into_classtype_sorted_fields,\n\tinsert_late_enum_def_into_classtype_sorted_fields): Move to ...\n\t* name-lookup.h (count_fields, add_fields_to_record_type,\n\tadd_enum_fields_to_record_type, sorted_fields_type_new,\n\tset_class_bindings, insert_late_enum_def_bindings): ... here.\n\nIndex: class.c\n===================================================================\n--- class.c\t(revision 251385)\n+++ class.c\t(working copy)\n@@ -139,9 +139,6 @@ static tree build_simple_base_path (tree\n static tree build_vtbl_ref_1 (tree, tree);\n static void build_vtbl_initializer (tree, tree, tree, tree, int *,\n \t\t\t\t vec<constructor_elt, va_gc> **);\n-static int count_fields (tree);\n-static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);\n-static void insert_into_classtype_sorted_fields (tree, tree, int);\n static bool check_bitfield_decl (tree);\n static bool check_field_decl (tree, tree, int *, int *);\n static void check_field_decls (tree, tree *, int *, int *);\n@@ -3378,61 +3375,6 @@ add_implicitly_declared_members (tree t,\n }\n }\n \n-/* Subroutine of insert_into_classtype_sorted_fields. Recursively\n- count the number of fields in TYPE, including anonymous union\n- members. */\n-\n-static int\n-count_fields (tree fields)\n-{\n- tree x;\n- int n_fields = 0;\n- for (x = fields; x; x = DECL_CHAIN (x))\n- {\n- if (DECL_DECLARES_FUNCTION_P (x))\n-\t/* Functions are dealt with separately. */;\n- else if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))\n-\tn_fields += count_fields (TYPE_FIELDS (TREE_TYPE (x)));\n- else\n-\tn_fields += 1;\n- }\n- return n_fields;\n-}\n-\n-/* Subroutine of insert_into_classtype_sorted_fields. Recursively add\n- all the fields in the TREE_LIST FIELDS to the SORTED_FIELDS_TYPE\n- elts, starting at offset IDX. */\n-\n-static int\n-add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, int idx)\n-{\n- tree x;\n- for (x = fields; x; x = DECL_CHAIN (x))\n- {\n- if (DECL_DECLARES_FUNCTION_P (x))\n-\t/* Functions are handled separately. */;\n- else if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))\n-\tidx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);\n- else\n-\tfield_vec->elts[idx++] = x;\n- }\n- return idx;\n-}\n-\n-/* Add all of the enum values of ENUMTYPE, to the FIELD_VEC elts,\n- starting at offset IDX. */\n-\n-static int\n-add_enum_fields_to_record_type (tree enumtype,\n-\t\t\t\tstruct sorted_fields_type *field_vec,\n-\t\t\t\tint idx)\n-{\n- tree values;\n- for (values = TYPE_VALUES (enumtype); values; values = TREE_CHAIN (values))\n- field_vec->elts[idx++] = TREE_VALUE (values);\n- return idx;\n-}\n-\n /* FIELD is a bit-field. We are finishing the processing for its\n enclosing type. Issue any appropriate messages and set appropriate\n flags. Returns false if an error has been diagnosed. */\n@@ -6592,21 +6534,6 @@ determine_key_method (tree type)\n return;\n }\n \n-\n-/* Allocate and return an instance of struct sorted_fields_type with\n- N fields. */\n-\n-static struct sorted_fields_type *\n-sorted_fields_type_new (int n)\n-{\n- struct sorted_fields_type *sft;\n- sft = (sorted_fields_type *) ggc_internal_alloc (sizeof (sorted_fields_type)\n-\t\t\t\t + n * sizeof (tree));\n- sft->len = n;\n-\n- return sft;\n-}\n-\n /* Helper of find_flexarrays. Return true when FLD refers to a non-static\n class data member of non-zero size, otherwise false. */\n \n@@ -7145,14 +7072,7 @@ finish_struct_1 (tree t)\n \t&& same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (x)), t))\n SET_DECL_MODE (x, TYPE_MODE (t));\n \n- /* Done with FIELDS...now decide whether to sort these for\n- faster lookups later.\n-\n- We use a small number because most searches fail (succeeding\n- ultimately as the search bores through the inheritance\n- hierarchy), and we want this failure to occur quickly. */\n-\n- insert_into_classtype_sorted_fields (TYPE_FIELDS (t), t, 8);\n+ set_class_bindings (t, TYPE_FIELDS (t));\n \n /* Complain if one of the field types requires lower visibility. */\n constrain_class_visibility (t);\n@@ -7220,45 +7140,6 @@ finish_struct_1 (tree t)\n }\n }\n \n-/* Insert FIELDS into T for the sorted case if the FIELDS count is\n- equal to THRESHOLD or greater than THRESHOLD. */\n-\n-static void \n-insert_into_classtype_sorted_fields (tree fields, tree t, int threshold)\n-{\n- int n_fields = count_fields (fields);\n- if (n_fields >= threshold)\n- {\n- struct sorted_fields_type *field_vec = sorted_fields_type_new (n_fields);\n- add_fields_to_record_type (fields, field_vec, 0);\n- qsort (field_vec->elts, n_fields, sizeof (tree), field_decl_cmp);\n- CLASSTYPE_SORTED_FIELDS (t) = field_vec;\n- }\n-}\n-\n-/* Insert lately defined enum ENUMTYPE into T for the sorted case. */\n-\n-void\n-insert_late_enum_def_into_classtype_sorted_fields (tree enumtype, tree t)\n-{\n- struct sorted_fields_type *sorted_fields = CLASSTYPE_SORTED_FIELDS (t);\n- if (sorted_fields)\n- {\n- int i;\n- int n_fields\n-\t= list_length (TYPE_VALUES (enumtype)) + sorted_fields->len;\n- struct sorted_fields_type *field_vec = sorted_fields_type_new (n_fields);\n- \n- for (i = 0; i < sorted_fields->len; ++i)\n-\tfield_vec->elts[i] = sorted_fields->elts[i];\n-\n- add_enum_fields_to_record_type (enumtype, field_vec,\n-\t\t\t\t sorted_fields->len);\n- qsort (field_vec->elts, n_fields, sizeof (tree), field_decl_cmp);\n- CLASSTYPE_SORTED_FIELDS (t) = field_vec;\n- }\n-}\n-\n /* When T was built up, the member declarations were added in reverse\n order. Rearrange them to declaration order. */\n \nIndex: cp-tree.h\n===================================================================\n--- cp-tree.h\t(revision 251385)\n+++ cp-tree.h\t(working copy)\n@@ -6023,7 +6023,6 @@ extern tree* decl_cloned_function_p\t\t(co\n extern void clone_function_decl\t\t\t(tree, bool);\n extern void adjust_clone_args\t\t\t(tree);\n extern void deduce_noexcept_on_destructor (tree);\n-extern void insert_late_enum_def_into_classtype_sorted_fields (tree, tree);\n extern bool uniquely_derived_from_p (tree, tree);\n extern bool publicly_uniquely_derived_p (tree, tree);\n extern tree common_enclosing_class\t\t(tree, tree);\nIndex: decl.c\n===================================================================\n--- decl.c\t(revision 251385)\n+++ decl.c\t(working copy)\n@@ -14316,8 +14316,7 @@ finish_enum_value_list (tree enumtype)\n && COMPLETE_TYPE_P (current_class_type)\n && UNSCOPED_ENUM_P (enumtype))\n {\n- insert_late_enum_def_into_classtype_sorted_fields (enumtype,\n-\t\t\t\t\t\t\t current_class_type);\n+ insert_late_enum_def_bindings (enumtype, current_class_type);\n fixup_type_variants (current_class_type);\n }\n \nIndex: name-lookup.c\n===================================================================\n--- name-lookup.c\t(revision 251385)\n+++ name-lookup.c\t(working copy)\n@@ -1312,6 +1312,115 @@ lookup_fnfields_slot (tree type, tree na\n return lookup_fnfields_slot_nolazy (type, name);\n }\n \n+/* Allocate and return an instance of struct sorted_fields_type with\n+ N fields. */\n+\n+static struct sorted_fields_type *\n+sorted_fields_type_new (int n)\n+{\n+ struct sorted_fields_type *sft;\n+ sft = (sorted_fields_type *) ggc_internal_alloc (sizeof (sorted_fields_type)\n+\t\t\t\t + n * sizeof (tree));\n+ sft->len = n;\n+\n+ return sft;\n+}\n+\n+/* Subroutine of insert_into_classtype_sorted_fields. Recursively\n+ count the number of fields in TYPE, including anonymous union\n+ members. */\n+\n+static int\n+count_fields (tree fields)\n+{\n+ tree x;\n+ int n_fields = 0;\n+ for (x = fields; x; x = DECL_CHAIN (x))\n+ {\n+ if (DECL_DECLARES_FUNCTION_P (x))\n+\t/* Functions are dealt with separately. */;\n+ else if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))\n+\tn_fields += count_fields (TYPE_FIELDS (TREE_TYPE (x)));\n+ else\n+\tn_fields += 1;\n+ }\n+ return n_fields;\n+}\n+\n+/* Subroutine of insert_into_classtype_sorted_fields. Recursively add\n+ all the fields in the TREE_LIST FIELDS to the SORTED_FIELDS_TYPE\n+ elts, starting at offset IDX. */\n+\n+static int\n+add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec,\n+\t\t\t int idx)\n+{\n+ tree x;\n+ for (x = fields; x; x = DECL_CHAIN (x))\n+ {\n+ if (DECL_DECLARES_FUNCTION_P (x))\n+\t/* Functions are handled separately. */;\n+ else if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))\n+\tidx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);\n+ else\n+\tfield_vec->elts[idx++] = x;\n+ }\n+ return idx;\n+}\n+\n+/* Add all of the enum values of ENUMTYPE, to the FIELD_VEC elts,\n+ starting at offset IDX. */\n+\n+static int\n+add_enum_fields_to_record_type (tree enumtype,\n+\t\t\t\tstruct sorted_fields_type *field_vec,\n+\t\t\t\tint idx)\n+{\n+ tree values;\n+ for (values = TYPE_VALUES (enumtype); values; values = TREE_CHAIN (values))\n+ field_vec->elts[idx++] = TREE_VALUE (values);\n+ return idx;\n+}\n+\n+/* Insert FIELDS into T for the sorted case if the FIELDS count is\n+ equal to THRESHOLD or greater than THRESHOLD. */\n+\n+void \n+set_class_bindings (tree klass, tree fields)\n+{\n+ int n_fields = count_fields (fields);\n+ if (n_fields >= 8)\n+ {\n+ struct sorted_fields_type *field_vec = sorted_fields_type_new (n_fields);\n+ add_fields_to_record_type (fields, field_vec, 0);\n+ qsort (field_vec->elts, n_fields, sizeof (tree), field_decl_cmp);\n+ CLASSTYPE_SORTED_FIELDS (klass) = field_vec;\n+ }\n+}\n+\n+/* Insert lately defined enum ENUMTYPE into T for the sorted case. */\n+\n+void\n+insert_late_enum_def_bindings (tree enumtype, tree t)\n+{\n+ struct sorted_fields_type *sorted_fields = CLASSTYPE_SORTED_FIELDS (t);\n+ if (sorted_fields)\n+ {\n+ int i;\n+ int n_fields\n+\t= list_length (TYPE_VALUES (enumtype)) + sorted_fields->len;\n+ struct sorted_fields_type *field_vec = sorted_fields_type_new (n_fields);\n+ \n+ for (i = 0; i < sorted_fields->len; ++i)\n+\tfield_vec->elts[i] = sorted_fields->elts[i];\n+\n+ add_enum_fields_to_record_type (enumtype, field_vec,\n+\t\t\t\t sorted_fields->len);\n+ qsort (field_vec->elts, n_fields, sizeof (tree), field_decl_cmp);\n+ CLASSTYPE_SORTED_FIELDS (t) = field_vec;\n+ }\n+}\n+\n /* Compute the chain index of a binding_entry given the HASH value of its\n name and the total COUNT of chains. COUNT is assumed to be a power\n of 2. */\nIndex: name-lookup.h\n===================================================================\n--- name-lookup.h\t(revision 251385)\n+++ name-lookup.h\t(working copy)\n@@ -322,6 +322,8 @@ extern tree lookup_arg_dependent (tree,\n extern tree lookup_field_1\t\t\t(tree, tree, bool);\n extern tree lookup_fnfields_slot\t\t(tree, tree);\n extern tree lookup_fnfields_slot_nolazy\t\t(tree, tree);\n+extern void set_class_bindings (tree, tree);\n+extern void insert_late_enum_def_bindings (tree, tree);\n extern tree innermost_non_namespace_value (tree);\n extern cxx_binding *outer_binding (tree, cxx_binding *, bool);\n extern void cp_emit_debug_info_for_using (tree, tree);\n", "prefixes": [ "C++" ] }