From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 125D53858D28; Mon, 11 Dec 2023 16:06:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 125D53858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 125D53858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702310806; cv=none; b=AnhOdJGzpRQ3tORrZ/PBbCaX2TmrJMY2O44POdy6YFsTzka5sjdVS2NV3e1W+HLfp0jYhltOB2164ifhgB47vYAZkOOLboKZeSR+pwP9NsyrTX2wGhkJKHlZqtWLvfgPKwp1oLDIzBzPrVkeFE5jOag1BH8dwgE2guwHK15JDRs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702310806; c=relaxed/simple; bh=SN8R8KiWrSc5xLYzjK16RkTIwe4MhTlw7X+c3rqoo6E=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=XXNz44jJxmD1Bw/V4LFS32OmkopCBvTIBIN6ihXumIyg6wVRaE9WJgTQ3TH0Df3R+RcZAog/w8hbv5VlAe2PVw/NS/zzUxksDpTaVCLdr7uRyxGvNcymMVp3jJMRyW9nu5TLlrZcTr177YHx9Mj+UxMS8nZyRneihvlvoUVggos= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6cef51f7899so600847b3a.3; Mon, 11 Dec 2023 08:06:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702310799; x=1702915599; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nsaxhwt78Ixg7CEM6E3GhmQkR4OO/OZXy2YdsaM85XI=; b=iYiX35uH6msdM9oUU0/4vbnPXR+Tjq1dPVYwL5lokPVjpwpD4haRWQ84GTlbl8KnG3 Xg5erLgPRaGWyxmpwsghzhjv8kPX9SdyMhqdwSjP9L3mjrNsIBpOaxGORZiSIYuC4HUj uYAtp4pmRTGzN2UnP4vnDK5/d4xVFlzri4b7Zl1iyi6RxgmCIdcti2DWkdxnSwae3bT1 apTpCH7wxeUj3PcgdU0IBRA8ogsmpzVJuw+yFCL3xaEjZEV1feiw3Ra7aLD7Vn4t6hxi PNuk0Vjrb/UVN16pl6iTjawY6zQia4Cl9FU3xmLJuE8r+rdvoZGV88kbw8yEo3IhhvLp vpVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702310799; x=1702915599; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nsaxhwt78Ixg7CEM6E3GhmQkR4OO/OZXy2YdsaM85XI=; b=SmLpXtHK3kQU7UphJczR6PNBzA9yK+dF8A0DCft944VlwXOiepYPRJf9DutU/mVXWH Yoj8Z7wvJrJNb0NzL5w6eNN5FuFLLF97iKRgGRqNnrTc5/sBqJ9+0Slp1Ez4zhldUQm3 3WTWxIh+ml8z7Bd0nwMhV2cuP3pHiIiW8L8Bl4Dud5B5+/IWFD1vhPiOyLUC2mUNnUWw rml1+yQOwuKrMFtkwhDpe884r2zwwmy+5zNDzewEtobWyQRB299wmoGsODRPSTIxnoPB sVIXheTE/Fc6Ye0MTJbZb3SZDZ/D4Bkja3/cxgidUp/QXAdtCHPX8rFGi35wuvPx6ADV jQkQ== X-Gm-Message-State: AOJu0YyQQTq2X+GL8ULfMX2ltpMEzex+AjpFvdqmz5xrFdZGZUzD/GTO gMkKF3GUZkm5SP7ZP+/ED10= X-Google-Smtp-Source: AGHT+IHQMfAjiklQavKzri2bt5GVxiFVBKJUGKZPuor3lk/8qc0C2Lxr2MOscHyi2uLbXF3GQ3FLDQ== X-Received: by 2002:a05:6a00:391c:b0:6ce:2731:79f0 with SMTP id fh28-20020a056a00391c00b006ce273179f0mr1867070pfb.38.1702310798946; Mon, 11 Dec 2023 08:06:38 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id du12-20020a056a002b4c00b006cef5c025d2sm4397999pfb.95.2023.12.11.08.06.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Dec 2023 08:06:38 -0800 (PST) Message-ID: Date: Mon, 11 Dec 2023 09:06:33 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] libgccjit Fix a RTL bug for libgccjit Content-Language: en-US To: David Malcolm , Antoni Boucher , jit@gcc.gnu.org, gcc-patches@gcc.gnu.org References: <7c598b42-f866-4661-8682-818e7e7bbccf@gmail.com> <5552026bb6829cc0df67b11576ed1d02efd8eaee.camel@zoho.com> <7d819703-37fe-414c-b65d-e7a4c3fc9d17@gmail.com> <80b6dae50b4011b6a6a6b36da8555937fa0f4de7.camel@redhat.com> <0c86682b-9e80-4d15-9692-d011129d1cbe@gmail.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_ABUSEAT,RCVD_IN_DNSWL_NONE,RCVD_IN_XBL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/20/23 16:54, David Malcolm wrote: > On Mon, 2023-11-20 at 16:38 -0700, Jeff Law wrote: >> >> >> On 11/20/23 15:46, David Malcolm wrote: >>> On Fri, 2023-11-17 at 14:09 -0700, Jeff Law wrote: >>>> >>>> >>>> On 11/17/23 14:08, Antoni Boucher wrote: >>>>> In contrast with the other frontends, libgccjit can be executed >>>>> multiple times in a row in the same process. >>>> Yup.  I'm aware of that.  Even so calling init_emit_once more >>>> than >>>> one >>>> time still seems wrong. >>> >>> There are two approaches we follow when dealing with state stored >>> in >>> global variables: >>> (a) clean it all up via the various functions called from >>> toplev::finalize >>> (b) make it effectively constant once initialized, with idempotent >>> initialization >>> >>> The multiple in-process executions of libgccjit could pass in >>> different >>> code-generation options.  Does the RTL-initialization logic depend >>> anywhere on flags passed in, because if so, we're probably going to >>> need to re-run the initialization. >> The INIT_EXPANDERS code would be the most concerning as it's >> implementation is totally hidden and provided by the target. I >> wouldn't >> be at all surprised if one or more do something evil in there.  That >> probably needs to be evaluated on a target by target basis. >> >> The rest really do look like single init, even in a JIT environment >> kinds of things -- ie all the shared constants in RTL. > > I think Antoni's patch can we described as implementing "single init", > in that it ensures that at least part of init_emit_once is single init. > > Is the posted patch OK by you, or do we need to rework things, and if > the latter, what would be the goal? What I'm struggling with is perhaps a problem of naming. Conceptually "init_emit_once" in my mind should be called once and only once. If I read Antoni's change correctly, we call it more than once. That just feels conceptually wrong -- add to it the opaqueness of INIT_EXPANDERS and it feels even more wrong -- we don't know what's going on behind the scenes in there. jeff