From patchwork Wed Feb 10 14:15:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Matz X-Patchwork-Id: 581426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 692CB140783 for ; Thu, 11 Feb 2016 01:15:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=AunkxU5o; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; q=dns; s=default; b=nQqX9TQh+1tSF2PF v11jSxlSPpcxHxjoNlkbksGsU4NyMbdVlrQyrertTG8qSSWhBu1MQdzz6P16RN35 EVTHvZMmM6U9ZwcDYHw8baDtKvwLzRNe3kLNZ0UGSzZVyP4SMEH9BZk1P33gFNtO BzLxxbZ2lxsymfhJ+CriTwyuoF8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; s=default; bh=wIko4ZE5ps5Ylam6U5NZ/b WVlqM=; b=AunkxU5o7ovREATXbnfx23KRcnBXPfE0O6sPTamO9WLpCfZJ4Mn9RD zSzsNru5q6wRvq/cTBE0i3bnEA4UgANVbE1bYmj1UNZL4+uL8+k7znEULTEgwJ1z 5i0eHh+bRqPOnRQRFlm5/nQ1UPFQU8csDFiYOjoctyb5VDfkRnDxc= Received: (qmail 110508 invoked by alias); 10 Feb 2016 14:15:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 109000 invoked by uid 89); 10 Feb 2016 14:15:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=elapsed, timevar_start, Hx-languages-length:2037, mutual X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 10 Feb 2016 14:15:19 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 36441AD7A; Wed, 10 Feb 2016 14:15:14 +0000 (UTC) Date: Wed, 10 Feb 2016 15:15:14 +0100 (CET) From: Michael Matz To: Richard Biener cc: Eric Botcazou , GCC Patches Subject: Re: [patch] Fix timevar internal consistency failure In-Reply-To: Message-ID: References: <5199603.qFIMbjzvif@polaris> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 X-IsSubscribed: yes Hi, On Wed, 10 Feb 2016, Richard Biener wrote: > > The problem is that TV_PHASE_DBGINFO is now nested within > > TV_PHASE_OPT_GEN, which violates the above mutual exclusivity > > requirement. Therefore the attached patch simply gets rid of > > TV_PHASE_DBGINFO (as well as of the sibling TV_PHASE_CHECK_DBGINFO > > which was already unused). > > > > Tested on x86_64-suse-linux, OK for the mainline? > > Ok. I had this in my tree for a while, asserting that such nesting doesn't happen (it asserts that we're always in some phase, and that phases don't nest). Might be a good addition for gcc 7. Ciao, Michael. Index: timevar.c =================================================================== --- timevar.c (revision 232927) +++ timevar.c (working copy) @@ -325,6 +325,8 @@ timer::push (timevar_id_t timevar) push_internal (tv); } +static timevar_id_t global_phase; + /* Push TV onto the timing stack, either one of the builtin ones for a timevar_id_t, or one provided by client code to libgccjit. */ @@ -350,6 +352,8 @@ timer::push_internal (struct timevar_def if (m_stack) timevar_accumulate (&m_stack->timevar->elapsed, &m_start_time, &now); + gcc_assert (global_phase >= TV_PHASE_SETUP + && global_phase <= TV_PHASE_FINALIZE); /* Reset the start time; from now on, time is attributed to TIMEVAR. */ m_start_time = now; @@ -432,6 +436,9 @@ timer::start (timevar_id_t timevar) { struct timevar_def *tv = &m_timevars[timevar]; + gcc_assert (global_phase == TV_NONE || global_phase == TV_TOTAL); + global_phase = timevar; + /* Mark this timing variable as used. */ tv->used = 1; @@ -463,6 +470,12 @@ timer::stop (timevar_id_t timevar) struct timevar_def *tv = &m_timevars[timevar]; struct timevar_time_def now; + gcc_assert (global_phase == timevar); + if (timevar == TV_TOTAL) + global_phase = TV_NONE; + else + global_phase = TV_TOTAL; + /* TIMEVAR must have been started via timevar_start. */ gcc_assert (tv->standalone); tv->standalone = 0; /* Enable a restart. */