From ec2255295c35008f5f39c9a79d5f342416ce6e86 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 13 Oct 2016 15:00:54 +0200 Subject: [multiple changes] 2016-10-13 Hristian Kirtchev * 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 * exp_ch9.adb (Expand_N_Asynchronous_Select): Return immediately on restricted profile. 2016-10-13 Javier Miranda * 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 --- gcc/ada/table.adb | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'gcc/ada/table.adb') 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; -- cgit v1.1