From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iPEiCWZ1CmKiNgAAgWs5BA (envelope-from ) for ; Mon, 14 Feb 2022 16:29:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sJ22BWZ1CmK7awEAauVa8A (envelope-from ) for ; Mon, 14 Feb 2022 16:29:42 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 57BF83ABAF for ; Mon, 14 Feb 2022 16:29:03 +0100 (CET) Received: from localhost ([::1]:39822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJdHi-0006OP-Gn for larch@yhetil.org; Mon, 14 Feb 2022 10:29:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJcRo-0005a0-9o for guix-patches@gnu.org; Mon, 14 Feb 2022 09:35:24 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJcRS-0000U8-Oi for guix-patches@gnu.org; Mon, 14 Feb 2022 09:35:23 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nJcRS-0007pV-C0 for guix-patches@gnu.org; Mon, 14 Feb 2022 09:35:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH 04/11] gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 14 Feb 2022 14:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53878 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Philip McGrath , 53878@debbugs.gnu.org Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164484926930049 (code B ref 53878); Mon, 14 Feb 2022 14:35:02 +0000 Received: (at 53878) by debbugs.gnu.org; 14 Feb 2022 14:34:29 +0000 Received: from localhost ([127.0.0.1]:40403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJcQv-0007ob-Ay for submit@debbugs.gnu.org; Mon, 14 Feb 2022 09:34:29 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:22017) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJcQp-0007oM-TH for 53878@debbugs.gnu.org; Mon, 14 Feb 2022 09:34:27 -0500 Received: from lprikler-laptop.ist.intra (gw.ist.tugraz.at [129.27.202.101]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Jy6DP6rCCz1LZVs; Mon, 14 Feb 2022 15:34:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4Jy6DP6rCCz1LZVs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1644849254; bh=zqf3XEAt4PWWuoxdrHkmgAjFxejtsJ9lkazsj3pJnmA=; h=Subject:From:To:Date:In-Reply-To:References:From; b=aEE29frwy3QRD3YucEK079FrzUQ1cWWpdNwvpomq2l2b8R4x2E0p7cIi8gaqfMB+I Se+oA+sJN2QgvWyfKks0bGV2l9KiN7fg+I7fdA+RUB3p9FiYfOQPMGh+guOmZMLRMe Uz0XLcnmklbv2BbTuFv5EUq1Ni+Xr2rXWtP8WMAE= Message-ID: <20ade6d2f82b20f25d0eb1c8b2b5c409c189d05a.camel@ist.tugraz.at> From: Liliana Marie Prikler Date: Mon, 14 Feb 2022 15:34:13 +0100 In-Reply-To: <20220213215127.218952-5-philip@philipmcgrath.com> References: <20220213215127.218952-1-philip@philipmcgrath.com> <20220213215127.218952-5-philip@philipmcgrath.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: waObeELIUl4ypBWmcn/8wQ X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644852543; h=from:from:sender:sender: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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=zqf3XEAt4PWWuoxdrHkmgAjFxejtsJ9lkazsj3pJnmA=; b=CUuiVAUbW0phjGG3shfSqJDDlUTsr7+4+N3RiM08a8bYhtJxYwwDwaGZerwSvzksTzq2ed WigZD9H30GIbOLSF1M5rM/PJSfKncDMfKsvN0Kv2rnXe7OXVFJtWX56ZmJcIx8xfj/Wp+T 4giMaErVWZYEXF+H6+ZaSIsVKCjRdcqBd9Ax/K8cn8N1nJujdVpIFYoRGrot0CcbVzNxxo TSMJOCZ45sh/beVdkuq6dMPIcB+Bi4pEzIh9Mx8KlRxBd6pIc9HXhXD+RarVdJ7+JU4Ka9 JOmpsypQ7djzZ5o8t1Q2B1HuZ6zCIvbS5UnkpdR/pllAPYFfiAU3+HecMaOXsA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644852543; a=rsa-sha256; cv=none; b=caLPdYPYZvcLq7pGl6+CWJfAPG7op8u7Scrx0fXVrwnEj/dX/hAglX4GJBiOMsOpYNXFba j44Lvt6svoFrbhgO3NLA32vHfAN1/YEQImlx9BWJaOnlarduy8bxGtdYFaE/VmQJkUNuXz 9tUeSU7G2eDCZypHupLNaFaH81I5uqB2Tw+t/kDE8TG8e4Clx61GLOW+Ltzp/DkstfHOUj YU8FWRc9oYFyzp5/c+N321XdUGWrbybh+Coh8tKE9MaXpQODg0MqjvSjUZ7DVD8xUJRnpc b5lGMFDhGiH/+RiCQA8l+6Ic7OyMZG/tzfG7FFzi/ZnpI0R2Ioq0AuLkVlO44A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=aEE29frw; dmarc=fail reason="SPF not aligned (relaxed)" header.from=tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.23 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=aEE29frw; dmarc=fail reason="SPF not aligned (relaxed)" header.from=tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 57BF83ABAF X-Spam-Score: -2.23 X-Migadu-Scanner: scn1.migadu.com X-TUID: GWWpfC/fLPEn Hi, Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath: > [...] > +(define (chez-machine->upstream-restriction mach) > +  "Given a string MACH naming a Chez Scheme machine type, returns a > symbol > +naming a restriction on the upstream Chez Scheme implementation > compared to > +the Racket variant, or @code{#f} if no such restriction exists.  The > +restriction is reported for the architecture--OS pair, regardless of > whether > +MACH specifies a threaded or an unthreaded variant. > + > +Possible restrictions currently include: > +@itemize @bullet > +@item > +@code{'no-threads}: Support for native threads is not available > upstream. > +@item > +@code{'no-support}: The upstream release doesn't claim to support > this > +architecture--OS combination at all. > +@end itemize > + > +See @code{chez-machine->nix-system} for more details about > acceptable values > +for MACH." > +  (let ((mach (chez-machine->unthreaded mach))) > +    (cond > +     ((string-prefix? "arm64" mach) > +      'no-support) > +     ((string-prefix? "arm32" mach) > +      (if (string-suffix? "le" mach) > +          'no-threads > +          'no-support)) > +     ((string-prefix? "ppc32" mach) > +      (if (string-suffix? "le" mach) > +          #f > +          'no-support)) > +     (else > +      #f)))) -> is a conversion operator, not an "accessor". "upstream-restriction" sounds rather negative, I'd rather have (chez- machine-features), which yields #f if the machine is unsupported and a (possibly empty) list of features otherwise, such as '(threads). I'm also not quite sure what the point is behind using chez machines here. Why not simply test the systems with the predicates we already have, i.e. target-arm64?, target-arm32?, target-linux?, target-ppc32?, ... And as a minor pet peeve, you ought to spell out machine. > +(define* (nix-system->chez-machine #:optional (system (%current- > system)) > +                                   #:key (threads? 'always)) > +  "Return the Chez Scheme machine type corresponding to the Nix > system > +identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a > Chez Scheme > +machine type is undefined. > + > +When THREADS? is @code{'always} (the default), the threaded variant > of the > +machine type will be returned: note that the package returned by > +@code{chez-scheme-for-system} will always support native threads.  > When > +THREADS? is @code{#f}, the unthreaded machine type will be > returned.  If > +THREADS? is @code{'upstream} (the default), the threaded variant of > the > +machine type will be returned if and only if it is supported by > upstream Chez > +Scheme (see @code{chez-machine->upstream-restriction}).  If THREADS? > is any > +other value, an exception is raised." What's the point in having THREADS? 'always? In any case, assuming chez-machine-features is to be exported, this can easily be checked -- even if not, we can add the check internally by writing  #:key (threads? (chez-supports-threads? system)) > +  (let* ((hyphen (string-index system #\-)) > +         (nix-arch (substring system 0 hyphen)) > +         (nix-os (substring system (+ 1 hyphen))) > +         (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch)) > +         (chez-os (assoc-ref %nix-os-to-chez-alist nix-os)) > +         (mach (and chez-arch chez-os (string-append chez-arch chez- > os)))) This series of let-bindings should probably be done in a separate function called nix-system->chez-machine. Cheers