Commit graph

163 commits

Author SHA1 Message Date
Amirouche
d2006daa3c Fix build with emscripten to run chibi in the browser.
emcc (Emscripten gcc/clang-like replacement) 1.39.16 (9ecd579ac647c4484e2d9af2ab0bbc1e1505aa95)

Thanks @pmp-p.
2020-05-17 10:52:46 +02:00
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
Donaim
bd62a076c6 Avoid undefined C macro behavior
MacOS and clang compilers complain about undefined behavior
in C macro.
Rewrite macro to solve that.

Fixes issue #638
2020-05-13 22:23:17 +02:00
Alex Shinn
89201a4e20 remove bad redefinition of sexp_context_gc_count (issue #632) 2020-05-12 10:39:27 +09:00
Alex Shinn
83e82f55a7 tweaks for fixed-size heaps, fix issue #632 2020-05-11 10:43:36 +09:00
Alex Shinn
e3db106f96 instrumenting alloc times and sizes 2020-05-06 23:39:01 +09:00
Alex Shinn
9100909ae1 better defaults and debugging for fixed size chunks 2020-05-05 00:41:20 +09:00
Alex Shinn
156ddf793d better benchmark timing 2020-05-03 17:05:53 +09:00
Kris Katterjohn
4c1af8c92a Fix NetBSD, DragonFly BSD and Darwin feature detection
On NetBSD systems the netbsd feature identifier was not actually
provided because the macro SEXP_NETBSD was defined twice and the
second value was 0.

On DragonFly systems the dragonfly feature identifier was not actually
provided because the macro SEXP_DRAGONFLY was defined twice and the
second value was 0.  Also on DragonFly systems the darwin feature
identifier was incorrectly provided because SEXP_DARWIN had a value of
1 instead of 0.
2019-08-15 19:03:57 -05:00
Andrew Gwozdziewycz
e5ae89c9c6 Define / detect explicit features for BSD platforms 2019-08-02 11:33:59 -07:00
okuoku
3d4e8bb3e6 Introduce SEXP_STATIC_LIBRARY
Introduce SEXP_STATIC_LIBRARY to support static-library build on
Win32/Win64. On Win32, symbol visibility is enforced on DLL builds so we
need to dedicated ABI on static-library builds.
2019-06-23 05:46:22 +09:00
Alex Shinn
104811942f fixing read-line on network ports 2019-05-04 13:18:27 +08:00
Lassi Kortela
2dc4353604 Avoid compiler warning about mismatched printf types
Under Unix with SEXP_64_BIT defined, sexp_sint_t is defined as 'long'.
But we would get the equivalent format specifier SEXP_PRIdFIXNUM from
the OS-defined PRId64 in <inttypes.h>. MacOS defines it as "lld". This
causes the clang printf checker to emit a warning about the 'long' and
'long long' mismatch.

Fix by avoiding system-defined PRId32 and PRId64 format specifiers and
always defining SEXP_PRIdFIXNUM as "d", "ld" or "lld" according to our
definition of sexp_sint_t as int, long or long long. This also means
we don't need to include <inttypes.h> any more.
2019-04-24 12:26:01 +03:00
Alex Shinn
08140baa3e making builtin write bounded to avoid cycles (fixes issue #532) 2019-04-02 22:31:33 +08:00
Alex Shinn
a94a2c7902 uvector fixes 2019-02-25 23:01:35 +08:00
Alex Shinn
9569460a58 add compile-time option to store precomputed index->cursor tables for strings 2019-01-26 05:35:27 +08:00
Alex Shinn
d24d75621d fixing nofeature build 2019-01-16 08:33:04 +08:00
Alex Shinn
2b4394ea74 adding initial support for SRFI 160 uniform vectors 2019-01-15 23:43:50 +08:00
Alex Shinn
2c37dfedd3
Merge pull request #500 from mnieper/syntax-case
Implement syntax-case
2018-12-09 04:08:31 +08:00
Alex Shinn
9af77c9b4f adding CHIBI_IGNORE_SYSTEM_PATH=1 env var (fixes issue #501) 2018-12-06 00:54:21 +08:00
Marc Nieper-Wisskirchen
152b20f244 Implement syntax-case 2018-12-01 13:48:25 +01:00
Marc Nieper-Wisskirchen
f9be5c8d46 Make write/display output bytevectors with hex constants (issue #483) 2018-11-06 14:22:38 +01:00
Ekaterina Vaartis
5f161d03ce Add C++ extern "C" to gc_heap.h 2018-10-04 10:49:30 +03:00
Kris Katterjohn
f32def466b Avoid undefined C macro behavior
A C macro expanding to a `defined' has undefined behavior.  The
clang compiler was issuing warnings.
2018-07-29 19:58:37 -05:00
Alex Shinn
0efa071672 use PRId64/32 where available for printing fixnums (issue #479) 2018-06-29 22:44:16 +08:00
okuoku
432b763555 cmake: Use SEXP_64BIT on Win64
Do not override SEXP_64BIT on Win64 as now we have custom-long-long for
it.
2018-06-20 21:16:40 +09:00
Bertrand Augereau
952d7c806b More portable bignums that don't have to rely on gcc 128bit arithmetics extension
SEXP_USE_CUSTOM_LONG_LONGS currently needs SEXP_64_BIT
2018-06-19 04:46:05 +02:00
Jim Rees
b25e46b11b Introduced a second version of sexp_double_to_ratio, named
sexp_double_to_ratio_2, which converts without introducing
round-off errors the way sexp_double_to_ratio does when it
multiplies by 10.

Changed sexp_inexact_to_exact to use this new function when
a non-zero fractional part of the input exists.
2018-03-22 22:19:39 -04:00
Alex Shinn
9e4eb03fb4 only use ape/limits.h on plan9 2018-01-13 22:01:36 +09:00
joe9
b85201f81d patch to compile on 9front 2018-01-12 19:26:17 -07:00
okuoku
1cba43a220 SRFI-151: Fix bit-set? on Win64 which uses long long
Most "1UL" references on bitwise operations should be replaced with
explicit C cast.
2017-12-14 18:03:23 +09:00
okuoku
e45f142b6a sexp.h: chmod -x 2017-12-13 17:20:53 +09:00
okuoku
7693881125 sexp.c: Use strncasecmp instead of strcasestr
strcasestr is not available on MS C runtime. Use strncasecmp instead
which is in POSIX. MS C runtime has _strnicmp().
2017-11-18 15:24:28 +09:00
okuoku
e092923aac Win32: Fix win32 port
Try to fix win32 port. Now it runs both on Win32/Win64.

Win64 port currently depends on 128bits arithmetic thus it does not run on
MSVC.

Makefile now have EXCLUDE_POSIX_LIBS knob to exclude posix related library
from build.

Introduce msys PLATFORM for Makefile.detect to use MSYS's POSIX
emulation layer. It is intended for linking against MSYS tools; it is
not for embedding to Win32 applications.
2017-11-11 04:31:06 +09:00
Alex Shinn
d4e45dc260 avoid left shifts for string cursors 2017-10-06 22:40:28 +09:00
Alex Shinn
eeb4beb571 adding alignment detection for sparc and mips 2017-08-29 23:07:50 +09:00
Alex Shinn
8f635161d6 #define _REENTRANT to enable lgamma_r from math.h 2017-08-29 22:58:55 +09:00
Alex Shinn
8a9d8c0979 don't arithmetic shift signed ints (fixed issue #425) 2017-08-29 22:47:44 +09:00
Alex Shinn
700380ebe4 don't expand into defined (issue #423) 2017-07-09 08:07:19 +09:00
Alex Shinn
da410523b0 fixing peek-char on non-ascii chars 2017-06-26 22:23:38 +09:00
Alex Shinn
d3c2306220 check bignum type before deref in sexp_[su]int_value (issue #410) 2017-05-18 22:36:33 +09:00
Alex Shinn
383c6cba62 fixing off-by-one error in arithmetic-shift 2017-05-08 23:49:55 +09:00
VermillionAzure
b955dc2698 Arranged definitions to prevent double definition
- It is possible to define `strcasecmp` and
  `strncasecmp` twice if `__MINGW32__` is defined.
  However, the same definition is used if it's not.
  Therefore, I just moved it inside of the "if-defined"
  case. It removes the errors pertaining to that header.

- Additional compilation errors related to the filesystem
  implementation and POSIX definitions of constants still
  are brought up when compiling on Windows 10, MSYS2-mingw-w64
  with gcc.
2017-03-06 00:11:25 -10:00
Alex Shinn
e1d58eb84a adding SHUT_{RD,WR} from mkeeter 2017-02-20 22:14:15 +09:00
Alex Shinn
260f55adec Use a context global instead of a static C global for the default random source.
Fixes issue #385.
2017-01-20 00:49:11 +09:00
Alex Shinn
0fa1179c2f add -T option to disable TCO 2017-01-14 16:51:07 +09:00
Alex Shinn
0281c590f0 Don't use flexible array member syntax when compiling with C++.
Fixes issue #378.
2016-10-27 21:29:13 +09:00
Jasu
0bb88f97ed Remove a spurious semi-colon from the macro sexp_make_vector 2016-07-27 19:27:37 +03:00
Alex Shinn
c953f2ed1d Check the module search path to handle relocated shared libraries
when loading an image.  Fixes issue #345.
2016-06-15 22:50:30 +09:00
Alex Shinn
08494037ea making features a context global 2016-06-12 14:25:46 +09:00