Skip to content
This repository was archived by the owner on Sep 13, 2019. It is now read-only.

Commit a403744

Browse files
committed
use cify by default when the JIT is not available
Also, fix problems cross-compiling for Windows.
1 parent 7d48f5b commit a403744

14 files changed

+398
-299
lines changed

INSTALL.txt

Lines changed: 156 additions & 156 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
1-
This is a work-in-progress implementation of Racket with
2-
3-
* the macro expander and module system implemented in Racket, and
4-
5-
* a reimplementation of Racket to run on top of Chez Scheme.
6-
7-
When you just `make`, then you get Racket with the new expander and
8-
the (mostly) old virtual machine.
9-
10-
When you `make cs`, you get Racket-on-Chez as `racket/bin/racketcs`.
11-
12-
Thee "INSTALL.txt" for more information.
13-
14-
----------------------------------------
15-
16-
This is the source code for the core of Racket. See
17-
"INSTALL.txt" for full information on building Racket.
1+
This is the source code for the core of Racket. See "INSTALL.txt" for
2+
full information on building Racket.
183

194
To build the full Racket distribution from this repository, run `make`
20-
in the top-level directory. To build the Minimal Racket, run `make
21-
base`.
5+
in the top-level directory. To build minimal Racket, run `make base`.
226

