[Ada] Performance degradation with references

Programming / Compilers / GCC - pmderodat [138bc75d-0d04-0410-961f-82ee72b054a4] - 11 June 2018 09:16 EDT

This patch modifies the creation of markers for variable references in the context of SPARK elaboration checks. Previously, prior to checking whether a reference requires such a marker, the compiler performed a logarithmic look up to determine whether the reference appears within a call. This action caused the compiler to degrade when a source program contains multiple (100,000s) references. Now, the compiler no longer performs the look up immediately.

2018-06-11 Hristian Kirtchev

gcc/ada/

- sem_ch8.adb (Find_Direct_Name): Mode the declaration of Is_Assignment_LHS further in. Use predicate Needs_Variable_Reference_Marker to determine whether to create a
variable marker. (Find_Expanded_Name): Mode the declaration of Is_Assignment_LHS further in. Use predicate Needs_Variable_Reference_Marker to determine whether to create a variable marker.
- sem_elab.adb (Build_Variable_Reference_Marker): Remove the various checks that determine whether the identifier or expanded name is a suitable variable reference. The checks are now performed by Needs_Variable_Reference_Marker.
- sem_res.adb (Resolve_Actuals): Use predicate Needs_Variable_Reference_Marker to determine whether to create a
variable marker.
- sem_util.adb (Needs_Variable_Reference_Marker): New routine.
- sem_util.ads (Needs_Variable_Reference_Marker): New routine.

2fd350b8589 [Ada] Performance degradation with references
gcc/ada/ChangeLog | 19 ++++++
gcc/ada/sem_ch8.adb | 42 ++++++++-----
gcc/ada/sem_elab.adb | 162 ++-------------------------------------------------
gcc/ada/sem_res.adb | 13 +++--
gcc/ada/sem_util.adb | 138 +++++++++++++++++++++++++++++++++++++++++++
gcc/ada/sem_util.ads | 7 +++
6 files changed, 206 insertions(+), 175 deletions(-)

Upstream: gcc.gnu.org


  • Share