comp.lang.ada
 help / color / mirror / Atom feed
From: anon@anon.org (anon)
Subject: Re: Largest size array in Gnat 2005 for the PC?
Date: Wed, 31 Oct 2007 06:32:52 GMT
Date: 2007-10-31T06:32:52+00:00	[thread overview]
Message-ID: <okVVi.38106$kj1.30067@bgtnsc04-news.ops.worldnet.att.net> (raw)
In-Reply-To: 13idb3jbm28kfbe@corp.supernews.com

--
-- With the following info from GNAT Users Guide, it seams that GNAT 
-- limits an arrays to default to 32-bit size on a 32-bit machine. 
-- Since you can not access more than 32-bits for an access type
-- aka for arrays ( Array'ADDRESS + Array_index ) then your array is 
-- limited to:
--
--     2GB >= ( 32-bits / Array_Element_Type'SIZE )
-- 
-- The documentation also states GNAT limits memory access to 2G 
-- for a 32-bit systems
-- 


-- From the "Compatibility and Porting Guide" aka Appendix E of 
-- the GNAT User Guide. GCC-GNAT-4.3.0

-- QUOTE

        A common assumption in Ada 83 code is that an access type is 
in fact a pointer, and that therefore it will be the same size as a 
System.Address value.  This assumption is true for GNAT in most cases 
with one exception.  For the case of a pointer to an unconstrained 
array type (where the bounds may vary from one value of the access 
type to another), the default is to use a "fat pointer", which is 
represented as two separate pointers, one to the bounds, and one to 
the array.  This representation has a number of advantages, including 
improved efficiency.  However, it may cause some difficulties in 
porting existing Ada 83 code which makes the assumption that, for 
example, pointers fit in 32 bits on a machine with 32-bit addressing.

        To get around this problem, GNAT also permits the use of 
"thin pointers" for access types in this case (where the designated 
type is an unconstrained array type).  These thin pointers are indeed 
the same size as a System.Address value. 

To specify a thin pointer, use a size clause for the type, for example:

        type X is access all String;
        for X'Size use Standard'Address_Size;

which will cause the type X to be represented using a single pointer.
When using this representation, the bounds are right behind the array.
This representation is slightly less efficient, and does not allow quite
such flexibility in the use of foreign pointers or in using the
Unrestricted_Access attribute to create pointers to non-aliased objects.
But for any standard portable use of the access type it will work in
a functionally correct manner and allow porting of existing code.
Note that another way of forcing a thin pointer representation
is to use a component size clause for the element size in an array,
or a record representation clause for an access field in a record.

-- QUOTE

-- Transitioning to 64-Bit GNAT for OpenVMS

-- QUOTE

Migration of 32 bit code, will focus on porting applications
that do not require more than 2 GB of addressable memory. This 
code will be referred to as 32-bit code.

-- QUOTE

-- QUOTE

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.

-- QUOTE


In <13idb3jbm28kfbe@corp.supernews.com>, "ME" <abcdefg@nonodock.net> writes:
>What is the largest array (in storage units) that you can declare in Gnat 
>2005 for the PC?
>Does pragma Storage_ size affect this and if so where would you place it in 
>a procedure? 
>
>




  parent reply	other threads:[~2007-10-31  6:32 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30  4:00 Largest size array in Gnat 2005 for the PC? ME
2007-10-30  7:08 ` Martin Krischik
2007-10-30 12:27   ` Florian Weimer
2007-10-30 14:16   ` ME
2007-10-30 14:47     ` Pascal Obry
2007-10-30 18:58     ` Martin Krischik
2007-10-31  5:38       ` ME
2007-10-30 16:07   ` virtual memory, was " tmoran
2007-10-30 19:17     ` Martin Krischik
2007-10-30 20:35     ` Ludovic Brenta
2007-10-31  5:53   ` ME
2007-10-30  7:28 ` Pascal Obry
2007-10-30  9:47   ` Ludovic Brenta
2007-10-30 19:26     ` Georg Bauhaus
2007-10-30 20:17       ` Adam Beneschan
2007-10-30 22:53         ` tmoran
2007-10-30 23:39           ` Georg Bauhaus
2007-10-30 20:24       ` Adam Beneschan
2007-10-30 21:40         ` Georg Bauhaus
2007-10-30 21:48           ` Adam Beneschan
2007-10-30 21:50           ` Georg Bauhaus
2007-10-30 13:50   ` ME
2007-10-30 14:44     ` Pascal Obry
2007-10-30 15:00       ` Stefan Bellon
2007-10-30 15:16         ` Pascal Obry
2007-10-30 15:22           ` Stefan Bellon
2007-10-31  5:52         ` ME
2007-10-31  9:22           ` Stefan Bellon
2007-10-31 13:33             ` ME
2007-10-31 14:36               ` Stefan Bellon
2007-10-30 17:27 ` anon
2007-10-30 19:06   ` Adam Beneschan
2007-10-31  6:32 ` anon [this message]
2007-11-01  4:13   ` ME
2007-11-01  8:44     ` Stefan Bellon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox