diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-09-10 15:48:24 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-09-10 15:48:24 +0200 |
commit | 0856403616ac03ee6eb8cd2cb83f1e7274f9f909 (patch) | |
tree | d05ec157509a93c044dd5ded989eb1c39b6b7136 | |
parent | 8c4353b7c50bc8855a0abdd9d9514477de715a33 (diff) | |
download | gcc-0856403616ac03ee6eb8cd2cb83f1e7274f9f909.tar.gz |
[multiple changes]
2010-09-10 Jose Ruiz <ruiz@adacore.com>
* exp_cg.adb (Is_Predefined_Dispatching_Operation): Add the "__" scope
separator when trying the pattern matching to detect predefined
primitive operations.
2010-09-10 Robert Dewar <dewar@adacore.com>
* bindgen.adb, atree.adb: Minor reformatting.
2010-09-10 Ben Brosgol <brosgol@adacore.com>
* ug_words, gnat_ugn.texi: Revised "Transitioning to 64-Bit GNAT for
OpenVMS" section.
From-SVN: r164175
-rw-r--r-- | gcc/ada/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/ada/atree.adb | 8 | ||||
-rw-r--r-- | gcc/ada/bindgen.adb | 5 | ||||
-rw-r--r-- | gcc/ada/exp_cg.adb | 21 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 190 | ||||
-rw-r--r-- | gcc/ada/ug_words | 2 |
6 files changed, 158 insertions, 83 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index da9e0c06b78..c86e6235c8a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2010-09-10 Jose Ruiz <ruiz@adacore.com> + + * exp_cg.adb (Is_Predefined_Dispatching_Operation): Add the "__" scope + separator when trying the pattern matching to detect predefined + primitive operations. + +2010-09-10 Robert Dewar <dewar@adacore.com> + + * bindgen.adb, atree.adb: Minor reformatting. + +2010-09-10 Ben Brosgol <brosgol@adacore.com> + + * ug_words, gnat_ugn.texi: Revised "Transitioning to 64-Bit GNAT for + OpenVMS" section. + 2010-09-10 Doug Rupp <rupp@adacore.com> * bindgen.adb: Minor comment fix for -H switch. diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index 807527230af..6e01d7ed42e 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -1261,7 +1261,7 @@ package body Atree is -- New_Node_Breakpoint -- ------------------------- - procedure nn is -- New_Node_Breakpoint + procedure nn is begin Write_Str ("Watched node "); Write_Int (Int (Watch_Node)); @@ -1273,7 +1273,7 @@ package body Atree is -- New_Node_Debugging_Output -- ------------------------------- - procedure nnd (N : Node_Id) is -- New_Node_Debugging_Output + procedure nnd (N : Node_Id) is Node_Is_Watched : constant Boolean := N = Watch_Node; begin @@ -1666,7 +1666,7 @@ package body Atree is -- Rewrite_Breakpoint -- ------------------------- - procedure rr is -- Rewrite_Breakpoint + procedure rr is begin Write_Str ("Watched node "); Write_Int (Int (Watch_Node)); @@ -1678,7 +1678,7 @@ package body Atree is -- Rewrite_Debugging_Output -- ------------------------------ - procedure rrd (Old_Node, New_Node : Node_Id) is -- Rewrite_Debugging_Output + procedure rrd (Old_Node, New_Node : Node_Id) is Node_Is_Watched : constant Boolean := Old_Node = Watch_Node; begin diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index df47274e979..cbcc96bbd65 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -792,8 +792,9 @@ package body Bindgen is Write_Statement_Buffer; -- Generate call to Install_Handler - -- In .NET, when binding with -z, we don't install the signal - -- handler to let the caller handle the last exception handler. + + -- In .NET, when binding with -z, we don't install the signal handler + -- to let the caller handle the last exception handler. if VM_Target /= CLI_Target or else Bind_Main_Program diff --git a/gcc/ada/exp_cg.adb b/gcc/ada/exp_cg.adb index aad5157d9e3..14d13908292 100644 --- a/gcc/ada/exp_cg.adb +++ b/gcc/ada/exp_cg.adb @@ -271,12 +271,21 @@ package body Exp_CG is for J in Predef_Names_95'Range loop Get_Name_String (Predef_Names_95 (J)); - if Full_Name'Last - Suffix_Length > Name_Len + -- The predefined primitive operations are identified by the + -- names "_size", "_alignment", etc. If we try a pattern + -- matching against this string, we can wrongly match other + -- primitive operations like "get_size". To avoid this, we + -- add the "__" scope separator, which can only prepend + -- predefined primitive operations because other primitive + -- operations can neither start with an underline nor + -- contain two consecutive underlines in its name. + + if Full_Name'Last - Suffix_Length > Name_Len + 2 and then Full_Name - (Full_Name'Last - Name_Len - Suffix_Length + 1 + (Full_Name'Last - Name_Len - 2 - Suffix_Length + 1 .. Full_Name'Last - Suffix_Length) = - Name_Buffer (1 .. Name_Len) + "__" & Name_Buffer (1 .. Name_Len) then -- For the equality operator the type of the two operands -- must also match. @@ -291,12 +300,12 @@ package body Exp_CG is for J in Predef_Names_05'Range loop Get_Name_String (Predef_Names_05 (J)); - if Full_Name'Last - Suffix_Length > Name_Len + if Full_Name'Last - Suffix_Length > Name_Len + 2 and then Full_Name - (Full_Name'Last - Name_Len - Suffix_Length + 1 + (Full_Name'Last - Name_Len - 2 - Suffix_Length + 1 .. Full_Name'Last - Suffix_Length) = - Name_Buffer (1 .. Name_Len) + "__" & Name_Buffer (1 .. Name_Len) then return True; end if; diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 2f58df180c1..e22ac66ef48 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -8057,6 +8057,7 @@ be presented in subsequent sections. * Binder Error Message Control:: * Elaboration Control:: * Output Control:: +* Dynamic Allocation Control:: * Binding with Non-Ada Main Programs:: * Binding Programs with No Main Subprogram:: @end menu @@ -8168,6 +8169,17 @@ flag checks are generated. @cindex @option{^-h^/HELP^} (@command{gnatbind}) Output usage (help) information +@item ^-H32^/32_MALLOC^ +@cindex @option{^-H32^/32_MALLOC^} (@command{gnatbind}) +Use 32-bit allocations for @code{__gnat_malloc} (and thus for access types). +For further details see @ref{Dynamic Allocation Control}. + +@item ^-H64^/64_MALLOC^ +@cindex @option{^-H32^/32_MALLOC^} (@command{gnatbind}) +Use 64-bit allocations for @code{__gnat_malloc} (and thus for access types). +@cindex @code{__gnat_malloc} +For further details see @ref{Dynamic Allocation Control}. + @item ^-I^/SEARCH^ @cindex @option{^-I^/SEARCH^} (@command{gnatbind}) Specify directory to be searched for source and ALI files. @@ -8596,6 +8608,35 @@ be used to improve code generation in some cases. @end table +@node Dynamic Allocation Control +@subsection Dynamic Allocation Control + +@noindent +The heap control switches -- @option{-H32} and @option{-H64} -- +determine whether dynamic allocation uses 32-bit or 64-bit memory. +They only affect compiler-generated allocations via @code{__gnat_malloc}; +explicit calls to @code{malloc} and related functions from the C +run-time library are unaffected. + +@table @option +@item -H32 +Allocate memory on 32-bit heap + +@item -H64 +Allocate memory on 64-bit heap. This is the default +unless explicitly overridden by a @code{'Size} clause on the access type. +@end table + +@ifset vms +@noindent +See also @ref{Access types and 32/64-bit allocation}. +@end ifset +@ifclear vms +@noindent +These switches are only effective on VMS platforms. +@end ifclear + + @node Binding with Non-Ada Main Programs @subsection Binding with Non-Ada Main Programs @@ -26509,10 +26550,11 @@ Such code will be referred to below as @emph{64-bit code}. @menu * Address types:: -* Access types:: +* Access types and 32/64-bit allocation:: * Unchecked conversions:: * Predefined constants:: * Interfacing with C:: +* 32/64-bit descriptors:: * Experience with source compatibility:: @end menu @@ -26527,9 +26569,13 @@ approach has been taken: @itemize @bullet @item @code{System.Address} always has a size of 64 bits +@cindex @code{System.Address} size +@cindex @code{Address} size @item @code{System.Short_Address} is a 32-bit subtype of @code{System.Address} +@cindex @code{System.Short_Address} size +@cindex @code{Short_Address} size @end itemize @noindent @@ -26568,31 +26614,64 @@ required in any code setting or accessing the field; the compiler will automatically perform any needed conversions between address formats. -@node Access types -@subsubsection Access types +@node Access types and 32/64-bit allocation +@subsubsection Access types and 32/64-bit allocation +@cindex 32-bit allocation +@cindex 64-bit allocation @noindent -By default, objects designated by access values are always -allocated in the 32-bit -address space. Thus legacy code will never contain -any objects that are not addressable with 32-bit addresses, and -the compiler will never raise exceptions as result of mixing -32-bit and 64-bit addresses. +By default, objects designated by access values are always allocated in +the 64-bit address space, and access values themselves are represented +in 64 bits. If these defaults are not appropriate, and 32-bit allocation +is required (for example if the address of an allocated object is assigned +to a @code{Short_Address} variable), then several alternatives are available: -However, the access values themselves are represented in 64 bits, for optimum -performance and future compatibility with 64-bit code. As was -the case with @code{System.Address}, the compiler will give an error message -if an object or record component has a representation clause that -requires the access value to fit in 32 bits. In such a situation, -an explicit size clause for the access type, specifying 32 bits, -will have the desired effect. +@itemize @bullet +@item +A pool-specific access type (ie, an @w{Ada 83} access type, whose +definition is @code{access T} versus @code{access all T} or +@code{access constant T}), may be declared with a @code{'Size} representation +clause that establishes the size as 32 bits. +In such circumstances allocations for that type will +be from the 32-bit heap. Such a clause is not permitted +for a general access type (declared with @code{access all} or +@code{access constant}) as values of such types must be able to refer +to any object of the designated type, including objects residing outside +the 32-bit address range. Existing @w{Ada 83} code will not contain such +type definitions, however, since general access types were introduced +in @w{Ada 95}. + +@item +Switches for @command{GNAT BIND} control whether the internal GNAT +allocation routine @code{__gnat_malloc} uses 64-bit or 32-bit allocations. +@cindex @code{__gnat_malloc} +The switches are respectively @option{-H64} (the default) and +@option{-H32}. +@cindex @option{-H32} (@command{gnatbind}) +@cindex @option{-H64} (@command{gnatbind}) + +@item +The environment variable (logical name) @code{GNAT$NO_MALLOC_64} +@cindex @code{GNAT$NO_MALLOC_64} environment variable +may be used to force @code{__gnat_malloc} to use 32-bit allocation. +If this variable is left +undefined, or defined as @code{"DISABLE"}, @code{"FALSE"}, or @code{"0"}, +then the default (64-bit) allocation is used. +If defined as @code{"ENABLE"}, @code{"TRUE"}, or @code{"1"}, +then 32-bit allocation is used. The gnatbind qualifiers described above +override this logical name. + +@item +A ^gcc switch^gcc switch^ for OpenVMS, @option{-mno-malloc64}, operates +@cindex @option{-mno-malloc64} (^gcc^gcc^) +at a low level to convert explicit calls to @code{malloc} and related +functions from the C run-time library so that they perform allocations +in the 32-bit heap. +Since all internal allocations from GNAT use @code{__gnat_malloc}, +this switch is not required unless the program makes explicit calls on +@code{malloc} (or related functions) from interfaced C code. +@end itemize -General access types (declared with @code{access all}) can never be -32 bits, as values of such types must be able to refer to any object -of the designated type, -including objects residing outside the 32-bit address range. -Existing Ada 83 code will not contain such type definitions, -however, since general access types were introduced in Ada 95. @node Unchecked conversions @subsubsection Unchecked conversions @@ -26665,6 +26744,20 @@ pragma Convention(C, int_star); for int_star'Size use 64; -- Necessary to get 64 and not 32 bits @end smallexample +@node 32/64-bit descriptors +@subsubsection 32/64-bit descriptors + +@noindent +By default, GNAT uses a 64-bit descriptor mechanism. For an imported +subprogram (i.e., a subprogram identified by pragma @code{Import_Function}, +@code{Import_Procedure}, or @code{Import_Valued_Procedure}) that specifies +@code{Short_Descriptor} as its mechanism, a 32-bit descriptor is used. +@cindex @code{Short_Descriptor} mechanism for imported subprograms + +If the configuration pragma @code{Short_Descriptors} is supplied, then +all descriptors will be 32 bits. +@cindex pragma @code{Short_Descriptors} + @node Experience with source compatibility @subsubsection Experience with source compatibility @@ -26697,8 +26790,6 @@ these sorts of potential source code porting problems. * Making code 64 bit clean:: * Allocating memory from the 64 bit storage pool:: * Restrictions on use of 64 bit objects:: -* Using 64 bit storage pools by default:: -* General access types:: * STARLET and other predefined libraries:: @end menu @@ -26742,13 +26833,10 @@ Any attempt to do this will raise @code{Constraint_Error}. @subsubsection Allocating memory from the 64-bit storage pool @noindent -For any access type @code{T} that potentially requires memory allocations -beyond the 32-bit address space, -use the following representation clause: - -@smallexample @c ada - for T'Storage_Pool use System.Pool_64; -@end smallexample +By default, all allocations -- for both pool-specific and general +access types -- use the 64-bit storage pool. To override +this default, for an individual access type or globally, see +@ref{Access types and 32/64-bit allocation}. @node Restrictions on use of 64 bit objects @subsubsection Restrictions on use of 64-bit objects @@ -26763,46 +26851,6 @@ or assigning it to a variable of type @code{Short_Address}, will cause no exception is raised and execution will become erroneous. -@node Using 64 bit storage pools by default -@subsubsection Using 64-bit storage pools by default - -@noindent -In some cases it may be desirable to have the compiler allocate -from 64-bit storage pools by default. This may be the case for -libraries that are 64-bit clean, but may be used in both 32-bit -and 64-bit contexts. For these cases the following configuration -pragma may be specified: - -@smallexample @c ada - pragma Pool_64_Default; -@end smallexample - -@noindent -Any code compiled in the context of this pragma will by default -use the @code{System.Pool_64} storage pool. This default may be overridden -for a specific access type @code{T} by the representation clause: - -@smallexample @c ada - for T'Storage_Pool use System.Pool_32; -@end smallexample - -@noindent -Any object whose address may be passed to a subprogram with a -@code{Short_Address} argument, or assigned to a variable of type -@code{Short_Address}, needs to be allocated from this pool. - -@node General access types -@subsubsection General access types - -@noindent -Objects designated by access values from a -general access type (declared with @code{access all}) are never allocated -from a 64-bit storage pool. Code that uses general access types will -accept objects allocated in either 32-bit or 64-bit address spaces, -but never allocate objects outside the 32-bit address space. -Using general access types ensures maximum compatibility with both -32-bit and 64-bit code. - @node STARLET and other predefined libraries @subsubsection STARLET and other predefined libraries diff --git a/gcc/ada/ug_words b/gcc/ada/ug_words index 6d47ed473e5..5f694b9db84 100644 --- a/gcc/ada/ug_words +++ b/gcc/ada/ug_words @@ -218,3 +218,5 @@ stderr ^ SYS$ERROR -O1 ^ /OPTIMIZE=SOME -O2 ^ /OPTIMIZE=ALL -O3 ^ /OPTIMIZE=INLINING +-H32 ^ /32_MALLOC +-H64 ^ /64_MALLOC |