[Ada] Make Object Specific Dispatch tables constant

Message ID 20200611100009.GA90665@adacore.com
State New
Headers show
Series
  • [Ada] Make Object Specific Dispatch tables constant
Related show

Commit Message

Pierre-Marie de Rodat June 11, 2020, 10 a.m.
Internally generated static dispatch tables are preferably put in ROM,
so they are declared as constant where possible. However, the Object
Specific Dispatch tables were declared as variables, even though they
are initialized with static aggregates (with only literal integers) and
are never modified (either by the GNAT runtime nor by the code generated
by the GNAT compiler).

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-11  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* exp_disp.adb (Make_Secondary_DT): Internally generated OSD
	tables are now constant.

Patch

--- gcc/ada/exp_disp.adb
+++ gcc/ada/exp_disp.adb
@@ -4310,6 +4310,7 @@  package body Exp_Disp is
             Append_To (Result,
               Make_Object_Declaration (Loc,
                 Defining_Identifier => OSD,
+                Constant_Present    => True,
                 Object_Definition   =>
                   Make_Subtype_Indication (Loc,
                     Subtype_Mark =>