From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 380EE3858D39 for ; Mon, 20 Nov 2023 23:54:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 380EE3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 380EE3858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700524493; cv=none; b=g/bXxUyJqyufLh+mXiI/ADNs4iTBVbnYcl0rxhrhwcgoNZRsT7lP9q6UsXl3gj+8LjPdT6Pd1J0FBbCbtJPrZ/L0ROnD3CJ6/DvD1LNFEZzvovR8zSwi2jkJrcEzihccC0ovv1CPm9VBAYWH+NFQXtvP3c4WYltXuAEMbYZlaX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700524493; c=relaxed/simple; bh=j3Qw+BsG8SvN3FXlvej65Tk+iKuRXkPcXjGYpuRgPDY=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=nW2jZaNvco/qTmJW5NoyQJAyeBwfL+yoXlvKwAqsAc/UgZhwlqXDkVE74JsY/s/Wg+tRQ0go3ymI4rZTZ+nJeM/1ZPckJMBSbDmCIEL4NoiTQQY0OfUKb7ijnCLJ9ZJsvXz7+8oN3GekVl32SSdErNzgYmaS6qJlYI94Ie3xEIo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700524491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j3Qw+BsG8SvN3FXlvej65Tk+iKuRXkPcXjGYpuRgPDY=; b=N/i/OPEX1y+buEcZ7XVWndTTjQHUo1IhicwiizSnP018vRCgfluhf0/Mag9nNx5lXjCgWo hSrbflqnR6OG/xfUW5JJkjxAIq7G2I9Lr52NY9oW/QwXcTqMf8AXT6ZtaUU8x2A6cqckOa gutZLFeR8MIcXnGOuLdKXeITj3RL7CU= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-MdJSAdAuP2efF14SRwkm-Q-1; Mon, 20 Nov 2023 18:54:50 -0500 X-MC-Unique: MdJSAdAuP2efF14SRwkm-Q-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-677f4094481so34077226d6.1 for ; Mon, 20 Nov 2023 15:54:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700524490; x=1701129290; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=j3Qw+BsG8SvN3FXlvej65Tk+iKuRXkPcXjGYpuRgPDY=; b=RUFjC9msU0pAOZPBNFRRQtu/23n+0N/VqhCsIw5U6+IMSHfPNIYzzPxloCtoNT/yC2 +0dvWIwnB8SX7b16zu1tXhgb+KpGzQXG12ZT0/Cf6WbDoq3IsPHF0YI+4UK11zrdiACf OlMSmfUNEZUP2CRmjAkiRZ7OJVvJiDXySLCHryEkRahXnggZvjHzUoLpRpN8XbMdy/5F J1hGu6UqsrkGZritAzAqPdqmDx3nIZOtW/N6phO1awOdKBxpUd5oVImsAZj/G3yUMkoQ LfPibh0FGGahToPQTHUMPuiubCbukup/zC6SNyAxjfNohgKiYa5AOzdX1yS6m/FF3xQM h+AA== X-Gm-Message-State: AOJu0Yz3JpYZ/IduS2TrzMyMOk2Nsn3a82O7/G4iD/Sy6WQqqmnfuRFm /qYpr/nIpXbN0hqrq76IWWbdfqaq8RFgn7nYD/jFHkCqy1yk6pHk0b7qTvHzYJ3HtvbRieDDDsM uE0jD3uB5ipIYQ2QUSA== X-Received: by 2002:a05:6214:2241:b0:66d:994b:8703 with SMTP id c1-20020a056214224100b0066d994b8703mr12707201qvc.7.1700524489962; Mon, 20 Nov 2023 15:54:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IETnlB7hhmI0VPy7UbBhpQllx6Su2qxZi5CI41qhfF5/hELrQgVpF2A9+kO8483Yy1WUML/wg== X-Received: by 2002:a05:6214:2241:b0:66d:994b:8703 with SMTP id c1-20020a056214224100b0066d994b8703mr12707190qvc.7.1700524489710; Mon, 20 Nov 2023 15:54:49 -0800 (PST) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id q7-20020ad44027000000b00670a8921170sm3394387qvp.112.2023.11.20.15.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 15:54:49 -0800 (PST) Message-ID: Subject: Re: [PATCH] libgccjit Fix a RTL bug for libgccjit From: David Malcolm To: Jeff Law , Antoni Boucher , jit@gcc.gnu.org, gcc-patches@gcc.gnu.org Date: Mon, 20 Nov 2023 18:54:48 -0500 In-Reply-To: <0c86682b-9e80-4d15-9692-d011129d1cbe@gmail.com> 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> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Mon, 2023-11-20 at 16:38 -0700, Jeff Law wrote: >=20 >=20 > On 11/20/23 15:46, David Malcolm wrote: > > On Fri, 2023-11-17 at 14:09 -0700, Jeff Law wrote: > > >=20 > > >=20 > > > 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.=C2=A0 I'm aware of that.=C2=A0 Even so calling init_emit_once mo= re > > > than > > > one > > > time still seems wrong. > >=20 > > 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 > >=20 > > The multiple in-process executions of libgccjit could pass in > > different > > code-generation options.=C2=A0 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=20 > implementation is totally hidden and provided by the target. I > wouldn't=20 > be at all surprised if one or more do something evil in there.=C2=A0 That= =20 > probably needs to be evaluated on a target by target basis. >=20 > The rest really do look like single init, even in a JIT environment=20 > 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? Thanks Dave