This is the mail archive of the gcc@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: [apple-ppc-branch] My CONSTRUCTORs are getting cloned!


On May 4, 2004, at 14:10, Ziemowit Laski wrote:

(I suspect this applies to tree-ssa as well.)

In the past (i.e., during 3.3 days), multiple CONSTRUCTORs (made via
a call to build_constructor()) containing identical data would get
uniqued.  But in the apple-ppc-branch, this does not happen.  As a
countermeasure, I added hashing logic to my code so that only a single
CONSTRUCTOR with a given contents ever gets created, only to discover
that it spawns multiple copies of itself in the final assembly output.
The CONSTRUCTOR in question gets referenced (via an ADDR_EXPR) in
several places during compilation, and the clones appear to be created
as a result of some (though not all) of these references.

Does anyone have any suggestions as to how to fix this?  I cannot quite
believe that this CONSTRUCTOR-cloning behavior is intentional...

Here is some history:


build_constructor in 3.3 only existed in the front-ends.
While in 3.4.0 and above there is a generic build_constructor in tree.c.
There is objc_build_constructor which exists still in the objc front-end.
The reason why you think it was uniqued because it called convert just
like what objc_build_constructor does still.


Thanks,
Andrew Pinski

Here is the changelog entry when this changed:
2003-04-12  Zack Weinberg  <zack@codesourcery.com>

        * tree.c (build_constructor): New function.
        * tree.h: Prototype it.

        * c-typeck.c (build_c_cast, pop_init_level)
        * profile.c (build_function_info_value, build_gcov_info_value)
        (create_profiler):
        Use build_constructor.

* builtins.c (expand_builtin_args_info): Remove #if 0 blocks.

* objc/objc-act.c (build_constructor):
Rename objc_build_constructor. Use build_constructor.
(build_objc_string_object, objc_add_static_instance)
(init_def_list, init_objc_symtab, init_module_descriptor)
(generate_static_references, build_selector_translation_table)
(build_descriptor_table_initializer, generate_descriptor_table)
(build_protocol_initializer, build_ivar_list_initializer)
(generate_ivars_list, build_dispatch_table_initializer)
(generate_dispatch_table, generate_protocol_list)
(build_category_initializer, build_shared_structure_initializer):
Update to match.


And here is the link to the patch which did it: <http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00777.html>.


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