===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@
with Scng;
with Sinput.C;
with Snames; use Snames;
+with Stringt;
with Styleg;
package body ALI.Util is
@@ -476,6 +477,8 @@
-- ??? It is probably worth updating the ALI file with a new
-- field to avoid recomputing it each time.
+ Stringt.Mark;
+
if Checksums_Match
(Get_File_Checksum (Sdep.Table (D).Sfile),
Source.Table (Src).Checksum)
@@ -491,6 +494,8 @@
Sdep.Table (D).Stamp := Source.Table (Src).Stamp;
end if;
+ Stringt.Release;
+
end if;
if (not Read_Only) or else Source.Table (Src).Source_Found then
===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -70,6 +70,12 @@
-- when Start_String is called with a parameter that is the last string
-- currently allocated in the table.
+ Strings_Last : String_Id := First_String_Id;
+ String_Chars_Last : Int := 0;
+ -- Strings_Last and String_Chars_Last are used by procedure Mark and
+ -- Release to get a snapshot of the tables and to restore them to their
+ -- previous situation.
+
-------------------------------
-- Add_String_To_Name_Buffer --
-------------------------------
@@ -129,6 +135,26 @@
Strings.Release;
end Lock;
+ ----------
+ -- Mark --
+ ----------
+
+ procedure Mark is
+ begin
+ Strings_Last := Strings.Last;
+ String_Chars_Last := String_Chars.Last;
+ end Mark;
+
+ -------------
+ -- Release --
+ -------------
+
+ procedure Release is
+ begin
+ Strings.Set_Last (Strings_Last);
+ String_Chars.Set_Last (String_Chars_Last);
+ end Release;
+
------------------
-- Start_String --
------------------
===================================================================
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -62,6 +62,14 @@
procedure Unlock;
-- Unlock internal tables, in case back end needs to modify them
+ procedure Mark;
+ -- Take a snapshot of the internal tables
+
+ procedure Release;
+ -- Restore the internal tables to the situation when Mark was last called.
+ -- Mark and Release are used when getting checksums of sources in minimal
+ -- recompilation mode, to reduce memory usage.
+
procedure Start_String;
-- Sets up for storing a new string in the table. To store a string, a
-- call is first made to Start_String, then successive calls are