Commit graph

2261 commits

Author SHA1 Message Date
ilammy
a1ec8ff493 Avoid overflow when doing sexp_fx_abs()
Naturally, fixed-width integer arithmetics can overflow. Chibi handles
it pretty well in general, but one case was missing: it is negation of
the minimal negative number that can be represented as a fixnum. That is,
sexp_fx_neg() must not be applied to sexp_make_fixnum(SEXP_MIN_FIXNUM)
because it overflows and returns an identical fixnum back.

sexp_fx_neg() itself seems to be used right in the current code, but
sexp_fx_abs()--which is defined in terms of sexp_fx_neg()--could be
applied to the forbidden number when used to retrieve an unboxed value
via the sexp_unbox_fixnum(sexp_fx_abs(x)) pattern. So I have added a
separate macro that safely calculates unboxed absolute value of a fixnum,
and replaced sexp_unbox_fixnum(sexp_fx_abs(x)) usages with it.

Current implementation uses two-bit tag for fixnums, plus we need one
bit for the sign, so fixnums have (machine word - 3) significant bits.
Regression tests cover word sizes of 16, 32, 64, and 128 bits (for the
sake of past- and future-proofness).

sexp_bignum_expt() does not have a regression test because we need to
check it with negative exponents like -2^29, so the base must be over
at least 2^(2^29) for the differences to be visible. Fun fact: bignum
representation of such number takes around 1/32 of the available user-
space memory, which makes testing on anything except 32-bit systems
unreasonable (4 TB of RAM anyone?)
2015-03-26 02:30:48 +02:00
Alex Shinn
3700b86470 Updating submodule. 2015-03-22 23:17:14 +09:00
Alex Shinn
d08ce6e925 regexp-search can terminate early if a match is found and all remaining possible matches start to the right of it 2015-03-22 22:45:36 +09:00
Alex Shinn
87761001aa Adding (time [<name>] <expr>) macro for easy benchmarking. 2015-03-22 22:44:38 +09:00
Alex Shinn
9dcf11056c Updating submodule. 2015-03-22 17:16:58 +09:00
Alex Shinn
11d9e1114e Ignoring generated tarballs. 2015-03-22 17:15:25 +09:00
Alex Shinn
6c08d399e7 changes go to the 0.7.3 release 2015-03-22 17:02:41 +09:00
Alex Shinn
ce7ab08e1e Updating submodule. 2015-03-22 16:17:53 +09:00
Alex Shinn
2576183b48 Updating submodule. 2015-03-22 16:06:08 +09:00
Alex Shinn
f95153f6c1 Adding .gitignore. 2015-03-17 22:50:40 +09:00
Alex Shinn
b22e81afd6 fixing install target for snow-chibi 2015-03-17 22:09:32 +09:00
Alex Shinn
62c0dd1ede removed snow-chibi tool moved to submodule 2015-03-17 22:06:10 +09:00
Alex Shinn
dba883c687 added submodule for removed chibi-snow 2015-03-17 21:53:47 +09:00
Alex Shinn
96e3c8f06f removing lib/chibi/snow dir to make it a submodule 2015-03-17 21:52:09 +09:00
Alex Shinn
3000523427 Bugfix in hash-table-copy which didn't copy hash function.
Patch from Alexei Lozovsky.
2015-03-13 07:10:41 +09:00
Alex Shinn
2db64f67f8 Fixing typo in r7rs-tests.
Was testing be-like-begin1 twice instead of be-like-begin2.
2015-03-12 22:39:43 +09:00
Alex Shinn
7b8af8725d Better C++ genstatic support. 2015-03-06 17:48:11 +09:00
Alex Shinn
9b3529b0e6 Hacky C++ fixes. 2015-03-06 17:43:23 +09:00
Alex Shinn
214a1aaf78 C++ FFI fixes. 2015-03-06 17:41:29 +09:00
Alex Shinn
64c148c9ce C++ fixes. 2015-03-06 17:35:06 +09:00
Alex Shinn
c16f36ceee Fixing typo in non-chibi regexp code.
The second %char-set:punctuation should have been %char-set:symbol.
2015-03-03 08:17:13 +09:00
Alex Shinn
217a231064 Fixing typo in emscripten code.
Fixes issue #248.
2015-03-03 08:15:57 +09:00
Alex Shinn
447eb20a07 Disabling 2010 epoch by default. 2015-03-03 00:40:02 +09:00
Alex Shinn
390308fe0b Fixing SRFI 115 bug reports from Will Clinger.
Adding regexp-partition.
2015-03-02 23:47:32 +09:00
Alex Shinn
327685359c Fixing implicit package name from libraries. 2015-02-25 23:51:43 +09:00
Alex Shinn
fc457c6146 Adding optional EXTRA_COMPILED_LIBS to Makefile. 2015-02-25 23:18:33 +09:00
Alex Shinn
f7be2d452e Adding missing emscripten files.
Fixes issue #247.
2015-02-25 07:43:35 +09:00
Alex Shinn
956b968ab4 clibs.c should depend on the generated c files 2015-02-22 16:16:24 +09:00
Alex Shinn
1c112fc008 Adding (library X) feature support to chibi-genstatic library expander. 2015-02-22 16:15:55 +09:00
Alex Shinn
dc5e7e397d Emscripten support by default. Patch from Marc Nieper-Wi?kirchen. 2015-02-22 16:10:30 +09:00
Alex Shinn
3f85d7c2c0 Using CHIBI_DEPENDENCIES in clibs.c rule deps instead of hard-coded chibi-scheme. 2015-02-17 19:52:39 +09:00
Alex Shinn
41ea3bb835 chibi-genstatic only needs -q 2015-02-16 22:50:11 +09:00
Alex Shinn
b869132175 Removing uneeded trailing /. 2015-02-15 11:22:11 +09:00
Alex Shinn
692a231091 merge 2015-02-13 19:04:59 +09:00
Alex Shinn
1f08bd90c1 Support integer/real options with better error handling. 2015-02-13 19:03:54 +09:00
Alex Shinn
a7877b773b genstatic fixes 2015-02-13 19:03:12 +09:00
Alex Shinn
b6fb51f1f2 Adding include-shared-optionally. 2015-02-13 19:02:48 +09:00
Alex Shinn
ed4cef9294 Adding sexp_length macro. 2015-02-13 19:02:28 +09:00
Alex Shinn
a958987144 FFI updates: adding ffi-include, length in values, bugfix cast in calloc. 2015-02-13 19:00:41 +09:00
Alex Shinn
9007d1675e fixing -c in chibi-ffi 2015-02-12 23:50:15 +09:00
Alex Shinn
695b845b11 for http uris with empty hosts, omit the scheme in the string repr 2015-02-11 20:27:27 +09:00
Alex Shinn
57e657a48d forgot to pass config to rewrite rules 2015-02-11 20:20:40 +09:00
Alex Shinn
7d897bbf15 request-with-uri should reparse request params 2015-02-11 20:19:49 +09:00
Alex Shinn
ed458469a7 Fixing index file handling to take the index relative to the url, not the search path. 2015-02-11 19:05:35 +09:00
Alex Shinn
6319d11291 Fixing bug in conf-get-multi. 2015-02-11 16:35:09 +09:00
Alex Shinn
64b4d7b2fe Exporting html-tag->string. 2015-02-11 14:11:54 +09:00
Alex Shinn
49cc343e15 Exporting html-escape. 2015-02-11 14:09:19 +09:00
Alex Shinn
8dc6f6c34e Exporting call-with-input-file and call-with-output-file from (chibi io). 2015-02-11 14:04:33 +09:00
Alex Shinn
8d13dad49b Adding file->string and file->bytevector. 2015-02-11 10:41:16 +09:00
Alex Shinn
3f588a558f Fixing -- args for -R scripts. 2015-02-08 17:48:04 +09:00