delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/10/22/22:22:24

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Date: Mon, 22 Oct 2001 22:23:24 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Re: 1.3.4 status?
Message-ID: <20011022222324.B20427@redhat.com>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: cygwin-developers AT cygwin DOT com
References: <02a201c15b5b$7910a4d0$0200a8c0 AT lifelesswks> <20011022204740 DOT B18754 AT redhat DOT com> <20011023005236 DOT 7136 DOT qmail AT lizard DOT curl DOT com> <20011022205828 DOT C18754 AT redhat DOT com> <02ea01c15b5f$7e673bc0$0200a8c0 AT lifelesswks> <20011022212759 DOT A19493 AT redhat DOT com> <032701c15b64$ea5523b0$0200a8c0 AT lifelesswks> <20011022215102 DOT A20341 AT redhat DOT com> <033101c15b66$24fc2260$0200a8c0 AT lifelesswks> <033701c15b68$f3684d70$0200a8c0 AT lifelesswks>
Mime-Version: 1.0
In-Reply-To: <033701c15b68$f3684d70$0200a8c0@lifelesswks>
User-Agent: Mutt/1.3.21i

On Tue, Oct 23, 2001 at 12:18:05PM +1000, Robert Collins wrote:
>on every call, it checks the stack depth. _everything_ allocated from a
>call point deeper in the stack is reclaimed, and freed (alloca only uses
>the stack to identify when to do stuff, not for storage).

That's what libiberty's alloca does.  That is for systems for which a
real alloca is difficult or impossible.  That isn't what the builtin
alloca does.

The alloca that cygwin uses is below.  This is from
gcc/config/i386/cygwin.asm.

It is possible that a function would call __chkstk when it needed to
allocate space beyond a certain limit.  Not every function begins with a
call to __chkstk/alloca, though.

cgf

/* stuff needed for libgcc on win32. */

#ifdef L_chkstk

        .global ___chkstk
        .global __alloca
___chkstk:
__alloca:
        pushl  %ecx             /* save temp */
        movl   %esp,%ecx        /* get sp */
        addl   $0x8,%ecx        /* and point to return addr */

probe:  cmpl   $0x1000,%eax     /* > 4k ?*/
        jb    done              

        subl   $0x1000,%ecx             /* yes, move pointer down 4k*/
        orl    $0x0,(%ecx)              /* probe there */
        subl   $0x1000,%eax             /* decrement count */
        jmp    probe                    /* and do it again */

done:   subl   %eax,%ecx           
        orl    $0x0,(%ecx)      /* less that 4k, just peek here */

        movl   %esp,%eax
        movl   %ecx,%esp        /* decrement stack */

        movl   (%eax),%ecx      /* recover saved temp */
        movl   4(%eax),%eax     /* get return address */
        jmp    *%eax    


#endif

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019