From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 77E113986038 for ; Fri, 11 Sep 2020 11:27:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 77E113986038 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-571-BXet-TMsPkCU0xI3nQP5nQ-1; Fri, 11 Sep 2020 07:27:06 -0400 X-MC-Unique: BXet-TMsPkCU0xI3nQP5nQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 046FA1882FB1; Fri, 11 Sep 2020 11:27:05 +0000 (UTC) Received: from ovpn-114-91.phx2.redhat.com (ovpn-114-91.phx2.redhat.com [10.3.114.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FA825C1BD; Fri, 11 Sep 2020 11:27:04 +0000 (UTC) Message-ID: Subject: Re: [PATCH V2] libgccjit: Add new gcc_jit_context_new_blob entry point From: David Malcolm To: Andrea Corallo Cc: jit@gcc.gnu.org, nd@arm.com, gcc-patches@gcc.gnu.org Date: Fri, 11 Sep 2020 07:27:03 -0400 In-Reply-To: References: <59a8d345c642d49281a601278946e087a4bbe3e2.camel@redhat.com> <87zh9kumwi.fsf@arm.com> <93e3d65a0b04b13a5d5c9970a2058d167357ed6c.camel@redhat.com> <22479e6a6a1e27df07a3d2c2cfb8c6c8420a7d3d.camel@redhat.com> User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 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_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2020 11:27:11 -0000 On Fri, 2020-09-11 at 12:31 +0200, Andrea Corallo wrote: > Hi Dave, > > thanks for the review! > > David Malcolm writes: > > [...] > > > Was there a reason for using reinterpret_cast here, rather than > > static_cast? > > Yes the reason is that apparently we can't use static_cast for that: > > "error: invalid ‘static_cast’ from type ‘gcc_jit_lvalue*’ to type > ‘gcc::jit::recording::global*’" > > Why is that is another question I fear I'm not very qualified to > answer. > If you feel is necessary and want to suggest some rework to improve > this > I'll be happy to put some effort in if you like. It's because we're effectively downcasting from lvalue to global. This is safe because of the check for global->is_global (). A slightly cleaner way to do it would be to have a dyn_cast_global vfunc here rather than is_global, and to use the result - but I don't think it matters. [...] > > > After applying the suggestions and having tested it I've > > > installed > the > patch as 4ecc0061c40. > > Thanks! Thanks Dave