r260661 - in /trunk/gcc/ada: ChangeLog einfo.ad...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Thu May 24 13:06:00 GMT 2018


Author: pmderodat
Date: Thu May 24 13:06:11 2018
New Revision: 260661

URL: https://gcc.gnu.org/viewcvs?rev=260661&root=gcc&view=rev
Log:
[Ada] Quadratic compile time with tagged types

This patch is an incremental commit which focuses on the optimization of entity
chain navigation by adding an additional field (Prev_Entity) to all nodes in
order to greaty speed up compilation of sources making heavy use of tagged
derivations by effectly making the entity chain from a singly-linked list into
a doubly-linked one.

This is only a performance improvement: no compilation result change
expected.

2018-05-24  Justin Squirek  <squirek@adacore.com>

gcc/ada/

	* einfo.ads, einfo.adb (Append_Entity): Modified to use Link_Entities
	and manage doubly-linked entity chain.
	(Nested_Scenarios): Removed entity field used for optimization during
	 elaboration to make room for the new field Prev_Entity.
	(Link_Entities): Added to replace redundant calls to Set_Next_Entity
	and Set_Prev_Entity as well as centralize changes to the entity chain.
	(Predicated_Parent): Modified to use Node38.
	(Prev_Entity): Added to fetch new node field Prev_Entity in all entity
	types.
	(Remove_Entity): Moved from sem_util.
	(Set_Nested_Scenarios): Deleted.
	(Set_Predicated_Parent): Modified to use Node38.
	(Set_Prev_Entity): Added to set Prev_Entity field.
	(Set_Validated_Object): Modified to use Node38.
	(Unlink_Next_Entity): Added to process Prev_Entity when an unlinking
	action is required.
	(Validated_Object): Modified to use Node38.
	(Write_Field36_Name): Remove Nested_Scenarios, Validated_Object, and
	predicated parent cases.
	(Write_Field38_Name): Add predicated parent and Validated_Object cases.
	* sem_ch3.adb (Process_Subtype): Add guard to protect against
	inappropriate marking of Predicated_Parent to non-itype subtypes.
	(Make_Class_Wide_Type): Preserve Prev_Entity field and set in new type.
	(Copy_And_Swap): Add setting of Prev_Entity.
	(Build_derived_Record_Type): Replace Set_Next_Entity w/ Link_Entities.
	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Replace Set_Next_Entity
	w/ Link_Entities.
	(New_Overloaded_Entity): Remove block created to search for previous
	entities in the entity chain with relevant calls to Prev_Entity as well
	as replace duplicated code from Remove_Entity_And_Homonym with a call
	to that subprogram.
	* sem_ch7.adb (Exchange_Declarations): Replace Set_Next_Entity w/
	Link_Entities.
	* sem_elab.adb (Find_And_Process_Nested_Scenarios): Remove global and
	initial subprogram declarations related to Nested_Scenarios.
	(Process_Nested_Scenarios): Deleted.
	(Save_Scenario): Deleted.
	(Traverse_Body): Remove optimization for Nested_Scenarios so as to free
	node space in the entity tree.
	* sem_util.adb, sem_util.ads (Remove_Entity): Moved to einfo.
	(Remove_Entity_And_Homonym): Added to separate functionality of
	Remove_Entity from the homonym chain directly.
	* exp_attr.adb (Expand_N_Attribute_Reference): Replace Set_Next_Entity
	w/ Link_Entities and Unlink_Next_Entity.
	* exp_ch3.adb (Expand_N_Object_Declaration): Replace Set_Next_Entity w/
	Link_Entities.
	* exp_ch6.adb (Replace_Renaming_Declaration_Id): Replace
	Set_Next_Entity w/ Link_Entities.
	* exp_disp.adb (Expand_Dispatching_Call): Replace Set_Next_Entity w/
	Link_Entities and Unlink_Next_Entity.
	* exp_spark.adb (Expand_SPARK_N_Object_Renaming_Declaration): Replace
	call to Remove_Entity with its new incarnation.
	* exp_util.adb (New_Class_Wide_Subtype): Add setting of Prev_Entity.
	* freeze.adb (Freeze_Record_Type): Replace Set_Next_Entity w/
	Link_Entities.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/einfo.adb
    trunk/gcc/ada/einfo.ads
    trunk/gcc/ada/exp_attr.adb
    trunk/gcc/ada/exp_ch3.adb
    trunk/gcc/ada/exp_ch6.adb
    trunk/gcc/ada/exp_disp.adb
    trunk/gcc/ada/exp_spark.adb
    trunk/gcc/ada/exp_util.adb
    trunk/gcc/ada/freeze.adb
    trunk/gcc/ada/sem_ch3.adb
    trunk/gcc/ada/sem_ch6.adb
    trunk/gcc/ada/sem_ch7.adb
    trunk/gcc/ada/sem_elab.adb
    trunk/gcc/ada/sem_util.adb
    trunk/gcc/ada/sem_util.ads



More information about the Gcc-cvs mailing list