237
The rest of the Racket distribution source code is in other
24-
repositories under [the Racket GitHub
8+
repositories, mostly under [the Racket GitHub
259
organization](https://github.com/racket).
2610

2711
Contribute to Racket by submitting a pull request, joining the

racket/src/README

Lines changed: 117 additions & 98 deletions
Large diffs are not rendered by default.

racket/src/configure

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ ac_subst_vars='LTLIBOBJS
625625
LIBOBJS
626626
subdirs
627627
MAKE_LOCAL_RACKET
628+
STARTUP_AS_AUTO
628629
STARTUP_AS_C
629630
STARTUP_AS_BYTECODE
630631
CGC_IF_NEEDED_FOR_MMM
@@ -3078,6 +3079,7 @@ show_explicitly_disabled "${enable_sgc}" SGC
30783079
show_explicitly_enabled "${enable_sgcdebug}" "SGC debug mode"
30793080
show_explicitly_enabled "${enable_backtrace}" "3m GC backtraces" "Note that this mode is not intended for normal Racket use"
30803081
show_explicitly_enabled "${enable_cify}" "Startup compiled to C"
3082+
show_explicitly_disabled "${enable_cify}" "Startup compiled to C"
30813083

30823084
show_explicitly_disabled "${enable_float}" "Single-precision floats"
30833085
show_explicitly_enabled "${enable_floatinstead}" "Single-precision default floats" "Note that this mode is NOT RECOMMENDED"
@@ -3235,11 +3237,19 @@ check_page_size=yes
32353237
try_no_nullability_completeness=no
32363238

32373239
if test "${enable_cify}" = "yes" ; then
3238-
STARTUP_AS_BYTECODE=_no
3240+
STARTUP_AS_BYTECODE=_bytecode
32393241
STARTUP_AS_C=
3242+
STARTUP_AS_AUTO=_auto
32403243
else
3241-
STARTUP_AS_BYTECODE=
3242-
STARTUP_AS_C=_no
3244+
if test "${enable_cify}" = "yes" ; then
3245+
STARTUP_AS_BYTECODE=
3246+
STARTUP_AS_C=_c
3247+
STARTUP_AS_AUTO=_auto
3248+
else
3249+
STARTUP_AS_BYTECODE=_bytecode
3250+
STARTUP_AS_C=_c
3251+
STARTUP_AS_AUTO=
3252+
fi
32433253
fi
32443254

32453255
MAKE_LOCAL_RACKET=no-local-racket
@@ -6842,6 +6852,7 @@ LIBS="$LIBS $EXTRALIBS"
68426852

68436853

68446854

6855+
68456856

68466857

68476858
mk_needed_dir()

racket/src/cs/README.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
Work-in-progress Racket on Chez Scheme.
1+
If you just want to build the variant of Racket that runs on Chez
2+
Scheme, then you probably meant to read "./c/README.txt" instead of
3+
this file.
24

3-
You can just use `make cs` in the top-level directory of the "racket7"
4-
repo to build Racket-on-Chez. See "INSTALL.txt" in the top-level
5-
directory for more information.
6-
7-
I you're working on the implementation of Racket-on-Chez, then it's
5+
If you're working on the implementation of Racket-on-Chez, then it's
86
more convenient to work in this directory, so keep reading here.
97

108

racket/src/cs/c/README.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
This directory contains a `configure` script and a makefile (template)
2+
for building the variant of Racket that runs on Chez Scheme. The
3+
result of the build is a `racketcs` executable that embeds both Chez
4+
Scheme and the Racket startup code to behave the same as the
5+
traditional `racket` executable.
6+
7+
If you have a checkout of the main Racket repo, you can just use `make
8+
cs` in the top-level directory of the repo to build Racket-on-Chez.
9+
See "INSTALL.txt" in the top-level directory for more information.
10+
11+
If you want to know more about how Racket-on-Chez is put together, see
12+
"../README.txt".
13+
14+
========================================================================
15+
Requirements
16+
========================================================================
17+
18+
Building Racket-on-Chez requires both an existing Racket build and
19+
Chez Scheme build:
20+
21+
* By default, the build uses Racket as built and installed in-place
22+
in the same way as described in "../../README", so that the Racket
23+
executable is "../../../bin/racket".
24+
25+
You can select a different Racket excutable by supplying
26+
`--enable-racket=...` to `configure`.
27+
28+
* By default, the build uses Chez Scheme as built in a "ChezScheme"
29+
sibling directory of the build directory. The Racket-on-Chez build
30+
needs a Chez Scheme build directory, and not an end-user Chez
31+
Scheme installation, because it needs "kernel.o" as created in a
32+
Chez Scheme build; it may also need makefiles or other scripts in
33+
the Chez Scheme build directory.
34+
35+
See "../README.txt" for information on the required Chez Scheme
36+
version.
37+
38+
You can select a different Chez Scheme build path by supplying
39+
`--enable-scheme=...` to `configure`.
40+
41+
========================================================================
42+
Compiling for supported Unix variants (including Linux and Mac OS)
43+
========================================================================
44+
45+
From two directories up, run the following commands:
46+
47+
mkdir build
48+
cd build
49+
../cs/c/configure
50+
make
51+
make install
52+
53+
Those commands will create an in-place installation of Racket and
54+
store the results of various compilation steps in a separate "build"
55+
subdirectory, which is useful if you need to update your sources,
56+
delete the build, and start from scratch.
57+
58+
You can also run the typical `./configure && make && make install` if
59+
you don't anticipate updating/rebuilding, but it will be harder to
60+
restart from scratch should you need to.

racket/src/cs/c/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ AC_ARG_ENABLE(pthread, [ --enable-pthread link with pthreads (usually
1616
AC_ARG_ENABLE(iconv, [ --enable-iconv use iconv (usually auto-enabled)])
1717
AC_ARG_ENABLE(xonx, [ --enable-xonx use Unix style (e.g., use Gtk) for Mac OS])
1818
AC_ARG_ENABLE(racket, [ --enable-racket=<path> use <path> as Racket to build; or "auto" to create])
19-
AC_ARG_ENABLE(scheme, [ --enable-scheme=<path> Chez Scheme build dierctory at <path>])
19+
AC_ARG_ENABLE(scheme, [ --enable-scheme=<path> Chez Scheme build directory at <path>])
2020
AC_ARG_ENABLE(mach, [ --enable-mach=<mac> Use Chez Scheme machine type <mach>])
2121

2222
show_explicitly_disabled()

racket/src/racket/Makefile.in

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,20 +308,31 @@ headers:
308308
@RUN_RACKET_CGC@ -cqu $(srcdir)/mkincludes.rkt @DIRCVTPRE@"$(DESTDIR)$(includepltdir)"@DIRCVTPOST@ "$(srcdir)" $(MZCONFIGDIR)
309309
cd ..; cp racket/system.rktd "$(DESTDIR)$(libpltdir)/system.rktd"
310310

311-
# This target may update "cstartup.inc", either replacing a stub
312-
# "cstartup.inc" that redirects to "startup.inc" or rebuilding because
313-
# "startup.inc" or "schvers.h" changed; so, during a CGC build, we try
314-
# again after building this target to potentially update the CGC build
315-
# to a compiled-startup build
311+
# The `cstartup` target may update "cstartup.inc", either replacing a
312+
# stub "cstartup.inc" that redirects to "startup.inc" or rebuilding
313+
# because "startup.inc" or "schvers.h" changed; so, during a CGC
314+
# build, we try again after building this target to potentially update
315+
# the CGC build to a compiled-startup build. A particular `cstartup`
316+
# target variant is selected by the `configure` script based on whether
317+
# `--{en,dis}able-cify` is specified; for example `STARTUP_AS_AUTO`
318+
# with be the empty string is neither is specified, in which case
319+
# of the the other targets is selected by a recursive `$(MAKE)`.
320+
321+
cstartup@STARTUP_AS_AUTO@:
322+
$(MAKE) `@RUN_RACKET_CGC@ -cu $(srcdir)/src/startup-select.rkt`
323+
324+
# For compiling the startup code to bytecode
316325
cstartup@STARTUP_AS_BYTECODE@:
317326
@RUN_RACKET_CGC@ -cu $(srcdir)/src/compile-startup.rkt $(CSTARTUPDEST) cstartup.zo $(srcdir)/src/startup.inc $(srcdir)/src/schvers.h
318327

319-
# Similar to above, but when compiling to C instead of bytecode
328+
# For compiling the startup code to C
320329
cstartup@STARTUP_AS_C@:
321330
@RUN_RACKET_CGC@ -cu $(srcdir)/src/cify-check.rkt $(CSTARTUPDEST)
322331
$(MAKE) cstartup.inc
323332

324-
$(CSTARTUPDEST)@STARTUP_AS_C@: $(srcdir)/src/startup.inc $(srcdir)/src/schvers.h
333+
# Running "cify-startup.rkt" through "$(SETUP_BOOT)" generates more
334+
# dependencies in "cstartup.d" for `$(CSTARTUPDEST)`
335+
$(CSTARTUPDEST): $(srcdir)/src/startup.inc $(srcdir)/src/schvers.h
325336
@RUN_RACKET_CGC@ $(SELF_RACKET_FLAGS) $(SETUP_BOOT) cstartup.inc cstartup.d $(srcdir)/src/cify-startup.rkt $(srcdir)/src/startup.inc $(srcdir)/src/schvers.h
326337
@INCLUDEDEP@ cstartup.d
327338

racket/src/racket/cmdline.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static void (*console_printf)(char *str, ...);
1212
#ifdef DOS_FILE_SYSTEM
1313
static void record_dll_path(void)
1414
{
15-
GC_CAN_IGNORE char *dlldir;
15+
GC_CAN_IGNORE wchar_t *dlldir;
1616
dlldir = extract_dlldir();
1717
if (dlldir)
1818
scheme_set_dll_path(dlldir);

racket/src/racket/configure.ac

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ show_explicitly_disabled "${enable_sgc}" SGC
326326
show_explicitly_enabled "${enable_sgcdebug}" "SGC debug mode"
327327
show_explicitly_enabled "${enable_backtrace}" "3m GC backtraces" "Note that this mode is not intended for normal Racket use"
328328
show_explicitly_enabled "${enable_cify}" "Startup compiled to C"
329+
show_explicitly_disabled "${enable_cify}" "Startup compiled to C"
329330

330331
show_explicitly_disabled "${enable_float}" "Single-precision floats"
331332
show_explicitly_enabled "${enable_floatinstead}" "Single-precision default floats" "Note that this mode is NOT RECOMMENDED"
@@ -483,11 +484,19 @@ check_page_size=yes
483484
try_no_nullability_completeness=no
484485

485486
if test "${enable_cify}" = "yes" ; then
486-
STARTUP_AS_BYTECODE=_no
487+
STARTUP_AS_BYTECODE=_bytecode
487488
STARTUP_AS_C=
489+
STARTUP_AS_AUTO=_auto
488490
else
489-
STARTUP_AS_BYTECODE=
490-
STARTUP_AS_C=_no
491+
if test "${enable_cify}" = "yes" ; then
492+
STARTUP_AS_BYTECODE=
493+
STARTUP_AS_C=_c
494+
STARTUP_AS_AUTO=_auto
495+
else
496+
STARTUP_AS_BYTECODE=_bytecode
497+
STARTUP_AS_C=_c
498+
STARTUP_AS_AUTO=
499+
fi
491500
fi
492501

493502
MAKE_LOCAL_RACKET=no-local-racket
@@ -1797,6 +1806,7 @@ AC_SUBST(CGC_IF_NEEDED_FOR_MMM)
17971806

17981807
AC_SUBST(STARTUP_AS_BYTECODE)
17991808
AC_SUBST(STARTUP_AS_C)
1809+
AC_SUBST(STARTUP_AS_AUTO)
18001810

18011811
AC_SUBST(MAKE_LOCAL_RACKET)
18021812

racket/src/racket/dynsrc/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ dynexmpl.o: $(srcdir)/dynexmpl.c $(HEADERS)
6666
../starter@MINGW@@EXE_SUFFIX@: $(srcdir)/../../start/start.c ../mrstarter@EXE_SUFFIX@ sres.o
6767
$(PLAIN_CC) $(ALL_CFLAGS) -o ../starter@EXE_SUFFIX@ $(srcdir)/../../start/start.c sres.o
6868
../mrstarter@EXE_SUFFIX@: smrres.o
69-
$(PLAIN_CC) $(ALL_CFLAGS) -mwindows -DMRSTART -o ../mrstarter@EXE_SUFFIX@ $(srcdir)/start.c smrres.o
69+
$(PLAIN_CC) $(ALL_CFLAGS) -mwindows -DMRSTART -o ../mrstarter@EXE_SUFFIX@ $(srcdir)/../../start/start.c smrres.o
7070

7171
sres.o:
7272
@WINDRES@ -DMZSTART -i $(srcdir)/../../worksp/starters/start.rc -o sres.o

racket/src/racket/src/jitprep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,9 @@ Scheme_Linklet *scheme_jit_linklet(Scheme_Linklet *linklet, int step)
680680

681681
#else
682682

683-
static Scheme_Object *scheme_jit_linklet(Scheme_Object *expr)
683+
Scheme_Linklet *scheme_jit_linklet(Scheme_Linklet *linklet, int step)
684684
{
685-
return expr;
685+
return linklet;
686686
}
687687

688688
#endif
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(module startup-select '#%kernel
2+
(if (eval-jit-enabled)
3+
(display "cstartup_bytecode")
4+
(display "cstartup_c"))
5+
(newline))
6+

racket/src/start/config.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int _configdir_offset = 17; /* Skip permanent tag */
103103
#endif
104104
#include "delayed.inc"
105105

106-
static char *extract_dlldir()
106+
static wchar_t *extract_dlldir()
107107
{
108108
if (_dlldir[_dlldir_offset] != '<')
109109
return _dlldir + _dlldir_offset;

0 commit comments

Comments
 (0)