aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-exexpr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-11-19 11:54:53 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2004-11-19 11:54:53 +0100
commitee57599295edea9f7edd73768deab9cc526dc505 (patch)
tree6efa7bf4ecf82f27c400f99353c69a8bcca1b6c7 /gcc/ada/a-exexpr.adb
parentf5a0cbf1083ff9d9635c813929b89d9f831f4ec9 (diff)
downloadgcc-ee57599295edea9f7edd73768deab9cc526dc505.zip
gcc-ee57599295edea9f7edd73768deab9cc526dc505.tar.gz
gcc-ee57599295edea9f7edd73768deab9cc526dc505.tar.bz2
a-exexpr.adb (Others_Value, [...]): New variables...
* a-exexpr.adb (Others_Value, All_Others_Value): New variables, the address of which may be used to represent "others" and "all others" choices in exception tables, instead of the current harcoded (void *)0 and (void *)1. (Setup_Exception): Do nothing in the GNAT SJLJ case. * gigi.h (others_decl, all_others_decl): New decls representing the new Others_Value and All_Others_Value objects. (struct attrib): Rename "arg" component as "args", since GCC expects a list of arguments in there. * raise.c (GNAT_OTHERS, GNAT_ALL_OTHERS): Are now the address of the corresponding objects exported by a-exexpr, instead of hardcoded dummy addresses. * trans.c (Exception_Handler_to_gnu_zcx): Use the address of others_decl and all_others_decl instead of hardcoded dummy addresses to represent "others" and "all others" choices, which is cleaner and more flexible with respect to the possible eh pointer encoding policies. * utils.c (init_gigi_decls): Initialize others_decl and all_others_decl. (process_attributes): Account for the naming change of the "args" attribute list entry component. * decl.c (build_attr_list): Rename into prepend_attributes to allow cumulating attributes for different entities into a single list. (gnat_to_gnu_entity): Use prepend_attributes to build the list of attributes for the current entity and propagate first subtype attributes to other subtypes. <E_Procedure>: Attribute arguments are attr->args and not attr->arg any more. (build_attr_list): Ditto. Make attr->args a TREE_LIST when there is an argument provided, as this is what GCC expects. Use NULL_TREE instead of 0 for trees. From-SVN: r90900
Diffstat (limited to 'gcc/ada/a-exexpr.adb')
-rw-r--r--gcc/ada/a-exexpr.adb64
1 files changed, 47 insertions, 17 deletions
diff --git a/gcc/ada/a-exexpr.adb b/gcc/ada/a-exexpr.adb
index 913c0e8..ea9ce67 100644
--- a/gcc/ada/a-exexpr.adb
+++ b/gcc/ada/a-exexpr.adb
@@ -131,7 +131,7 @@ package body Exception_Propagation is
type GNAT_GCC_Exception is record
Header : Unwind_Exception;
- -- ABI Exception header first.
+ -- ABI Exception header first
Id : Exception_Id;
-- GNAT Exception identifier. This is filled by Propagate_Exception
@@ -146,7 +146,7 @@ package body Exception_Propagation is
-- an exception is not handled.
Next_Exception : EOA;
- -- Used to create a linked list of exception occurrences.
+ -- Used to create a linked list of exception occurrences
end record;
pragma Convention (C, GNAT_GCC_Exception);
@@ -204,9 +204,9 @@ package body Exception_Propagation is
UW_Argument : System.Address);
pragma Import (C, Unwind_ForcedUnwind, "__gnat_Unwind_ForcedUnwind");
- --------------------------------------------
- -- Occurrence stack management facilities --
- --------------------------------------------
+ ------------------------------------------------------------------
+ -- Occurrence Stack Management Facilities for the GCC-EH Scheme --
+ ------------------------------------------------------------------
function Remove
(Top : EOA;
@@ -245,7 +245,7 @@ package body Exception_Propagation is
------------------------------------------------------------
-- As of today, these are only used by the C implementation of the
- -- propagation personality routine to avoid having to rely on a C
+ -- GCC propagation personality routine to avoid having to rely on a C
-- counterpart of the whole exception_data structure, which is both
-- painful and error prone. These subprograms could be moved to a
-- more widely visible location if need be.
@@ -268,6 +268,20 @@ package body Exception_Propagation is
Adjustment : Integer);
pragma Export (C, Adjust_N_Cleanups_For, "__gnat_adjust_n_cleanups_for");
+ ---------------------------------------------------------------------------
+ -- Objects to materialize "others" and "all others" in the GCC EH tables --
+ ---------------------------------------------------------------------------
+
+ -- Currently, these only have their address taken and compared so there is
+ -- no real point having whole exception data blocks allocated. In any case
+ -- the types should match what gigi and the personality routine expect.
+
+ Others_Value : constant Integer := 16#BEEF#;
+ pragma Export (C, Others_Value, "__gnat_others_value");
+
+ All_Others_Value : constant Integer := 16#BEEF#;
+ pragma Export (C, All_Others_Value, "__gnat_all_others_value");
+
------------
-- Remove --
------------
@@ -360,7 +374,7 @@ package body Exception_Propagation is
function Is_Setup_And_Not_Propagated (E : EOA) return Boolean is
GCC_E : GNAT_GCC_Exception_Access :=
- To_GNAT_GCC_Exception (E.Private_Data);
+ To_GNAT_GCC_Exception (E.Private_Data);
begin
return GCC_E /= null and then GCC_E.Header.Private1 = Setup_Key;
end Is_Setup_And_Not_Propagated;
@@ -371,7 +385,7 @@ package body Exception_Propagation is
procedure Clear_Setup_And_Not_Propagated (E : EOA) is
GCC_E : GNAT_GCC_Exception_Access :=
- To_GNAT_GCC_Exception (E.Private_Data);
+ To_GNAT_GCC_Exception (E.Private_Data);
begin
pragma Assert (GCC_E /= null);
GCC_E.Header.Private1 := 0;
@@ -383,7 +397,7 @@ package body Exception_Propagation is
procedure Set_Setup_And_Not_Propagated (E : EOA) is
GCC_E : GNAT_GCC_Exception_Access :=
- To_GNAT_GCC_Exception (E.Private_Data);
+ To_GNAT_GCC_Exception (E.Private_Data);
begin
pragma Assert (GCC_E /= null);
GCC_E.Header.Private1 := Setup_Key;
@@ -393,10 +407,17 @@ package body Exception_Propagation is
-- Setup_Exception --
---------------------
- -- In this implementation of the exception propagation scheme, this
- -- subprogram should be understood as: Setup the exception occurrence
+ -- In the GCC-EH implementation of the propagation scheme, this
+ -- subprogram should be understood as : Setup the exception occurrence
-- stack headed at Current for a forthcoming raise of Excep.
+ -- In the GNAT-SJLJ case this "stack" only exists implicitely, by way of
+ -- local occurrence declarations together with save/restore operations
+ -- generated by the front-end, and this routine has nothing to do.
+
+ -- The differenciation is done here and not in the callers to avoid having
+ -- to spread out the test in numerous places.
+
procedure Setup_Exception
(Excep : EOA;
Current : EOA;
@@ -407,12 +428,22 @@ package body Exception_Propagation is
GCC_Exception : GNAT_GCC_Exception_Access;
begin
+ -- Just return if we're not in the GCC-EH case. What is otherwise
+ -- performed is useless and even harmful since it potentially involves
+ -- dynamic allocations that would never be released, and participates
+ -- in the Setup_And_Not_Propagated predicate management, only properly
+ -- handled by the rest of the GCC-EH scheme.
- -- The exception Excep is soon to be propagated, and the storage used
- -- for that will be the occurrence statically allocated for the current
- -- thread. This storage might currently be used for a still active
- -- occurrence, so we need to push it on the thread's occurrence stack
- -- (headed at that static occurrence) before it gets clobbered.
+ if Zero_Cost_Exceptions = 0 then
+ return;
+ end if;
+
+ -- Otherwise, the exception Excep is soon to be propagated, and the
+ -- storage used for that will be the occurrence statically allocated
+ -- for the current thread. This storage might currently be used for a
+ -- still active occurrence, so we need to push it on the thread's
+ -- occurrence stack (headed at that static occurrence) before it gets
+ -- clobbered.
-- What we do here is to trigger this push when need be, and allocate a
-- Private_Data block for the forthcoming Propagation.
@@ -461,7 +492,6 @@ package body Exception_Propagation is
Top.Private_Data := GCC_Exception.all'Address;
Set_Setup_And_Not_Propagated (Top);
-
end Setup_Exception;
-------------------