-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
+pragma Compiler_Unit;
+
pragma Polling (Off);
-- We must turn polling off for this unit, because otherwise we get
-- elaboration circularities with System.Exception_Tables.
with System.Storage_Elements;
-with System.Exceptions;
package System.Machine_State_Operations is
-- outer level, or some other frame for which no information can be
-- provided.
- procedure Pop_Frame
- (M : Machine_State;
- Info : System.Exceptions.Subprogram_Info_Type);
+ procedure Pop_Frame (M : Machine_State);
-- This procedure pops the machine state M so that it represents the
-- call point, as though the current subprogram had returned. It
-- changes only the value referenced by M, and does not affect
-- the current stack environment.
- --
- -- The Info parameter represents information generated by the backend
- -- (see description of Subprogram_Info node in sinfo.ads). This
- -- information is stored as static data during compilation. The
- -- caller then passes this information to Pop_Frame, which will
- -- use it to determine what must be changed in the machine state
- -- (e.g. which save-over-call registers must be restored, and from
- -- where on the stack frame they must be restored).
- --
- -- A value of No_Info for Info means either that the backend provided
- -- no information for current frame, or that the current frame is an
- -- other language frame for which no information exists, or that this
- -- is an outer level subprogram. In any case, Pop_Frame sets the code
- -- location to Null_Address when it pops past such a frame, and this
- -- is taken as an indication that the exception is unhandled.
-
- -- Note: at the current time, Info, if present is always a copy of
- -- the entry point of the procedure, as found by searching the
- -- subprogram table. For the case where a procedure is indeed in
- -- the table (either it is an Ada procedure, or a foreign procedure
- -- which is registered using pragma Propagate_Exceptions), then the
- -- entry point information will indeed be correct. It may well be
- -- possible for Pop_Frame to avoid using the Info parameter (for
- -- example if it consults auxiliary Dwarf tables to do its job).
- -- This is desirable if it can be done, because it means that it
- -- will work fine to propagate exceptions through unregistered
- -- foreign procedures. What will happen is that the search in the
- -- Ada subprogram table will find a junk entry. Even if this junk
- -- entry has an exception table, none of them will apply to the
- -- current location, so they will be ignored, and then Pop_Frame
- -- will be called to pop the frame. The Info parameter for this
- -- call will be junk, but if it is not used that does not matter.
- -- Note that the address recorded in the traceback table is of
- -- the exception location, so the traceback will be correct even
- -- in this case.
-
- procedure Enter_Handler
- (M : Machine_State;
- Handler : System.Exceptions.Handler_Loc);
- -- When Propagate_Handler locates an applicable exception handler, it
- -- calls Enter_Handler, passing it two parameters. The first is the
- -- machine state that corresponds to what is required for entry to
- -- the handler, as computed by repeated Pop_Frame calls to reach the
- -- handler to be entered. The second is the code location for the
- -- handler itself which is the address of the label at the start of
- -- the handler code.
- --
- -- Note: The machine state M is likely stored on the part of the
- -- stack that will be popped by the call, so care must be taken
- -- not to pop the stack until the Machine_State is entirely read.
- -- The value passed as Handler was obtained from elaboration of
- -- an N_Handler_Loc node by the backend.
function Fetch_Code (Loc : Code_Loc) return Code_Loc;
-- Some architectures (notably VMS) use a descriptor to describe
-- a subprogram address. This function computes the actual starting
-- address of the code from Loc.
- -- Do not add pragma Inline, see 9116-002.
+ --
-- ??? This function will go away when 'Code_Address is fixed on VMS.
+ --
+ -- Do not add pragma Inline to this function: there is a curious
+ -- interaction between rtsfind and front-end inlining. The exception
+ -- declaration in s-auxdec calls rtsfind, which forces several other system
+ -- packages to be compiled. Some of those have a pragma Inline, and we
+ -- compile the corresponding bodies so that inlining can take place. One
+ -- of these packages is s-mastop, which depends on s-auxdec, which is still
+ -- being compiled: we have not seen all the declarations in it yet, so we
+ -- get confused semantic errors.
procedure Set_Machine_State (M : Machine_State);
-- This routine sets M from the current machine state. It is called
-- when an exception is initially signalled to initialize the state.
- procedure Set_Signal_Machine_State
- (M : Machine_State;
- Context : System.Address);
- -- This routine sets M from the machine state that corresponds to the
- -- point in the code where a signal was raised. The parameter Context
- -- is a pointer to a structure created by the operating system when a
- -- signal is raised, and made available to the signal handler. The
- -- format of this context block, and the manner in which it is made
- -- available to the handler, are implementation dependent.
-
end System.Machine_State_Operations;