public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* ppc and maybe also other cpu's stack problem
@ 2000-07-07 10:40 Ralph Schmidt
  2000-07-07 11:59 ` Joern Rennecke
  0 siblings, 1 reply; 4+ messages in thread
From: Ralph Schmidt @ 2000-07-07 10:40 UTC (permalink / raw)
  To: gcc

 Hello

Let's assume you have a lot constructs like this below gcc generates
*really* ugly code. It seems to grow the stack more and more and is
unable to see that the structs have no meaning outside of its lifetime.
It could simply make some kind of  stack union for these temp stack
extensions.
Do I miss something here or is there a cure for this problem in the
current gcc or in the coming version ?

Regards.

Little example:

void	func(void)
{

{
struct dumdidum big;
  DoSomething(&big);
}

{
struct dumdidum big;
  DoSomething(&big);
}

{
struct dumdidum big;
  DoSomething(&big);
}

}
---
Ralph Schmidt,laire@t-online.de(private),NextMail welcome 

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

* Re: ppc and maybe also other cpu's stack problem
  2000-07-07 10:40 ppc and maybe also other cpu's stack problem Ralph Schmidt
@ 2000-07-07 11:59 ` Joern Rennecke
  0 siblings, 0 replies; 4+ messages in thread
From: Joern Rennecke @ 2000-07-07 11:59 UTC (permalink / raw)
  To: laire; +Cc: gcc

> Do I miss something here or is there a cure for this problem in the
> current gcc or in the coming version ?

Have you tried -fno-strict-aliasing?

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

* Re: ppc and maybe also other cpu's stack problem
  2000-07-10  9:39 Thomas R. Truscott
@ 2000-07-10  9:55 ` Ralph Schmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Ralph Schmidt @ 2000-07-10  9:55 UTC (permalink / raw)
  To: gcc

You wrote:
> The following allocates two copies of struct dumdidum on stack:
> 
> > void    func(void)
> > {
> > { struct dumdidum big; DoSomething(&big); }
> > { struct dumdidum big; DoSomething(&big); }
> > }
> 
> 
> The reason is that preserve_temp_slots in function.c
> decrements the "level" of the struct when its address
> is taken, in case it is used as a result
> of a ({...}) construct (see comment on lines 1086..1093 of function.c
> 

I'll look at it.

> Obviously in this case no ({...}) construct is involved.
> There may be a simple fix for this simple case,
> but preseve_temp_slots is called from lots of places which was
> worrisome, and also some of the comments seemed at odds with the code.
> 

In reality it is a ({ construct and it's essentiell for inline os call macros
for me. Now imagine a lot of these calls in a function and suddenly
your stack runs amok and there's no other way to handle this.


> I suspect this code is mostly in limbo, awaiting
> a more comprehensively efficient way to allocate stack space.
> 

Indeed.

Regards

---
Ralph Schmidt,laire@t-online.de(private),NextMail welcome 

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

* Re: ppc and maybe also other cpu's stack problem
@ 2000-07-10  9:39 Thomas R. Truscott
  2000-07-10  9:55 ` Ralph Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas R. Truscott @ 2000-07-10  9:39 UTC (permalink / raw)
  To: gcc

The following allocates two copies of struct dumdidum on stack:

> void    func(void)
> {
> { struct dumdidum big; DoSomething(&big); }
> { struct dumdidum big; DoSomething(&big); }
> }


The reason is that preserve_temp_slots in function.c
decrements the "level" of the struct when its address
is taken, in case it is used as a result
of a ({...}) construct (see comment on lines 1086..1093 of function.c

Obviously in this case no ({...}) construct is involved.
There may be a simple fix for this simple case,
but preseve_temp_slots is called from lots of places which was
worrisome, and also some of the comments seemed at odds with the code.

I suspect this code is mostly in limbo, awaiting
a more comprehensively efficient way to allocate stack space.

Tom Truscott 

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

end of thread, other threads:[~2000-07-10  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-07 10:40 ppc and maybe also other cpu's stack problem Ralph Schmidt
2000-07-07 11:59 ` Joern Rennecke
2000-07-10  9:39 Thomas R. Truscott
2000-07-10  9:55 ` Ralph Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).