aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinput.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 12:37:53 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 12:37:53 +0200
commitcd38efa560f565cb02cba62fe919e591dc110b74 (patch)
tree4eae409e43f75727ce132480e1c6fc7592638197 /gcc/ada/sinput.adb
parentd6394e2bbc175f53f60e71fccc5a9be4542ce68e (diff)
downloadgcc-cd38efa560f565cb02cba62fe919e591dc110b74.zip
gcc-cd38efa560f565cb02cba62fe919e591dc110b74.tar.gz
gcc-cd38efa560f565cb02cba62fe919e591dc110b74.tar.bz2
[multiple changes]
2013-10-10 Robert Dewar <dewar@adacore.com> * sem_ch3.adb: Minor reformatting. 2013-10-10 Robert Dewar <dewar@adacore.com> * sinput-c.adb (Load_File): Ensure Source_Align alignment. * sinput-d.adb (Create_Debug_Source): Ensure Source_Align alignment. * sinput-l.adb (Create_Instantiation_Source): Ensure Source_Align alignment. (Load_File): Ditto. * sinput.ads, sinput.adb (Get_Source_File_Index): New optimized (single line) version. * types.ads (Source_Align): New definition. (Source_Buffer): Document new alignment requirement. 2013-10-10 Robert Dewar <dewar@adacore.com> * sem_prag.adb (Analyze_Pragma, case Linker_Section): Allow this for types. 2013-10-10 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: Minor adjustment to doc for To_Address attribute. 2013-10-10 Vadim Godunko <godunko@adacore.com> * s-stopoo.ads (Root_Storage_Pool): Add pragma Preelaborable_Initialization. From-SVN: r203343
Diffstat (limited to 'gcc/ada/sinput.adb')
-rw-r--r--gcc/ada/sinput.adb61
1 files changed, 8 insertions, 53 deletions
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index a01c045..7bd0a69 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -434,44 +434,9 @@ package body Sinput is
-- Get_Source_File_Index --
---------------------------
- Source_Cache_First : Source_Ptr := 1;
- Source_Cache_Last : Source_Ptr := 0;
- -- Records the First and Last subscript values for the most recently
- -- referenced entry in the source table, to optimize the common case of
- -- repeated references to the same entry. The initial values force an
- -- initial search to set the cache value.
-
- Source_Cache_Index : Source_File_Index := No_Source_File;
- -- Contains the index of the entry corresponding to Source_Cache
-
function Get_Source_File_Index (S : Source_Ptr) return Source_File_Index is
begin
- if S in Source_Cache_First .. Source_Cache_Last then
- return Source_Cache_Index;
-
- else
- pragma Assert (Source_File_Index_Table (Int (S) / Chunk_Size)
- /=
- No_Source_File);
- for J in Source_File_Index_Table (Int (S) / Chunk_Size)
- .. Source_File.Last
- loop
- if S in Source_File.Table (J).Source_First ..
- Source_File.Table (J).Source_Last
- then
- Source_Cache_Index := J;
- Source_Cache_First :=
- Source_File.Table (Source_Cache_Index).Source_First;
- Source_Cache_Last :=
- Source_File.Table (Source_Cache_Index).Source_Last;
- return Source_Cache_Index;
- end if;
- end loop;
- end if;
-
- -- We must find a matching entry in the above loop!
-
- raise Program_Error;
+ return Source_File_Index_Table (Int (S) / Source_Align);
end Get_Source_File_Index;
----------------
@@ -480,9 +445,6 @@ package body Sinput is
procedure Initialize is
begin
- Source_Cache_First := 1;
- Source_Cache_Last := 0;
- Source_Cache_Index := No_Source_File;
Source_gnat_adc := No_Source_File;
First_Time_Around := True;
@@ -724,15 +686,13 @@ package body Sinput is
Ind : Int;
SP : Source_Ptr;
SL : constant Source_Ptr := Source_File.Table (Xnew).Source_Last;
-
begin
- SP := (Source_File.Table (Xnew).Source_First + Chunk_Size - 1)
- / Chunk_Size * Chunk_Size;
- Ind := Int (SP) / Chunk_Size;
-
+ SP := Source_File.Table (Xnew).Source_First;
+ pragma Assert (SP mod Source_Align = 0);
+ Ind := Int (SP) / Source_Align;
while SP <= SL loop
Source_File_Index_Table (Ind) := Xnew;
- SP := SP + Chunk_Size;
+ SP := SP + Source_Align;
Ind := Ind + 1;
end loop;
end Set_Source_File_Index_Table;
@@ -921,19 +881,14 @@ package body Sinput is
end loop;
end if;
- -- Reset source cache pointers to force new read
-
- Source_Cache_First := 1;
- Source_Cache_Last := 0;
-
-- Read in source file table and instance table
Source_File.Tree_Read;
Instances.Tree_Read;
- -- The pointers we read in there for the source buffer and lines
- -- table pointers are junk. We now read in the actual data that
- -- is referenced by these two fields.
+ -- The pointers we read in there for the source buffer and lines table
+ -- pointers are junk. We now read in the actual data that is referenced
+ -- by these two fields.
for J in Source_File.First .. Source_File.Last loop
declare