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 26FD13858D33 for ; Mon, 20 Nov 2023 22:46:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 26FD13858D33 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 26FD13858D33 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=1700520411; cv=none; b=HwGS3kgOpKAJO+ffixXXViXEz+D6zM+5Sa3KxVJJ+FPB/HbpDivADjZucvC7PPtV1GCXlsBl/WYlxyY6jjGkjNdnj3KhwJsQimu2/fDwYW2fG5MjDh0XnXlRsuoegBw+xf46tAtynS5LXrYTHD+edE9r1OlKsUbd2Uf4ImQD9/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700520411; c=relaxed/simple; bh=GuXjQwXJtnWk21entfWddD7N3+oI+tCYdg/mgd55qRI=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=xSEszWnPH4zh3rjFb8BE6CS9tlzDSViUH/GeR3hbCY2Zx9v0q74RRsenuooLUc2SniQL4Csb7Ak1l8VslEkPhlYrbPueYRNl4uvYUeD3f1T2f1qMvyiSg97PGrW++DrVfKH4gfW9cGde6q/gQ+lG9b6WW8WbFb1SfiWPrV/G7fA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700520409; 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=wLuAgvzu/uWVxx8/JgIW5lUZBZA7AQSBKTO7el28E8I=; b=g7fhOXQLKoMDtoNFXXXXIjiG7jmsGJh6jL+3P1xZ3o+dDTVWENczDhoWOyUbC3Enq2drfH XXYJltHi6l4pJD6zgPN57j5RzN/tD0QxvZT2BmyeT2IjNEC82BLQUvx4jkd0fnoyfsttU3 rjp6HzQ0oPwuTcKPJXr2QbXUqPaG8mc= 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-316-K372QDCDMU2WSzXthnAQcg-1; Mon, 20 Nov 2023 17:46:48 -0500 X-MC-Unique: K372QDCDMU2WSzXthnAQcg-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6707401e1aeso40029966d6.0 for ; Mon, 20 Nov 2023 14:46:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700520408; x=1701125208; 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=wLuAgvzu/uWVxx8/JgIW5lUZBZA7AQSBKTO7el28E8I=; b=GyxByMefox8ELdzXSKkD5OeEtAakZ50Ukc7FWtvPHn6o2a84V+agx4EQwiomVoQz+Q Jjnwr8IUUKlQpL+2XZg4AYRB6IpKqQNhQccp7D6Mpm3L5t7vdHnEf4cAlx/FWdR4F2lI BEunPMnIvRxqgZ/wRhyVdPfoQLzxCsrOxqDF7Hka0pFwCwbbhLc1AbsR7HHmk5TwpnxC zqpoOU29vKENyDAk9KDpg0cXOJhrp4rE1yTIp5HM5Wc1zOeVum6sjNfxBdbLpErPfLfH UewiEP+EAj6WrTpJ7JxU6dkrz/uiZxccZQH+dq+dDM0Cnr1H1KF1y49yW3uLxdmk1ENN 8QOw== X-Gm-Message-State: AOJu0YzxKx/o1FaVNq0n3EFPdann7iEtMYSPg7EGW5B9Uch6Tb5pcmc4 uoH0zxEBAXGfZ8w8ujB9nZF/1DWxbGeuge3hn2Uz2JVSi2usHYmq1OXKcIWqQP5b+MMDMOx27Ya OT+CIv3Y= X-Received: by 2002:a05:620a:47ed:b0:775:c2a1:1f1e with SMTP id du45-20020a05620a47ed00b00775c2a11f1emr9104353qkb.50.1700520407835; Mon, 20 Nov 2023 14:46:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmqf7hAtA46gl2bFcPKpgsr6vIlx/lxrUUX3QrO6Xvbl7+tXNBMNPd1x+M5cO48X7YczlwGg== X-Received: by 2002:a05:620a:47ed:b0:775:c2a1:1f1e with SMTP id du45-20020a05620a47ed00b00775c2a11f1emr9104339qkb.50.1700520407588; Mon, 20 Nov 2023 14:46:47 -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 o5-20020a05620a0d4500b0076eee688a95sm3035702qkl.0.2023.11.20.14.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 14:46:47 -0800 (PST) Message-ID: <80b6dae50b4011b6a6a6b36da8555937fa0f4de7.camel@redhat.com> 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 17:46:46 -0500 In-Reply-To: <7d819703-37fe-414c-b65d-e7a4c3fc9d17@gmail.com> References: <7c598b42-f866-4661-8682-818e7e7bbccf@gmail.com> <5552026bb6829cc0df67b11576ed1d02efd8eaee.camel@zoho.com> <7d819703-37fe-414c-b65d-e7a4c3fc9d17@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 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 more t= han > one=20 > 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. init_emit_once says it creates "some permanent unique rtl objects shared between all functions" - but it seems non-trivial; are there any places where what's created could be affected by command-line flags?=20 If so, (a) seems necessary; if not (b) may be viable. Antoni's patch implements (b). Antoni: do you know what's reusing the const_int_rtx? If we have to go with approach (a), we might need to have those things use the up-to- date const_int_rtx (not sure) Hope this is constructive Dave