comp.lang.ada
 help / color / mirror / Atom feed
* PLEASE HELP ME
@ 1998-10-21  0:00 DENIS
  1998-10-22  0:00 ` Tucker Taft
  0 siblings, 1 reply; 5+ messages in thread
From: DENIS @ 1998-10-21  0:00 UTC (permalink / raw)



    Please , I do not have any clue in Ada95, but I do have to know how to
determine the order parameters are put on the stack.

    Please write as soons is possible.

             This is my email : datodia@hotmail.com






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PLEASE HELP ME
  1998-10-21  0:00 PLEASE HELP ME DENIS
@ 1998-10-22  0:00 ` Tucker Taft
  0 siblings, 0 replies; 5+ messages in thread
From: Tucker Taft @ 1998-10-22  0:00 UTC (permalink / raw)


DENIS (denis23@ix.netcom.com) wrote:

:     Please , I do not have any clue in Ada95, but I do have to know how to
: determine the order parameters are put on the stack.

:     Please write as soons is possible.

This is implementation-dependent.  Perhaps it would be in the
documentation provided by the Ada vendor, in the area of interfacing
with assembly language.  Furthermore, note that these days, not
all parameters are passed on the stack.  For most RISC machines,
at least a few parameters are passed in registers.

You could write your own test case using 'Address which might tell you
something.  E.g.:

  with system.storage_elements; use system.storage_elements;
  with ada.text_io; use ada.text_io;
  procedure stack_order is
    procedure p(A, B, C, D, E, F, G, H, I, J : Integer) is
    begin
      put_line("A'address = " & Integer_Address'Image(To_Integer(A'Address)));
      put_line("B'address = " & Integer_Address'Image(To_Integer(B'Address)));
      put_line("C'address = " & Integer_Address'Image(To_Integer(C'Address)));
      ...
    end p;
  begin
    p(1,2,3,4,5,6,7,8,9,10);
  end stack_order;

:              This is my email : datodia@hotmail.com

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA
An AverStar Company




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Please, help me.
  2005-08-06 11:21 ` How to set the stack size on GNAT (Follow-up) Adaddict
@ 2005-08-07 12:33   ` Adaddict
  2005-08-07 14:11     ` Jeff Creem
  0 siblings, 1 reply; 5+ messages in thread
From: Adaddict @ 2005-08-07 12:33 UTC (permalink / raw)


I know this questions must seem stupid (I'm sure they really are), but I'm
getting desesperated because I'm not getting those ways of setting the
stack size to work.

Sorry for being a nuisance.

Regards.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Please, help me.
  2005-08-07 12:33   ` Please, help me Adaddict
@ 2005-08-07 14:11     ` Jeff Creem
  2005-08-07 15:16       ` Ludovic Brenta
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Creem @ 2005-08-07 14:11 UTC (permalink / raw)


Adaddict wrote:
> I know this questions must seem stupid (I'm sure they really are), but I'm
> getting desesperated because I'm not getting those ways of setting the
> stack size to work.
> 
> Sorry for being a nuisance.
> 
> Regards.
> 

I've always tried to find ways of avoiding having the main task require 
a large stack. On some OSs, there is no good way to do it at link time 
at all. Is there any way you can restructure your code so you don't need 
a large stack (e.g. If there is a set of large variables within the

procedure blah is
   large variables

begin

end;

then moving all of the large variables to a package spec that the 
procedure blah withs will reduce the stack space.

If it is the sum of lots of littler things through the program then 
perhaps using the storage_size attribute on a new task that does all of 
the real work of the program (with the main thread just terminating) 
will work.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Please, help me.
  2005-08-07 14:11     ` Jeff Creem
@ 2005-08-07 15:16       ` Ludovic Brenta
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Brenta @ 2005-08-07 15:16 UTC (permalink / raw)


Jeff Creem <jcreem@yahoo.com> writes:
[...]
> If there is a set of large variables within the
>
> procedure blah is
>    large variables
>
> begin
>
> end;
>
> then moving all of the large variables to a package spec that the
> procedure blah withs will reduce the stack space.
>
> If it is the sum of lots of littler things through the program then
> perhaps using the storage_size attribute on a new task that does all
> of the real work of the program (with the main thread just
> terminating) will work.

I have observed that array or record aggregates tend to be allocated
on the stack, too.  Array aggregates are particularly surprising since
they're easy to replace with loops.  For example:

procedure Proc is
   type T is array (1 .. 100_000) of Integer;
   A : T;
begin
   A := (others => 42); 
end Proc;

allocates two large arrays on the stack (A and the aggregate) with
some compilers I've used.  In contrast:

procedure Proc is
   type T is array (1 .. 100_000) of Integer;
   A : T;
begin
   for J in A'Range loop
      A (J) := 42;
   end loop;
end Proc;

allocates just one array on the stack.

Back on topic, setting the stack size depends on the target operating
system and on the host linker.  There are even situations where it is
not possible to set the stack size at all.

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-07 15:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-21  0:00 PLEASE HELP ME DENIS
1998-10-22  0:00 ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
2005-08-05  0:55 STORAGE_ERROR : EXCEPTION_STACK_OVERFLOW Adaddict
2005-08-06 11:21 ` How to set the stack size on GNAT (Follow-up) Adaddict
2005-08-07 12:33   ` Please, help me Adaddict
2005-08-07 14:11     ` Jeff Creem
2005-08-07 15:16       ` Ludovic Brenta

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