From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13694 invoked by alias); 2 Sep 2009 07:46:27 -0000 Received: (qmail 13683 invoked by uid 22791); 2 Sep 2009 07:46:23 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Sep 2009 07:46:18 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 3231E2900AB; Wed, 2 Sep 2009 09:46:15 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e0QWmZh8wHDg; Wed, 2 Sep 2009 09:46:08 +0200 (CEST) Received: from adijon-256-1-60-185.w81-51.abo.wanadoo.fr (ADijon-256-1-60-185.w81-51.abo.wanadoo.fr [81.51.195.185]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 175FA290072; Wed, 2 Sep 2009 09:46:08 +0200 (CEST) From: Eric Botcazou To: Ian Lance Taylor Subject: Re: [Patch] New -fstack-check implementation (2/n) Date: Wed, 02 Sep 2009 07:46:00 -0000 User-Agent: KMail/1.9.9 Cc: gcc-patches@gcc.gnu.org References: <200908041337.11922.ebotcazou@adacore.com> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200909020945.35508.ebotcazou@adacore.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00100.txt.bz2 > I know this follows the exisitng pattern of STACK_CHECK_PROBE_LOAD, but > I think it would be better to use an insn. Why not use introduce a > check_stack_probe insn? Or, since your patch is eliminating the > check_stack insn, why not reuse that? Yes, I agree that the STACK_CHECK_PROBE_* interface could be changed. > I find this documentation to be somewhat cryptic. If I understand > correctly, when this macro is defined, gcc will adjust the stack pointer > page by page when doing probes. Please say that in the doc. It's not > clear to me why the Linux kernel requires this--can you expand on that? On x86 and x86-64 Linux, you cannot probe below the page that contains the current stack pointer, you get a SIGSEGV. See the discussion with one of your coworkers last year: http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00869.html That seems to be unique to this couple of kernels, no problem on other OSes or on IA-64. > And why a target macro rather than a target hook for something new? For consistency, all the stack checking is parameterized with macros. I agree that this could be changed. > Letting the frontend set a global variable in the middle end seems to me > to be an ugly interface. Why did you change away from the > set_stack_check_libfunc function? Because back-ends need to have access to the variable as well. > Much more seriously, I don't see how this can work when using LTO. In > LTO, by the time we expand stack checking, the frontend is gone. This > needs to work differently. OK, let's drop stack checking with run-time support for the time being, this only affects VxWorks in practice. > > void > > probe_stack_range (HOST_WIDE_INT first, rtx size) > > { > > +#ifdef SPARC_STACK_BIAS > > + /* The probe offsets are counted negatively whereas the stack bias is > > + counted positively. */ > > + first -= SPARC_STACK_BIAS; > > +#endif > > This does not look good in target independent code. This needs to > become an officially named and documented target hook. OK, let's drop this hack for now. > > +#if defined(HAVE_conditional_trap) > > + emit_insn (gen_cond_trap (LTU, avail, req, const0_rtx)); > > +#elif defined(HAVE_trap) > > It's not enough to check the #ifdef; you also have to check available > with if (). OK. Let's drop it anyway, this is for VxWorks only. -- Eric Botcazou