From: Philip McGrath <philip@philipmcgrath.com>
To: 57050@debbugs.gnu.org
Cc: Liliana Marie Prikler <liliana.prikler@ist.tugraz.at>,
Liliana Marie Prikler <liliana.prikler@gmail.com>,
Philip McGrath <philip@philipmcgrath.com>,
Thiago Jung Bauermann <bauermann@kolabnow.com>
Subject: [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems.
Date: Thu, 11 Aug 2022 07:08:19 -0400 [thread overview]
Message-ID: <4d63cf22559de641440810e451b9366aa6091774.1660215295.git.philip@philipmcgrath.com> (raw)
In-Reply-To: <cover.1660215295.git.philip@philipmcgrath.com>
On systems for which Racket's variant of Chez Scheme cannot generate
native code, it can use a 'pbarch' machine type: a variant of the
``portable bytecode'' backend specialized to word size and endianness.
This allows Racket CS to replace Racket BC on those systems while
maintaining comparable performance. (Racket BC lacks JIT support for
those systems anyway.) It also lets us provide a Chez Scheme package on
all systems Guix supports.
This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and
'racket-vm-cs', but it does not change the Racket VM implementation used
for the 'racket' and 'racket-minimal' packages.
* gnu/packages/chez.scm (nix-system->pbarch-machine-type): New variable.
(chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native systems.
[arguments]<#:configure-flags>: Always supply '-m='. Add applicable
flags for non-native systems.
[supported-systems]: Use '%supported-systems'.
[description]: Update.
(chez-scheme-for-racket-bootstrap-bootfiles)[arguments]<#:phases>: Adapt
'build' phase for non-native systems.
* gnu/packages/racket.scm (racket-vm-bc)[description]: Update.
(racket-vm-cs)[description]: Likewise.
[inputs]: Use 'libffi' for non-native systems.
[arguments]<#:configure-flags>: Add applicable flags for non-native
systems.
---
gnu/packages/chez.scm | 76 ++++++++++++++++++++++++++++++-----------
gnu/packages/racket.scm | 26 +++++++++-----
2 files changed, 74 insertions(+), 28 deletions(-)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index be9884b3d2..38b724ae5f 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages chez)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages linux)
#:use-module (gnu packages netpbm)
#:use-module (gnu packages racket)
@@ -50,6 +51,7 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
racket-cs-native-supported-system?
+ nix-system->pbarch-machine-type
unpack-nanopass+stex))
;; Commentary:
@@ -232,6 +234,28 @@ (define* (chez-upstream-features-for-system #:optional
(and=> (assoc-ref %chez-features-table chez-os)
(cut assoc-ref <> chez-arch))))
+(define* (nix-system->pbarch-machine-type #:optional
+ (system
+ (or (%current-target-system)
+ (%current-system)))
+ #:key (threads? #t))
+ "Return a string naming the pseudo–machine type used by Racket's variant of
+Chez Scheme to represent the appropriate ``pbarch'' backend for SYSTEM: that
+is, the ``portable bytecode'' backend specialized for SYSTEM's word size and
+endianness. The result will name the threaded machine type unless THREADS? is
+provided and is #f."
+ (string-append (if threads?
+ "t"
+ "")
+ "pb"
+ (if (target-64bit? system)
+ "64"
+ "32")
+ ;; missing (guix utils) predicate target-little-endian?
+ (if (target-ppc32? system)
+ "b"
+ "l")))
+
(define* (racket-cs-native-supported-system? #:optional
(system
(or (%current-target-system)
@@ -453,10 +477,14 @@ (define-public chez-scheme-for-racket
;; When updating, remember to also update %racket-version in racket.scm.
(source #f) ; avoid problematic cycle with racket.scm
(inputs
- (modify-inputs (package-inputs chez-scheme)
- (delete "libx11" "util-linux:lib")
- (replace "chez-scheme-bootstrap-bootfiles"
- chez-scheme-for-racket-bootstrap-bootfiles)))
+ (let ((inputs (modify-inputs (package-inputs chez-scheme)
+ (replace "chez-scheme-bootstrap-bootfiles"
+ chez-scheme-for-racket-bootstrap-bootfiles)
+ (delete "libx11" "util-linux:lib"))))
+ (if (racket-cs-native-supported-system?)
+ inputs
+ (modify-inputs inputs
+ (append libffi)))))
(native-inputs
(let ((native-inputs (modify-inputs (package-native-inputs chez-scheme)
(append zuo))))
@@ -477,10 +505,16 @@ (define-public chez-scheme-for-racket
((#:configure-flags cfg-flags #~'())
#~`("--disable-x11"
"--threads" ;; ok to potentially duplicate
- #$@(if (%current-target-system)
- (list (string-append "-m="
- (racket-cs-native-supported-system?)))
- '())
+ #$(string-append "-m=" (or (racket-cs-native-supported-system?)
+ (nix-system->pbarch-machine-type)))
+ ;; ^ could skip -m= for non-cross non-pbarch builds
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ ;; not inferred on non-native platforms: see
+ ;; https://racket.discourse.group/t/950/9
+ #~("--enable-libffi"
+ "CFLAGS=-g -O2 -D_REENTRANT -pthread"
+ "LIBS=-lm -ldl -lrt -lffi -lncurses"))
#$@(if (%current-target-system)
(list (string-append "--toolprefix="
(%current-target-system)
@@ -547,10 +581,7 @@ (define-public chez-scheme-for-racket
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
- ;; TODO: How to build pbarch/pbchunks for other systems?
- ;; See https://racket.discourse.group/t/950
- (supported-systems (filter racket-cs-native-supported-system?
- %supported-systems))
+ (supported-systems %supported-systems)
(home-page "https://github.com/racket/ChezScheme")
;; ^ This is downstream of https://github.com/racket/racket,
;; but it's designed to be a friendly landing place for people
@@ -563,13 +594,17 @@ (define-public chez-scheme-for-racket
Main additions to Chez Scheme in the Racket variant:
@itemize @bullet
@item
-AArch64 support
+AArch64 code generation
@item
-Portable bytes (@code{pb}) support, which is mainly useful for bootstrapping
-a build on any supported platform
+Portable bytecode (@code{pb}) mode, which is mainly useful for bootstrapping a
+build on any platform, but can also be used on platforms without native-code
+generation, compiled via Emscripten, linked with @code{libffi}, or used with
+bytecode partially compiled to C
@item
Unboxed floating-point arithmetic and flvectors
@item
+Faster multiplication and division for large exact numbers
+@item
Type reconstruction during optimization (especially for safe code)
@item
Continuation attachments
@@ -580,8 +615,6 @@ (define-public chez-scheme-for-racket
@item
Ordered finalization, immobile (but collectable) objects, weak/ephemeron
generic hash tables, and reference bytevectors
-@item
-Faster multiplication and division for large exact numbers
@end itemize")
(license asl2.0)))
@@ -659,13 +692,18 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
"makefiles/boot.zuo"
(search-input-file (or native-inputs inputs)
"/bin/scheme")
- #$(racket-cs-native-supported-system?)))
+ #$(or (racket-cs-native-supported-system?)
+ (nix-system->pbarch-machine-type))))
(else
;; bootstrapping
#~(invoke
(search-input-file (or native-inputs inputs)
"/opt/racket-vm/bin/racket")
- "rktboot/main.rkt"))))))))))
+ "rktboot/main.rkt"
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ (let ((m (nix-system->pbarch-machine-type)))
+ #~("--machine" #$m)))))))))))))
(supported-systems
(package-supported-systems chez-scheme-for-racket))
(home-page "https://github.com/racket/ChezScheme")
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index ef353103d6..3b96cf46ef 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -331,7 +331,7 @@ (define-public racket-vm-cgc
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
bash-minimal ;; <- common to all variants (for `system`)
- libffi)) ;; <- only for BC variants
+ libffi)) ;; <- for BC and non-native CS variants
(native-inputs (cons* zuo ;; <- for all variants
libtool ;; <- only for BC variants
(if (%current-target-system)
@@ -437,10 +437,8 @@ (define-public racket-vm-bc
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
in C targeting architecture-independent bytecode, plus a JIT compiler on most
-platforms. Racket BC has a different C API and supports a slightly different
-set of architectures than the current default runtime system, Racket CS (based
-on ``Chez Scheme''). It is the recommended implementation for architectures
-that Racket CS doesn't support.
+platforms. Racket BC has a different C API than the current default runtime
+system, Racket CS (based on ``Chez Scheme'').
This package is the normal implementation of Racket BC with a precise garbage
collector, 3M (``Moving Memory Manager'').")
@@ -453,9 +451,12 @@ (define-public racket-vm-cs
(inherit racket-vm-bc)
(name "racket-vm-cs")
(inputs
- (modify-inputs (package-inputs racket-vm-cgc)
- (prepend zlib lz4)
- (delete "libffi")))
+ (let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
+ (prepend zlib lz4))))
+ (if (racket-cs-native-supported-system?)
+ (modify-inputs inputs
+ (delete "libffi"))
+ inputs)))
(native-inputs
(let ((native-inputs (package-native-inputs racket-vm-cgc)))
(modify-inputs (if (%current-target-system)
@@ -484,12 +485,19 @@ (define-public racket-vm-cs
#+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ #~(#$(string-append "--enable-mach="
+ (nix-system->pbarch-machine-type))
+ "--enable-pb"))
#$(racket-vm-common-configure-flags)))))
(synopsis "Racket CS implementation")
(description "The Racket CS implementation, which uses ``Chez Scheme'' as
its core compiler and runtime system, has been the default Racket VM
implementation since Racket 8.0. It performs better than the Racket BC
-implementation for most programs.
+implementation for most programs. On systems for which Racket CS cannot
+generate machine code, this package uses a variant of its ``portable
+bytecode'' backend specialized for word size and endianness.
Using the Racket VM packages directly is not recommended: instead, install the
@code{racket-minimal} or @code{racket} packages.")
--
2.32.0
next prev parent reply other threads:[~2022-08-11 11:10 UTC|newest]
Thread overview: 122+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath
2022-08-08 6:10 ` [bug#57050] [PATCH 1/6] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath
2022-08-08 6:10 ` [bug#57050] [PATCH 2/6] gnu: stex: Fix read-only gifs and math directories Philip McGrath
2022-08-08 6:10 ` [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath
2022-08-08 8:53 ` Liliana Marie Prikler
2022-08-09 20:25 ` Philip McGrath
2022-08-09 21:24 ` Maxime Devos
2022-08-09 21:38 ` ( via Guix-patches via
2022-08-09 21:58 ` Philip McGrath
2022-08-09 22:09 ` ( via Guix-patches via
2022-08-10 11:46 ` Maxime Devos
2022-08-08 6:10 ` [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath
2022-08-08 9:01 ` Liliana Marie Prikler
2022-08-09 20:56 ` Philip McGrath
2022-08-10 7:34 ` Liliana Marie Prikler
2022-08-08 6:10 ` [bug#57050] [PATCH 5/6] gnu: racket: Use Racket CS on all systems Philip McGrath
2022-08-08 9:10 ` Liliana Marie Prikler
2022-08-08 6:10 ` [bug#57050] [PATCH 6/6] gnu: chez-scheme-for-racket: Suport " Philip McGrath
2022-08-08 9:15 ` Liliana Marie Prikler
2022-08-10 15:30 ` [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via
2022-08-11 4:00 ` Philip McGrath
2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath
2022-08-11 11:08 ` [bug#57050] [PATCH v2 01/13] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath
2022-08-11 11:08 ` [bug#57050] [PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories Philip McGrath
2022-08-11 11:13 ` Liliana Marie Prikler
2022-08-11 11:08 ` [bug#57050] [PATCH v2 03/13] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath
2022-08-11 11:08 ` [bug#57050] [PATCH v2 04/13] gnu: Add Zuo Philip McGrath
2022-08-11 11:31 ` Liliana Marie Prikler
2022-08-11 14:00 ` Philip McGrath
2022-08-11 15:34 ` Liliana Marie Prikler
2022-08-11 23:32 ` Philip McGrath
2022-08-16 14:47 ` Maxime Devos
2022-08-23 1:40 ` Philip McGrath
2022-08-23 9:11 ` Maxime Devos
2022-08-23 23:24 ` Philip McGrath
2022-08-23 9:20 ` Maxime Devos
2022-08-24 0:27 ` Philip McGrath
2022-08-24 5:42 ` Liliana Marie Prikler
2022-08-24 5:47 ` Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 02/14] gnu: stex: Fix read-only gifs and math directories Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 03/14] etc: teams: Add racket team Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 04/14] etc: teams: Add entry for Philip McGrath Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath
2022-08-25 9:09 ` Liliana Marie Prikler
2022-08-25 19:16 ` Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 06/14] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 07/14] gnu: Add Zuo Philip McGrath
2022-08-25 9:12 ` Liliana Marie Prikler
2022-08-25 10:30 ` Efraim Flashner
2022-08-25 20:04 ` Philip McGrath
2022-08-26 12:01 ` Liliana Marie Prikler
2022-08-27 18:08 ` Philip McGrath
2022-08-27 18:58 ` Liliana Marie Prikler
2022-08-27 19:54 ` Philip McGrath
2022-08-27 21:18 ` Liliana Marie Prikler
2022-08-27 21:28 ` Philip McGrath
2022-08-27 22:26 ` Liliana Marie Prikler
2022-08-25 8:54 ` [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6 Philip McGrath
2022-08-25 9:14 ` Liliana Marie Prikler
2022-08-25 10:39 ` Efraim Flashner
2022-08-25 8:54 ` [bug#57050] [PATCH v3 09/14] gnu: chez-scheme: Make bootfiles regular inputs Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 10/14] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 11/14] gnu: racket: Support cross-compiling the VM packages Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath
2022-08-25 9:24 ` Liliana Marie Prikler
2022-08-25 10:50 ` Efraim Flashner
2022-08-25 20:17 ` Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 13/14] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath
2022-08-25 8:54 ` [bug#57050] [PATCH v3 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath
2022-08-25 9:17 ` Liliana Marie Prikler
2022-08-26 21:15 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via
2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 02/14] gnu: stex: Fix read-only gifs and math directories Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 03/14] etc: teams: Add racket team Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 04/14] etc: teams: Add entry for Philip McGrath Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 06/14] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 07/14] gnu: Add Zuo Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 08/14] gnu: racket: Update to 8.6 Philip McGrath
2022-08-27 19:21 ` Liliana Marie Prikler
2022-08-27 20:30 ` Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 09/14] gnu: chez-scheme: Make bootfiles regular inputs Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 10/14] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 11/14] gnu: racket: Support cross-compiling the VM packages Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 12/14] gnu: chez-scheme-for-racket: Support all systems Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 13/14] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath
2022-08-27 18:55 ` [bug#57050] [PATCH v4 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath
2022-09-04 20:53 ` bug#57050: [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Ludovic Courtès
2022-08-11 11:08 ` [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6 Philip McGrath
2022-08-11 11:44 ` Liliana Marie Prikler
2022-08-11 22:40 ` Philip McGrath
2022-08-12 6:34 ` Liliana Marie Prikler
2022-08-22 8:41 ` Efraim Flashner
2022-08-22 18:56 ` Philip McGrath
2022-08-11 11:08 ` [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs Philip McGrath
2022-08-11 11:47 ` Liliana Marie Prikler
2022-08-11 22:45 ` Philip McGrath
2022-08-12 4:21 ` Liliana Marie Prikler
2022-08-11 11:08 ` [bug#57050] [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath
2022-08-11 11:56 ` Liliana Marie Prikler
2022-08-11 22:49 ` Philip McGrath
2022-08-11 11:08 ` [bug#57050] [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages Philip McGrath
2022-08-11 11:58 ` Liliana Marie Prikler
2022-08-11 23:23 ` Philip McGrath
2022-08-11 11:08 ` Philip McGrath [this message]
2022-08-11 12:02 ` [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems Liliana Marie Prikler
2022-08-11 23:25 ` Philip McGrath
2022-08-11 11:08 ` [bug#57050] [PATCH v2 10/13] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath
2022-08-11 11:08 ` [bug#57050] [PATCH v2 11/13] gnu: racket: Use Racket CS on all systems Philip McGrath
2022-08-11 12:03 ` Liliana Marie Prikler
2022-08-11 11:08 ` [bug#57050] [PATCH v2 12/13] etc: teams: Add racket team Philip McGrath
2022-08-11 12:11 ` Liliana Marie Prikler
2022-08-11 11:08 ` [bug#57050] [PATCH v2 13/13] etc: teams: Add entry for Philip McGrath Philip McGrath
2022-08-13 17:43 ` [bug#57050] [PATCH v2 00/13] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via
2022-08-15 5:47 ` [bug#57050] [RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket' Philip McGrath
2022-08-15 6:12 ` Philip McGrath
2022-08-15 19:54 ` [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le Philip McGrath
2022-08-19 0:51 ` Thiago Jung Bauermann via Guix-patches via
2022-08-19 10:10 ` Maxime Devos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d63cf22559de641440810e451b9366aa6091774.1660215295.git.philip@philipmcgrath.com \
--to=philip@philipmcgrath.com \
--cc=57050@debbugs.gnu.org \
--cc=bauermann@kolabnow.com \
--cc=liliana.prikler@gmail.com \
--cc=liliana.prikler@ist.tugraz.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).