Enable Racket CS on amd64.

This commit is contained in:
juanfra 2020-05-20 16:08:28 +00:00
parent 72383b58d9
commit ca7eb53286
9 changed files with 148 additions and 23 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.64 2020/05/14 20:03:25 juanfra Exp $
# $OpenBSD: Makefile,v 1.65 2020/05/20 16:08:28 juanfra Exp $
ONLY_FOR_ARCHS = aarch64 amd64 arm i386 mips64el powerpc sparc64
COMMENT = multi-paradigm programming language
V = 7.7
REVISION = 0
REVISION = 1
PKGNAME = racket-minimal-$V
DISTFILES = racket-minimal-$V-src-builtpkgs${EXTRACT_SUFX} \
racket-openbsd-1${EXTRACT_SUFX}
@ -100,7 +100,7 @@ CONFIGURE_ARGS += --disable-jit \
--disable-places \
--disable-futures
.elif ${MACHINE_ARCH} == "amd64"
CONFIGURE_ARGS += --enable-jit \
CONFIGURE_ARGS += --enable-csdefault \
--enable-places \
--enable-futures
.elif ${MACHINE_ARCH} == "i386"
@ -123,6 +123,14 @@ CONFIGURE_ARGS += --disable-jit \
--disable-futures
.endif
# The embedded versions of BC and CS use different files
.if ${MACHINE_ARCH} == "amd64"
PKG_ARGS += -Dbc=0 -Dcs=1
.else
PKG_ARGS += -Dbc=1 -Dcs=0
.endif
post-install:
@find ${PREFIX} -type f -name '*.orig' -delete
@perl -i -pe 's/installation-name . "snapshot"/installation-name . "$V"/g' ${WRKINST}/etc/racket/config.rktd

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_ChezScheme_s_cpnanopass_ss,v 1.1 2020/05/20 16:08:29 juanfra Exp $
Index: src/ChezScheme/s/cpnanopass.ss
--- src/ChezScheme/s/cpnanopass.ss.orig
+++ src/ChezScheme/s/cpnanopass.ss
@@ -13651,7 +13651,7 @@
,(constant-case architecture
[(x86_64)
`(seq
- (set! ,%rax (inline ,(make-info-inline) ,%popcount ,%rdi))
+ (set! ,%rax (inline ,(make-info-inline) ,%popcount ,%rcx))
(asm-c-return ,null-info ,%rax))]
[else
;; Generate anything, since this should not get called

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-src_ChezScheme_s_x86_64_ss,v 1.1 2020/05/20 16:08:29 juanfra Exp $
Index: src/ChezScheme/s/x86_64.ss
--- src/ChezScheme/s/x86_64.ss.orig
+++ src/ChezScheme/s/x86_64.ss
@@ -1642,9 +1642,9 @@
(asm-helper-call code* target dest-rax)]
[else
;; Used for the body of `popcount-slow`.
- ;; This is the sequence generated by LLVM's __builtin_popcountl()
- ;; __builtin_popcountl() intrinsic, but with pushes and pops
- ;; to save used registers other than the result register %rax.
+ ;; This is the sequence generated by LLVM's __builtin_popcountl(),
+ ;; but with pushes and pops to save used registers other than the
+ ;; result register %rax.
(emit-literal-code (op dest-rax src-rcx code*)
51 ; pushq %rcx
57 ; pushq %rdi

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-src_cs_c_Makefile_in,v 1.1 2020/05/20 16:08:29 juanfra Exp $
Index: src/cs/c/Makefile.in
--- src/cs/c/Makefile.in.orig
+++ src/cs/c/Makefile.in
@@ -466,9 +466,9 @@ common-install:
$(ICP) $(srcdir)/../../start/starter-sh "$(DESTDIR)$(libpltdir)/starter-sh"
$(RACKET) -cu "$(srcdir)/../../racket/collects-path.rkt" "$(DESTDIR)$(libpltdir)/starter" $(DESTDIR)@COLLECTS_PATH@ $(DESTDIR)@CONFIG_PATH@
$(MAKE) system-install
- $(ICP) $(srcdir)/api.h $(includepltdir)/racketcs.h
- $(ICP) $(srcdir)/boot.h $(includepltdir)/racketcsboot.h
- $(ICP) $(SCHEME_INC)/scheme.h $(includepltdir)/chezscheme.h
+ $(ICP) $(srcdir)/api.h "$(DESTDIR)$(includepltdir)/racketcs.h"
+ $(ICP) $(srcdir)/boot.h "$(DESTDIR)$(includepltdir)/racketcsboot.h"
+ $(ICP) $(SCHEME_INC)/scheme.h "$(DESTDIR)$(includepltdir)/chezscheme.h"
$(MAKE) common-@INSTALL_LIBS_ENABLE@-libs
system-install:

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_cs_c_embed-boot_rkt,v 1.1 2020/05/20 16:08:29 juanfra Exp $
Index: src/cs/c/embed-boot.rkt
--- src/cs/c/embed-boot.rkt.orig
+++ src/cs/c/embed-boot.rkt
@@ -134,4 +134,6 @@
(copy-file (car alt) (cdr alt) #t)
(write-offsets (cdr alt)))])
+ (file-or-directory-permissions dest-file (file-or-directory-permissions use-src-file 'bits))
+
(clean-src)))

View File

@ -0,0 +1,48 @@
$OpenBSD: patch-src_racket_src_optimize_c,v 1.1 2020/05/20 16:08:29 juanfra Exp $
Index: src/racket/src/optimize.c
--- src/racket/src/optimize.c.orig
+++ src/racket/src/optimize.c
@@ -9759,11 +9759,42 @@ static void increment_use_count(Scheme_IR_Local *var,
var->optimize.known_val = NULL;
}
+static Scheme_Object *optimize_clone_k(void)
+{
+ Scheme_Thread *p = scheme_current_thread;
+ Scheme_Object *expr = (Scheme_Object *)p->ku.k.p1;
+ Optimize_Info *info = (Optimize_Info *)p->ku.k.p2;
+ Scheme_Hash_Tree *var_map = (Scheme_Hash_Tree *)p->ku.k.p3;
+ int single_use = p->ku.k.i1;
+ int as_rator = p->ku.k.i2;
+
+ p->ku.k.p1 = NULL;
+ p->ku.k.p2 = NULL;
+ p->ku.k.p3 = NULL;
+
+ return optimize_clone(single_use, expr, info, var_map, as_rator);
+}
+
Scheme_Object *optimize_clone(int single_use, Scheme_Object *expr, Optimize_Info *info, Scheme_Hash_Tree *var_map, int as_rator)
/* If single_use is 1, then the old copy will be dropped --- so it's ok to "duplicate"
any constant, and local-variable use counts should not be incremented. */
{
int t;
+
+#ifdef DO_STACK_CHECK
+# include "mzstkchk.h"
+ {
+ Scheme_Thread *p = scheme_current_thread;
+
+ p->ku.k.i1 = single_use;
+ p->ku.k.p1 = (void *)expr;
+ p->ku.k.p2 = (void *)info;
+ p->ku.k.p3 = (void *)var_map;
+ p->ku.k.i2 = as_rator;
+
+ return scheme_handle_stack_overflow(optimize_clone_k);
+ }
+#endif
t = SCHEME_TYPE(expr);

View File

@ -0,0 +1,20 @@
@comment $OpenBSD: PFRAG.bc,v 1.1 2020/05/20 16:08:29 juanfra Exp $
include/racket/escheme.h
include/racket/ext.exp
include/racket/mzconfig.h
include/racket/mzscheme.exp
include/racket/mzscheme3m.exp
include/racket/scheme.h
include/racket/schemef.h
include/racket/schemegc2.h
include/racket/schemex.h
include/racket/schemexm.h
include/racket/schexn.h
include/racket/schgc2obj.h
include/racket/schthread.h
include/racket/schvers.h
include/racket/sconfig.h
include/racket/stypes.h
include/racket/uconfig.h
lib/racket/buildinfo
lib/racket/mzdyn3m.o

View File

@ -0,0 +1,4 @@
@comment $OpenBSD: PFRAG.cs,v 1.1 2020/05/20 16:08:29 juanfra Exp $
include/racket/chezscheme.h
include/racket/racketcs.h
include/racket/racketcsboot.h

View File

@ -1,33 +1,16 @@
@comment $OpenBSD: PLIST,v 1.20 2020/05/14 17:17:57 juanfra Exp $
@comment $OpenBSD: PLIST,v 1.21 2020/05/20 16:08:29 juanfra Exp $
@conflict racket-<6.2
@pkgpath lang/racket
%%bc%%
%%cs%%
@bin bin/racket
bin/racket-user-bin-paths
bin/raco
include/racket/
include/racket/escheme.h
include/racket/ext.exp
include/racket/mzconfig.h
include/racket/mzscheme.exp
include/racket/mzscheme3m.exp
include/racket/scheme.h
include/racket/schemef.h
include/racket/schemegc2.h
include/racket/schemex.h
include/racket/schemexm.h
include/racket/schexn.h
include/racket/schgc2obj.h
include/racket/schthread.h
include/racket/schvers.h
include/racket/sconfig.h
include/racket/stypes.h
include/racket/uconfig.h
lib/racket/
lib/racket/buildinfo
@bin lib/racket/gracket
lib/racket/launchers.rktd
lib/racket/mans.rktd
lib/racket/mzdyn3m.o
@bin lib/racket/starter
lib/racket/starter-sh
lib/racket/system.rktd