Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / ada / s-mastop.ads
blob39138bc3929613a93386ada6fa27fe4d487f55d9
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- SYSTEM.MACHINE_STATE_OPERATIONS --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1999-2007, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 pragma Warnings (Off);
35 pragma Compiler_Unit;
36 pragma Warnings (On);
38 pragma Polling (Off);
39 -- We must turn polling off for this unit, because otherwise we get
40 -- elaboration circularities with System.Exception_Tables.
42 with System.Storage_Elements;
44 package System.Machine_State_Operations is
46 subtype Code_Loc is System.Address;
47 -- Code location used in building exception tables and for call
48 -- addresses when propagating an exception (also traceback table)
49 -- Values of this type are created by using Label'Address or
50 -- extracted from machine states using Get_Code_Loc.
52 type Machine_State is new System.Address;
53 -- The table based exception handling approach (see a-except.adb) isolates
54 -- the target dependent aspects using an abstract data type interface
55 -- to the type Machine_State, which is represented as a System.Address
56 -- value (presumably implemented as a pointer to an appropriate record
57 -- structure).
59 function Machine_State_Length return System.Storage_Elements.Storage_Offset;
60 -- Function to determine the length of the Storage_Array needed to hold
61 -- a machine state. The machine state will always be maximally aligned.
62 -- The value returned is a constant that will be used to allocate space
63 -- for a machine state value.
65 function Allocate_Machine_State return Machine_State;
66 -- Allocate the required space for a Machine_State
68 procedure Free_Machine_State (M : in out Machine_State);
69 -- Free the dynamic memory taken by Machine_State
71 -- The initial value of type Machine_State is created by the low level
72 -- routine that actually raises an exception using the special builtin
73 -- _builtin_machine_state. This value will typically encode the value
74 -- of the program counter, and relevant registers. The following
75 -- operations are defined on Machine_State values:
77 function Get_Code_Loc (M : Machine_State) return Code_Loc;
78 -- This function extracts the program counter value from a machine
79 -- state, which the caller uses for searching the exception tables,
80 -- and also for recording entries in the traceback table. The call
81 -- returns a value of Null_Loc if the machine state represents the
82 -- outer level, or some other frame for which no information can be
83 -- provided.
85 procedure Pop_Frame (M : Machine_State);
86 -- This procedure pops the machine state M so that it represents the
87 -- call point, as though the current subprogram had returned. It
88 -- changes only the value referenced by M, and does not affect
89 -- the current stack environment.
91 function Fetch_Code (Loc : Code_Loc) return Code_Loc;
92 -- Some architectures (notably VMS) use a descriptor to describe
93 -- a subprogram address. This function computes the actual starting
94 -- address of the code from Loc.
96 -- ??? This function will go away when 'Code_Address is fixed on VMS.
98 -- Do not add pragma Inline to this function: there is a curious
99 -- interaction between rtsfind and front-end inlining. The exception
100 -- declaration in s-auxdec calls rtsfind, which forces several other system
101 -- packages to be compiled. Some of those have a pragma Inline, and we
102 -- compile the corresponding bodies so that inlining can take place. One
103 -- of these packages is s-mastop, which depends on s-auxdec, which is still
104 -- being compiled: we have not seen all the declarations in it yet, so we
105 -- get confused semantic errors.
107 procedure Set_Machine_State (M : Machine_State);
108 -- This routine sets M from the current machine state. It is called
109 -- when an exception is initially signalled to initialize the state.
111 end System.Machine_State_Operations;