This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH - remove 6 pointer fields from C's lang_identifier


As a sanity check, I added the line:
 printf("alloc '%s' ext new kind:%d old kind:%d\n",
	     IDENTIFIER_POINTER(id), value_index, cur_kind);
in set_identifier_value when it allocates an extention TREE_VEC,
and then recompiled expr.o c-common.o and builtins.o (three
random large files), and got reassuring results:

expr.c had 2 "conflicts" ("index" and "exp").
c-decl.c had 4 ("link", "exp","dup", and "var_labelno").
builtinc.s had 2 ("link" and "exp").

All except one was where the same identifier had both
IDENTIFIER_GLOBAL_VALUE and IDENTIFIER_LOCAL_VALUE non-null.
In one case ("var_labelno") both IDENTIFIER_LIMBO_VALUE
and IDENTIFIER_LOCAL_VALUE were set.

These very low numbers supports the intuition that the
overwhelming number of identifiers do not need to
allocate an extensions TREE_VEC.  So the net effect is
a definite and significant space saving.  The net time
effect is harder to pin down:  The new macros require extra
instructions (to test the IDENTIFIER_FIELD_KIND), but because
of the space savings we do less gc, and locality should be
improved.  My numbers, plus some results sent me privately
by Judd Jenne, suggest a minor but worthwhile improvement.

It might be possible to tweak things better, perhaps by
re-ordering the tests in IDENTIFIER_FIELD, or adding some
annotation a la _builtin_expect (?), but that's not sort of
micro-optimization isn't really my field.
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]