From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,41f54053ba96c4cb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-22 00:20:35 PST From: "Martin Dowie" Newsgroups: comp.lang.ada References: <3b321d2f$1@pull.gecm.com> <3B327146.C1B43717@boeing.com> <3B32DFEB.1786FEE5@CCI.Sema.de> Subject: Re: Data Elaboration Date: Fri, 22 Jun 2001 08:23:45 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: sg2c11210.dsge.edinbr.gmav.gecm.com Message-ID: <3b32efb0$1@pull.gecm.com> X-Trace: 22 Jun 2001 08:11:44 GMT, sg2c11210.dsge.edinbr.gmav.gecm.com Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!dispose.news.demon.net!demon!btnet-peer0!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!sg2c11210.dsge.edinbr.gmav.gecm.com Xref: archiver1.google.com comp.lang.ada:9022 Date: 2001-06-22T08:23:45+01:00 List-Id: Ok then, here's part 2 of the question! Given that they will be elaborated in order (I was looking at section 3.3.1 not 3.11 :-(. If I change that to - with My_Allocator; package Blah is Bool1 : Boolean; -- always elaborates first pragma Import (Ada, Bool1); pragma Volatile (Bool1); for Bool1'Address use My_Allocator (Bool1'Size); Bool2 : Boolean; -- always elaborates second pragma Import (Ada, Bool2); pragma Volatile (Bool2); for Bool2'Address use My_Allocator (Bool2'Size); Int1 : Integer; -- always elaborates third pragma Import (Ada, Int1); pragma Volatile (Int1); for Int'Address use My_Allocator (Int1'Size); end Blah; where My_Allocator assigns memory space from a particular start address, my objects will always elaborate to the same locations, yes? (My_Allocator containing a protect object to ensure sequential calculation of the addresses). Vincent Smeets wrote in message news:3B32DFEB.1786FEE5@CCI.Sema.de... > Jeffrey Carter wrote: > > > > Martin Dowie wrote: > > > > > > IF I have a package containing data object declarations, is > > > it specified with the RM that they will be elaborated in > > > the same order every time? e.g. > > > > > > package Blah is > > > > > > Bool1 : Boolean; -- always elaborates first > > > > > > Bool2 : Boolean; -- always elaborates second > > > > > > Int1 : Integer; -- always elaborates third > > > > > > end Blah; > > > > Yes. > > > > ARM 3.11(7) says "The elaboration of a declarative_part consists of the > > elaboration of the declarative_items, if any, in the order in which they > > are given in the declarative_part." > > The answer is correct but I want to extend it with my practical view. > > The above declartions require no special processing. The only thing that > has to be done is to reserve space in memory. This can be done by > extending the non initialize data segment or (in case of local > declarations) by changing the stack pointer. So you see that the > elaboration of these three variables can be done with one instruction > (all three at the same time). > > An other case are variables initialized by constants. See the following > declarations: > Bool1 : Boolean := True; > Bool2 : Boolean := False; > Here (in case of global variables), room is allocated in the initialized > data segment which is initialized at startup of the program by copying > the values from the Object file to memory. In case of local variables, > the room is allocated at the stack and initialized. The compiler can > optimize the elaboration by copying more than one values to more than > one variables. (It can copy 8 bytes to the memory consiting of Bool1 and > Bool2). > > Consider the case of initialized by Functions/variables. See the > following declarations: > Bool1 : Boolean := Pkg2.Func1; > Bool2 : Boolean := Pkg2.Bool; > Here the elaboration has to be done in order. The compiler can not know > if the function Pkg2.Func1 will cange the value of Pkg2.Bool1. > > > > -- Vincent Smeets Competence Center Informatik GmbH > -- Tel. : +49-5931-805461 Postfach 1225 > -- Fax : +49-5931-805175 49702 Meppen, Germany > -- mailto:Vincent.Smeets@CCI.Sema.de http://www.CCI.de/ > -- PGP fingerprint: E2437E38AAA9CA7D A31E7D751F1B6454 8AED7B76