Mail Archives: cygwin-developers/2001/10/22/20:30:23

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: <>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <>
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 20:31:22 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Re: won't compile with --enable-debugging
Message-ID: <>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: cygwin-developers AT cygwin DOT com
References: <20011022202804 DOT 5132 DOT qmail AT lizard DOT curl DOT com> <025a01c15b58$bcf61ca0$0200a8c0 AT lifelesswks>
Mime-Version: 1.0
In-Reply-To: <025a01c15b58$bcf61ca0$0200a8c0@lifelesswks>
User-Agent: Mutt/1.3.21i

On Tue, Oct 23, 2001 at 10:22:01AM +1000, Robert Collins wrote:
>In addition to Chris's comment, I'd like to point out that this function
>should be as streamlined for speed as possible (it can potentially get
>called a lot)..
>__check_invalid_read_ptr_errno (const void *s, unsigned sz)
>  if (s && !IsBadReadPtr ((void *) s, sz))
>    return 0;
>  set_errno (EFAULT);
>  return EFAULT;
>is probably better. (I've been doing a little code tuning research
>recently. One thing that stood out was that if() tests should have the
>most common branch as the {}, and drop through to the least common

Good point.  In this case, __check_invalid_read_ptr_errno is only called
by write but it doesn't hurt to optimize things a little.

I looked at the assembly code that results from inverting the test and it
is suprisingly more compact.

You may notice that this is a regparm() function.  I've been sprinkling
regparm() around many of the function declarations.  This makes more
efficient code, too, AFAICT.

Using __stdcall results in having the callee pop the stack via a 'ret
nn' rather than having the caller perform stack arithmetic.  That seems
to help some, too.

It's not really needed for the cases where regparm is able to put all
of the arguments in registers but I use it anyway whereever possible
just in case I need to add a register later on.


- Raw text -

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