From: Dmitry A. Kazakov on 8 Oct 2009 05:11 On Wed, 7 Oct 2009 17:48:56 -0700 (PDT), Yannick Duch�ne Hibou57 wrote: > I understand what you mean about testing, but I am mainly looking for > average answers. The average answer is that any static constraint known to hold must be specified. Rationale: this weakens the precondition, which the compiler should otherwise check dynamically, i.e. possibly generate some additional code. For non-static constraints the rule is opposite, because it strengthens the precondition. So: in before in out constant before <nothing> pool specific before general access But: not null vs. <nothing> depends on the where that constraint was put subtype vs. type, ditto specific type vs. class, ditto -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
From: Gautier write-only on 8 Oct 2009 05:38 > I understand what you mean about testing, but I am mainly looking for > average answers. Just things to know and to have in mind. Even if > there is no required implementation, it is well known that a lot of > compilers share some common implementation designs. I'm seeking for > informations about it, just like the way I'm sometime reading about > general tips or thoughts (I used to do the same with some prior > languages like Pascal and Eiffel, it's a bit part of learning the > thing). So here is my rule: use only "in" (whenever possible), "in out" and "out" and you will be happy. These modes are meaningful for you and the compiler knows how to handle it efficiently. Especially the compiler will consider passing by copy, even through a register (and not on the stack), an "in" parameter: procedure P_in(i: in Integer; s: in String) is begin Put_Line(Integer'Image(i)); Put_Line(s); end; -> through GNAT GPL 2008 with -gnatp -O2: movl %edi, %edx movl %esi, %ecx movl $5678, %eax call _test_in_out__p_in.1893 _________________________________________________________ Gautier's Ada programming -- http://sf.net/users/gdemont/ NB: For a direct answer, e-mail address on the Web site!
From: Gautier write-only on 8 Oct 2009 05:55 > I understand what you mean about testing, but I am mainly looking for > average answers. Just things to know and to have in mind. Even if > there is no required implementation, it is well known that a lot of > compilers share some common implementation designs. I'm seeking for > informations about it, just like the way I'm sometime reading about > general tips or thoughts (I used to do the same with some prior > languages like Pascal and Eiffel, it's a bit part of learning the > thing). So here is my rule: use only "in" (whenever possible), "in out" and "out" and you will be happy. These modes are meaningful for you and the compiler knows how to handle it efficiently. Especially the compiler will consider passing by copy, even through a register (and not on the stack), an "in" parameter: procedure P_in(i: in Integer; s: in String) is begin Put_Line(Integer'Image(i)); Put_Line(s); end; The call P_in(5678,s) is compiled by GNAT GPL 2008 with (-gnatp -O2) as: movl %edi, %edx movl %esi, %ecx movl $5678, %eax call _test_in_out__p_in.1893 _________________________________________________________ Gautier's Ada programming -- http://sf.net/users/gdemont/ NB: For a direct answer, e-mail address on the Web site!
From: Yannick Duchêne Hibou57 on 8 Oct 2009 12:04 On 8 oct, 11:55, Gautier write-only <gautier_niou...(a)hotmail.com> wrote: > The call P_in(5678,s) is compiled by GNAT GPL 2008 with (-gnatp -O2) > as: > > movl %edi, %edx > movl %esi, %ecx > movl $5678, %eax > call _test_in_out__p_in.1893 I was always using the -S option to be passed to GCC, but this was not building to whole application, so this was not meaningful. I've just learned the -save-temps is to be used instead : this keep assembly files *and* build the whole application (providing the compiler is or is based on GCC) Otherwise generics does not show anything, this option solve to it. Do some one have examples from other Ada compilers ? (GNAT is not the only one).
From: Yannick Duchêne Hibou57 on 8 Oct 2009 12:46 There is also an option named -fverbose-asm which leaves more informations in the assembly, like some variable names and other more or less readable stuff, but seemingly no source line numbers. This help to see interesting things.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Barrier re-evaluation issue with GNAT 4.3.2 Next: GTKADA Installation Questions |