diff options
author | Bob Duff <duff@adacore.com> | 2020-07-14 17:10:19 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-20 03:21:35 -0400 |
commit | 83dcc2bd35e5dc981a13959b9bb6750736cd6544 (patch) | |
tree | b2ecadbe1434218ceaec2b21a0539708482a3755 /gcc/ada/fmap.adb | |
parent | 1b93e420fc10f0eaeb2b09d9b86c8defb5b459a4 (diff) | |
download | gcc-83dcc2bd35e5dc981a13959b9bb6750736cd6544.zip gcc-83dcc2bd35e5dc981a13959b9bb6750736cd6544.tar.gz gcc-83dcc2bd35e5dc981a13959b9bb6750736cd6544.tar.bz2 |
[Ada] Flexible AST node structure
gcc/ada/
* atree.ads: Make Default_Node a constant. Remove the
modification of Comes_From_Source, and use a separate flag for
that. Change Sloc to 0; it always overwritten, and never left
as the No_Location value.
(Print_Statistics): Move to spec so we can call it from
gnat1drv.
(Num_Nodes): Rename to clarify that this is approximate.
Correct comment: nodes and entities are never deleted, the count
is never decremented, and this is not used by Xref.
(Initialize): Correct comment: Error_List is not created here.
Other minor naming and comment changes.
* atree.adb (Extend_Node, New_Copy, New_Entity, New_Node):
Streamline these. Simplify and improve efficiency. Move code
from Allocate_Initialize_Node to these, where it can be executed
unconditionally. Take advantage of automatic zeroing of the
Nodes table.
(Allocate_Initialize_Node): Remove this. It was an efficiency
bottleneck, and somewhat complicated, because it was called from
4 places, and had all sorts of conditionals to check where it
was called from. Better to move most of that code to the call
sites, where it can be executed (or not) unconditionally.
(Allocate_New_Node): New procedure to partly replace
Allocate_Initialize_Node (called from just 2 of those 4 places).
(Comes_From_Source_Default): New flag written/read by
Set_Comes_From_Source_Default/Get_Comes_From_Source_Default.
This allows us to make Default_Node into a constant with
all-zeros value.
(Set_Paren_Count_Of_Copy): New procedure to avoid duplicated
code.
(Report): New procedure to encapsulate the call to the reporting
procedure.
(Atree_Private_Part): We now need a body for this package, to
contain package body Nodes.
(Approx_Num_Nodes_And_Entities): Was Num_Nodes. For efficiency,
compute the answer from Nodes.Last. That way we don't need to
increment a counter on every node creation. Other minor naming
and comment changes.
* gnat1drv.adb: Call Atree.Print_Statistics if -gnatd.A switch
was given. Add comment documenting the new order dependency (we
must process the command line before calling Atree.Initialize).
* debug.adb: Document -gnatd.A.
* einfo.adb, sinfo.adb: Remove useless Style_Checks pragmas.
* nlists.ads (Allocate_List_Tables): Inline makes node creation
a little faster.
* nlists.adb (Initialize): Remove local constant E, which didn't
seem to add clarity.
* treepr.adb (Print_Init): Use renamed
Approx_Num_Nodes_And_Entities function.
* types.ads: Change the Low and High bounds as described above.
* types.h: Change Low and High bounds to match types.ads.
* sem_ch8.adb, namet.adb, namet.ads: Move the computation of
Last_Name_Id from sem_ch8 to namet, and correct it to not assume
Name_Ids are positive.
* ali.adb, ali-util.adb, bindo-writers.adb, exp_dist.adb,
fmap.adb, fname-uf.adb, osint.adb: Fix various hash functions to
avoid assuming the various ranges are positive. Note that "mod"
returns a nonnegative result when the second operand is
positive. "rem" can return negative values in that case (in
particular, if the first operand is negative, which it now is).
* switch-c.adb: Allow switch -gnaten to control the value of
Nodes_Size_In_Meg.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Remove traling whitespaces.
* opt.ads (Nodes_Size_In_Meg): New Variable.
Diffstat (limited to 'gcc/ada/fmap.adb')
-rw-r--r-- | gcc/ada/fmap.adb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/ada/fmap.adb b/gcc/ada/fmap.adb index a5ae66e..40aeef1 100644 --- a/gcc/ada/fmap.adb +++ b/gcc/ada/fmap.adb @@ -162,12 +162,12 @@ package body Fmap is function Hash (F : File_Name_Type) return Header_Num is begin - return Header_Num (Int (F) rem Header_Num'Range_Length); + return Header_Num (Int (F) mod Header_Num'Range_Length); end Hash; function Hash (F : Unit_Name_Type) return Header_Num is begin - return Header_Num (Int (F) rem Header_Num'Range_Length); + return Header_Num (Int (F) mod Header_Num'Range_Length); end Hash; ---------------- |