Official chibi-scheme repository
Find a file
Vitaliy Mysak 5726c2e490 Prevent stack overflow in sexp_mark_one (issue #601)
Replace explicit recursion by heap allocations
in sexp_mark_one code.
This prevents crashes caused by stack overflow.
In particular, fixes issue #601.

As an optimization, allocate a fixed sized stack buffer first,
which should be enough for "normal" uses.
When that stack overflows, switch to heap.

Also, store "ranges" on the stack, instead of the actual sexp's,
using the fact that sexp's of a single parent are continous in memory.

This patch doesn't remove recursion on the context saves
because it didn't seem like they overflow in practice.
But changing that is simple having the stack interface.
2020-05-15 20:11:50 +02:00
benchmarks report diff on gc times 2020-05-11 10:28:00 +09:00
build-lib/chibi/char-set Noting some simple char-set utilities are public domain. 2015-04-09 01:43:17 +09:00
contrib cmake: Add CMakeLists.txt 2017-11-18 16:28:31 +09:00
data Adding a gitignore for the temp data dir. 2015-04-09 01:30:06 +09:00
doc Fix typo in sexp_get_output_string documentation 2019-03-09 02:01:39 +01:00
examples Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
include/chibi Prevent stack overflow in sexp_mark_one (issue #601) 2020-05-15 20:11:50 +02:00
js js/exported_functions.json: make it proper json 2018-11-25 19:10:35 +01:00
lib fix compilation under std=c89 2020-05-13 11:12:02 +02:00
opt making string-cursors a disjoint type 2016-03-29 22:25:09 +09:00
tests tests: add std=c89 as build option 2020-05-13 11:12:02 +02:00
tools make-promise is idempotent (issue #625) 2020-04-10 17:17:29 +09:00
.gitignore Add lib/chibi/pty.c to .gitignore 2019-08-28 19:38:08 -05:00
.hgignore Emscripten support by default. Patch from Marc Nieper-Wi?kirchen. 2015-02-22 16:10:30 +09:00
.travis.yml wrong filename 2016-06-24 22:51:36 +09:00
appveyor.yml AppVeyor: Add MSVC x64 configuration to CI 2018-06-20 21:22:36 +09:00
AUTHORS fix compilation under std=c89 2020-05-13 11:12:02 +02:00
bignum.c fix compilation under std=c89 2020-05-13 11:12:02 +02:00
chibi-scheme.pc.in Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
CMakeLists.txt (chibi pty): Disable in CMake build 2019-08-24 07:08:47 +09:00
configure adding informational configure script 2016-06-24 22:55:08 +09:00
COPYING adding (srfi 101) 2018-01-15 23:51:16 +09:00
eval.c don't verify duplicate formal parameters for more than 100 params 2020-04-19 19:20:01 +09:00
fedora.spec Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
gc.c Prevent stack overflow in sexp_mark_one (issue #601) 2020-05-15 20:11:50 +02:00
gc_heap.c Hide unnecessarily exported symbols 2020-02-02 16:59:57 +02:00
main.c Write usage to stderr when bad options given 2020-04-23 13:59:27 +03:00
Makefile make: fix uninstall target 2020-05-11 23:19:48 +02:00
Makefile.detect build on Solaris-like systems 2019-08-11 22:30:17 +00:00
Makefile.libs Merge pull request #609 from ilammy/snow-usr-local 2020-02-06 21:15:39 +08:00
mkfile Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
opcodes.c fixing read-line on network ports 2019-05-04 13:18:27 +08:00
plan9.c Updating copyright years. 2015-04-09 01:28:02 +09:00
README-win32.md doc: Update README-win32.md to reflect recent changes 2018-06-20 21:22:36 +09:00
README.libs Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
README.md Note that chibi works on OpenBSD in the README 2019-03-10 15:03:48 -05:00
RELEASE bumping version 2017-10-06 23:56:31 +09:00
sexp.c Prevent stack overflow in sexp_mark_one (issue #601) 2020-05-15 20:11:50 +02:00
simplify.c Updating copyright years. 2015-04-09 01:28:02 +09:00
TODO updating note about thread status in TODO 2018-04-03 07:53:36 +09:00
VERSION bumping version 2017-10-06 23:56:31 +09:00
vm.c check for circular lists in apply (issue #629) 2020-05-03 17:19:24 +09:00

Chibi-Scheme

Minimal Scheme Implementation for use as an Extension Language

http://synthcode.com/wiki/chibi-scheme

Chibi-Scheme is a very small library intended for use as an extension and scripting language in C programs. In addition to support for lightweight VM-based threads, each VM itself runs in an isolated heap allowing multiple VMs to run simultaneously in different OS threads.

There are no external dependencies so is relatively easy to drop into any project.

The default repl language contains all bindings from R7RS small, available explicitly as the (scheme small) library. The language is built in layers, however - see the manual for instructions on compiling with fewer features or requesting a smaller language on startup.

Chibi-Scheme is known to work on 32 and 64-bit Linux, FreeBSD, NetBSD, OpenBSD and OS X, Plan 9, Windows (using Cygwin), iOS, Android, ARM and Emscripten. Basic support for native Windows desktop also exists. See README-win32.md for details and build instructions.

To build on most platforms just run make && make test. This will provide a shared library libchibi-scheme, as well as a sample chibi-scheme command-line repl. You can then run

sudo make install

to install the binaries and libraries. You can optionally specify a PREFIX for the installation directory:

make PREFIX=/path/to/install/
sudo make PREFIX=/path/to/install/ install

By default files are installed in /usr/local.

If you want to try out chibi-scheme without installing, be sure to set LD_LIBRARY_PATH so it can find the shared libraries.

For more detailed documentation, run make doc and see the generated doc/chibi.html.