From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vibhav Pant Newsgroups: gmane.emacs.devel Subject: Re: feature/jit-improved-type-punning 9d2a54bd8d: src/comp.c: Use libgccjit's bitcast API for type coercion, when available. Date: Sun, 02 Oct 2022 21:54:49 +0530 Message-ID: References: <166430063807.1861.17209317756638644499@vcs2.savannah.gnu.org> <20220927174358.8443FC00A6E@vcs2.savannah.gnu.org> <87y1u473g3.fsf@yahoo.com> <83pmffiwko.fsf@gnu.org> Reply-To: vibhavp@gmail.com Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-BVKd3eS3+73+mpIEMKH3" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4390"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.44.4 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 02 18:26:35 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1of1nU-0000uk-VX for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Oct 2022 18:26:32 +0200 Original-Received: from localhost ([::1]:56950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1of1nT-00029I-Uo for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Oct 2022 12:26:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1of1lz-00013p-Or for emacs-devel@gnu.org; Sun, 02 Oct 2022 12:24:59 -0400 Original-Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:35524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1of1lv-0004x2-Vw; Sun, 02 Oct 2022 12:24:57 -0400 Original-Received: by mail-pg1-x52e.google.com with SMTP id j71so1775863pge.2; Sun, 02 Oct 2022 09:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:references:in-reply-to:date:cc:to:reply-to :from:subject:message-id:from:to:cc:subject:date; bh=edHYCa7NO01liME33Kap2ggJu/1/sLMiVVJnCVrfMH4=; b=jj/sJi/V5diBxNU8heDqFWlm287DE6In7XymOcSoELljs4gGNp3D/vkfvR2nCP+SF6 RM9ddWgVOf0ZVjDR3NvZVkSFn3yI1zg5IFQID1tqA6QmLWt+feNadiPWIsbln5+7VQkw 7H1/1Exiz1JQeNrvfe7eHLLuKtgqnehQ4A/veDt5pjVJbDKz8zqxSPR7uO1AJfWt1eOB J0lWglbwyewdxBKfj3lNQvcxLly594+8v5s4ph+HJYYkTjmZyE1d5O0/Zhgy5tnFr4bT hJlxjAsk3sCGQWzsSiLk/T5sHC8FlWuO26v5zag3pk5OVZ9UDa1DtKPacLZRc63HvZzk Lotw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:references:in-reply-to:date:cc:to:reply-to :from:subject:message-id:x-gm-message-state:from:to:cc:subject:date; bh=edHYCa7NO01liME33Kap2ggJu/1/sLMiVVJnCVrfMH4=; b=YW8aaClB6u+k8tb/4/i+/bXcJrpz2KBLp6bXZoslDGku3lfyaUB2L5cjnW8Acfce/Y k3mDn0Owb7VemAGorT5tvKqgaZlgoQdb9mYZE2QFIKnqvpj857JStbgfRxi8paVOXlQv 4oplmrrGT8Brf5EfVDQ0VHk4bj3jLMah3iSy9TEjJ1vIFsPytoGl0wuRp93j+ajeWgWX yiUAzv++6rt/cq1dmSaDc1azHUoaSgnvEdeJe63AcJnpBtKp5rPfm4Mth6obgjPhIo/0 svLTFclA1f7W2kWoOFSsejNxeDH713M4x579SPQr5XpmB/QVgT2wtmAgUvPKhmGuIpYM 9wxA== X-Gm-Message-State: ACrzQf1PHv/QoBOY1SBq4R0bHXQc0hFNMrYX38zyopzzWZEf0uBkleun 8WZueT1/ZE/hXBK+0W4UNIg7tF4BlI0= X-Google-Smtp-Source: AMsMyM4LRWV6ckNdlbUQAq2LOyLOcdj3XEJV6TCov/osWaebtBYOQ2H5dpV0MDutAH+BWTf7rEpXsA== X-Received: by 2002:a65:6e0f:0:b0:43a:1cd4:4ae6 with SMTP id bd15-20020a656e0f000000b0043a1cd44ae6mr15222536pgb.289.1664727893389; Sun, 02 Oct 2022 09:24:53 -0700 (PDT) Original-Received: from ?IPv6:2401:4900:1f35:e4ef:35a0:146b:67b3:ec8d? ([2401:4900:1f35:e4ef:35a0:146b:67b3:ec8d]) by smtp.gmail.com with ESMTPSA id e3-20020a170902ef4300b0017df3e0e5ffsm2852242plx.66.2022.10.02.09.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Oct 2022 09:24:52 -0700 (PDT) In-Reply-To: <83pmffiwko.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=vibhavp@gmail.com; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296637 Archived-At: --=-BVKd3eS3+73+mpIEMKH3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2022-09-28 at 14:10 +0300, Eli Zaretskii wrote: > > From: Po Lu > > Cc: Vibhav Pant > > Date: Wed, 28 Sep 2022 08:22:36 +0800 > >=20 > > BTW, I don't see any code that loads this function dynamically on > > MS > > Windows.=C2=A0 Isn't that needed? >=20 > They were present in the patch that was posted. >=20 > FWIW, I'd like to see some rationale for these changes.=C2=A0 Perhaps > libgccjit experts would see it immediately without any explanations, > but I'm not such an expert.=C2=A0 TIA. Type coercion in earlier versions of libgccjit was quite limited, as it only supported casting between pointer types and integers <-> booleans/floats. Because working with lisp tagged pointers involved converting from a Lisp_Object (which is usually a Lisp_X*) to an integer, comp_t contained a union {uintptr_t; void *} which we would use to emit two (cast_ptr_to_int, cast_int_to_ptr) functions before JITting Lisp code, which would in turn initialize a union with the input parameter, and return the required field. Combined with a 15 x 15 lookup table for every type used while compiling Lisp, all type casting would therefore consist of emitting a call to one of these functions. This branch uses libgccjit's new API for bitcasting between types, which lets us skip emitting this good chunk of helper code as part of the JIT process. Working with/extracting Lisp_Object tags in JITed code is semantically the equivalent of a simple reinterpret_cast operation, potentially improving optimization (although I imagine almost all calls to these helper functions are inlined, unless native-comp-speed is 0). Best, Vibhav --=20 Vibhav Pant vibhavp@gmail.com GPG: 7ED1 D48C 513C A024 BE3A 785F E3FB 28CB 6AB5 9598 --=-BVKd3eS3+73+mpIEMKH3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEftHUjFE8oCS+Onhf4/soy2q1lZgFAmM5u1EACgkQ4/soy2q1 lZhiJgf9EVCxs6kYRUpK15mrMU1xjY4nKZaDK7UGuY0ua+q86x7SP9yKECSpvQqr ypy8Dbs4gI3SnXNwqk/a75N0lOGitFfBKdukchH7GjnS1ZE61xYymejd2ixleZl0 1gFicUtKI4+v0fPfpAcyKDkTXUOi1SDE9FuDZkEsP66JSRuCJ7LSLzaXyKWpTgFE j6hIq/9OiMNkxaODWLPjMhOuhGRCAUi6IZ8udODfuGdnYcywbCs4/Ny87mcGsQay 9XcVIFvRklZEHih0WkAOzU3Mz6wbbyLUg4GURrPPzpUq06vQjyt7u1Wk5aLtIsem WJaR2ML7rH4q515isVYkMtqMJrYyRg== =gUFF -----END PGP SIGNATURE----- --=-BVKd3eS3+73+mpIEMKH3--