This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/10962] [3.3/3.4 regression] lookup_field is a linear search on a linked list (can be slow if large struct)
- From: "cvs-commit at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jul 2003 18:46:04 -0000
- Subject: [Bug c/10962] [3.3/3.4 regression] lookup_field is a linear search on a linked list (can be slow if large struct)
- References: <20030524022944.10962.pinskia@physics.uc.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10962
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-07-16 18:46 -------
Subject: Bug 10962
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pinskia@gcc.gnu.org 2003-07-16 18:45:56
Modified files:
gcc : ChangeLog c-common.c c-common.h c-decl.c
c-tree.h c-typeck.c ggc.h
gcc/cp : ChangeLog class.c cp-tree.h search.c
Log message:
2003-07-16 Andrew Pinski <pinskia@physics.uc.edu>
ChangeLog:
PR c/10962
* ggc.h: Add header guards.
* c-decl.c (finish_struct): Sort fields if
number greater than 15 and there are no
anonymous structs/unions.
* c-common.h: Include ggc.h.
(sorted_fields_type): New struct.
(field_decl_cmp): New prototype.
(resort_sorted_fields): New prototype.
(DECL_DECLARES_TYPE_NON_TEMPLATE_P): New macro.
* c-tree.h: (lang_type): Use pointer to sorted_fields_type
as s, removing other fields.
* c-typeck.c (lookup_field): Use s in lang_type.
These were mostly moved from cp/class.c:
* c-common.c (field_decl_cmp): New static function.
(field_decl_cmp): New function.
(resort_sorted_fields): New function.
cp/ChangeLog:
* class.c (field_decl_cmp): Remove.
(resort_field_decl_cmp): Remove.
(resort_sorted_fields): Remove.
(add_fields_to_vec): Rename to ...
(add_fields_to_record_type): this.
(finish_struct_1): Change to be using
sorted_fields_type's fields.
* cp-tree.h (lang_decl): In lang_decl_u3
change sorted_fields to be a pointer to
sorted_fields_type.
(resort_sorted_fields): Remove prototype.
* search.c (lookup_field_1): Change to be using
sorted_fields_type's fields.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.527&r2=2.528
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.429&r2=1.430
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&r1=1.190&r2=1.191
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.405&r2=1.406
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-tree.h.diff?cvsroot=gcc&r1=1.119&r2=1.120
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.244&r2=1.245
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ggc.h.diff?cvsroot=gcc&r1=1.55&r2=1.56
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3528&r2=1.3529
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.552&r2=1.553
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.878&r2=1.879
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&r1=1.275&r2=1.276