diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-02 14:41:13 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-02 14:41:13 +0000 |
commit | 87d6f1a47daa6fc5d56bcf76f6d6d7e3e6c08294 (patch) | |
tree | da702c5ed32a3bb7f2b98f32918a110fe1e52652 /gcc/ada/exp_ch7.adb | |
parent | 4a473cb984ee38140d0b05541e95a90f6507c95b (diff) | |
download | gcc-87d6f1a47daa6fc5d56bcf76f6d6d7e3e6c08294.tar.gz |
2011-08-02 Javier Miranda <miranda@adacore.com>
* exp_disp.ads (Build_VM_TSDs): Build the runtime Type Specific Data
record of all the tagged types declared inside library level package
declarations, library level package bodies or library level subprograms.
* exp_disp.adb (Make_VM_TSD): New subprogram that builds the TSD
associated with a given tagged type.
(Build_VM_TSDs): New subprogram.
* exp_ch6.adb (Expand_N_Subprogram_Body): Generate TSDs records of main
compilation units that are subprograms.
* exp_ch7.adb (Expand_N_Package_Body): Generate TSDs of main
compilation units that are package bodies.
(Expand_N_Package_Declaration): Generate TSDs of the main compilation
units that are a package declaration or a package instantiation.
* exp_intr.adb (Expand_Dispatching_Constructor_Call): Minor code
reorganization to improve the error generated by the frontend when the
function Ada.Tags.Secondary_Tag is not available.
* rtsfind.ads (RE_Register_TSD): New runtime entity.
* exp_ch4.adb (Expand_N_Type_Conversion): Minor code cleanup.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177163 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch7.adb')
-rw-r--r-- | gcc/ada/exp_ch7.adb | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 4d64b84b2a7..d52740a659b 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -1553,7 +1553,15 @@ package body Exp_Ch7 is -- Build dispatch tables of library level tagged types if Is_Library_Level_Entity (Ent) then - Build_Static_Dispatch_Tables (N); + if Tagged_Type_Expansion then + Build_Static_Dispatch_Tables (N); + + -- In VM targets there is no need to build dispatch tables but + -- we must generate the corresponding Type Specific Data record + + elsif Unit (Cunit (Main_Unit)) = N then + Build_VM_TSDs (N); + end if; end if; Build_Task_Activation_Call (N); @@ -1654,7 +1662,31 @@ package body Exp_Ch7 is or else (Is_Generic_Instance (Id) and then Is_Library_Level_Entity (Id)) then - Build_Static_Dispatch_Tables (N); + if Tagged_Type_Expansion then + Build_Static_Dispatch_Tables (N); + + -- In VM targets there is no need to build dispatch tables but + -- we must generate the corresponding Type Specific Data record + + elsif Unit (Cunit (Main_Unit)) = N then + + -- Enter the scope of the package because the new declarations + -- are appended at the end of the package and must be analyzed + -- in that context. + + Push_Scope (Id); + + if Is_Generic_Instance (Main_Unit_Entity) then + if Package_Instantiation (Main_Unit_Entity) = N then + Build_VM_TSDs (N); + end if; + + else + Build_VM_TSDs (N); + end if; + + Pop_Scope; + end if; end if; -- Note: it is not necessary to worry about generating a subprogram |