From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: For a cheaper =?utf-8?Q?=E2=80=98bytevector-=3Epointer?= =?utf-8?Q?=E2=80=99?= Date: Tue, 26 Nov 2019 11:25:41 +0100 Message-ID: <87v9r7rl22.fsf@igalia.com> References: <87zhglzgue.fsf@gnu.org> <875zj81g3b.fsf@igalia.com> <87o8wzvcj4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="101395"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: Guile Devel To: Ludovic =?utf-8?Q?Court=C3=A8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Nov 26 11:29:36 2019 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iZY6A-000QEf-Lj for guile-devel@m.gmane.org; Tue, 26 Nov 2019 11:29:34 +0100 Original-Received: from localhost ([::1]:52360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZY68-0006QA-Vr for guile-devel@m.gmane.org; Tue, 26 Nov 2019 05:29:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59010) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZY2d-0002oG-1b for guile-devel@gnu.org; Tue, 26 Nov 2019 05:25:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZY2b-0003OA-Qi for guile-devel@gnu.org; Tue, 26 Nov 2019 05:25:54 -0500 Original-Received: from fanzine.igalia.com ([178.60.130.6]:56886) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZY2b-0003MS-GH; Tue, 26 Nov 2019 05:25:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=+gh21br4jUEfvm8UxKg65S8PZwteMFg3O9z3VZXERjk=; b=Y/rJng6GnIZ253mwuDU4TaVSS50uX5ifdgaztjcmpVqWZ9ydnjwFGqvRfJ/1qSDIpVoKouSKAyHOadHK2+2Zy0hlEORLsHh4S1GWQK+7gnG6BaSDRw2DXd477TCLLqvD+pexGRhcYE0yK8AFTBW3Gl/5Vk/B4cgYuS10ggUtNs/kUW8e7FYg43IyaWIHjNY0+R09wcT65y2S0gkPmf+3nt+h8Q2Y6QXu9Ez13lm31aF/NzTp/NZ2RnbLrEtvCzNN5gKfaokEY5qEFzGHxDDdvdMNQRD6UU0YPWhedhyIOwTR4+D8Haetvo5IDDs4JwP/haKg4pI0RsILpfjyTjw9Xw==; Original-Received: from lfbn-ann-1-376-195.w86-200.abo.wanadoo.fr ([86.200.91.195] helo=milano) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1iZY2Z-0007AK-1u; Tue, 26 Nov 2019 11:25:51 +0100 In-Reply-To: <87o8wzvcj4.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 25 Nov 2019 23:03:59 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 178.60.130.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:20171 Archived-At: Hi :) On Mon 25 Nov 2019 23:03, Ludovic Court=C3=A8s writes: > Andy Wingo skribis: > >> Honestly I would prefer not to do this. If I understand correctly, the >> problem is in FFI calls -- you have a bytevector and you want to pass it >> as a pointer. In that case the "right" optimization is to avoid the >> scm_tc7_pointer altogether and instead having an unboxed raw pointer. >> The idioms used in FFI are local enough that a compiler can do this. > > I agree! I have a patch from the 2.0 era (attached), but it doesn=E2=80= =99t > work because all the tc3s are already taken. I don=E2=80=99t think this = has > changed but I could well be missing something about the tag space. > WDYT? I was actually thinking about raw pointer values -- i.e. not immediate-tagged values. If you think about it these values are generally live only between the bytevector->pointer and the FFI call -- the compiler is capable of safely unboxing values in spaces like that. But this would work better with a more compiler-focussed FFI than with the current "interpreted" FFI. But, immediate pointers would be nice too; nicer, in some ways. See also Mark's fixrat work. >> In the short term, what about allowing bytevectors as arguments >> whereever a pointer is allowed? Perhaps it's bad to expand the domain >> of these functions but it may be the right trade-off. > > So in practice, every time there=E2=80=99s '* in the FFI, it=E2=80=99d ac= cept a > bytevector, right? That was the idea :) > I would prefer immediate pointers if that=E2=80=99s possible, and then on= e of > the two other solutions. In that case I am not sure what a good solution is. Having to add an additional 2-word internal displacement is a bit unfortunate, if that's the case! Andy