aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/table.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-10-13 15:00:54 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-10-13 15:00:54 +0200
commitec2255295c35008f5f39c9a79d5f342416ce6e86 (patch)
treecf8e171b11f36bb989dabab2b48bd9d820d3fa97 /gcc/ada/table.adb
parent62c1b965b52837687f406f1923069e3ba584b77c (diff)
downloadgcc-ec2255295c35008f5f39c9a79d5f342416ce6e86.zip
gcc-ec2255295c35008f5f39c9a79d5f342416ce6e86.tar.gz
gcc-ec2255295c35008f5f39c9a79d5f342416ce6e86.tar.bz2
[multiple changes]
2016-10-13 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch6.adb (Analyze_Expression_Function): Remove the aspects of the original expression function has been rewritten into a subprogram declaration or a body. Reinsert the aspects once they have been analyzed. 2016-10-13 Tristan Gingold <gingold@adacore.com> * exp_ch9.adb (Expand_N_Asynchronous_Select): Return immediately on restricted profile. 2016-10-13 Javier Miranda <miranda@adacore.com> * sem_prag.adb (Process_Compile_Time_Warning_Or_Error): Register the pragma for its validation after the backend has been called only if its expression has some occurrence of attributes 'size or 'alignment * table.ads (Release_Threshold): New formal. (Release): Adding documentation of its new functionality. * table.adb (Release): Extend its functionality with a Release_Threshold. * nlists.adb (Next_Node table): Set its Release_Threshold. * atree.adb (Orig_Nodes table): Set its Release_Threshold. * atree.ads (Nodes table): Set its Release_Threshold. (Flags table): Set its Release_Threshold. * alloc.ads (Nodes_Release_Threshold): New constant declaration. (Orig_Nodes_Release_Threshold): New constant declaration. * debug.adb (switch d.9): Left free. * gnat1drv.adb (Post_Compilation_Validation_Checks): Enable validation of pragmas Compile_Time_Error and Compile_Time_Warning. From-SVN: r241117
Diffstat (limited to 'gcc/ada/table.adb')
-rw-r--r--gcc/ada/table.adb30
1 files changed, 28 insertions, 2 deletions
diff --git a/gcc/ada/table.adb b/gcc/ada/table.adb
index 34fe728..2c7eb0c 100644
--- a/gcc/ada/table.adb
+++ b/gcc/ada/table.adb
@@ -229,7 +229,6 @@ package body Table is
Set_Standard_Output;
raise Unrecoverable_Error;
end if;
-
end Reallocate;
-------------
@@ -237,9 +236,36 @@ package body Table is
-------------
procedure Release is
+ Extra_Length : Int;
+ Size : Memory.size_t;
+
begin
Length := Last_Val - Int (Table_Low_Bound) + 1;
- Max := Last_Val;
+ Size := Memory.size_t (Length) *
+ (Table_Type'Component_Size / Storage_Unit);
+
+ -- If the size of the table exceeds the release threshold then leave
+ -- space to store as many extra elements as 0.1% of the table length.
+
+ if Release_Threshold > 0
+ and then Size > Memory.size_t (Release_Threshold)
+ then
+ Extra_Length := Length / 1000;
+ Length := Length + Extra_Length;
+ Max := Int (Table_Low_Bound) + Length - 1;
+
+ if Debug_Flag_D then
+ Write_Str ("--> Release_Threshold reached (length=");
+ Write_Int (Int (Size));
+ Write_Str ("): leaving room space for ");
+ Write_Int (Extra_Length);
+ Write_Str (" components");
+ Write_Eol;
+ end if;
+ else
+ Max := Last_Val;
+ end if;
+
Reallocate;
end Release;