Commit graph

3676 commits

Author SHA1 Message Date
Alex Shinn
8b27ce9726 add proper grammar support to srfi 130 string-split 2021-04-02 13:51:02 +09:00
Alex Shinn
d80589144d close stdout/err in process->foo utilities
Relying on gc can accumulate many open fd's,
which is bad for code outside of chibi.
2021-03-31 09:23:21 +09:00
Alex Shinn
7ea15f3810 check for wrapping to negative in hash lookup of cell (issue #735)
Without this chibi can crash after 129 open file descriptors.

Note the bug referenced would also indirectly be fixed if
process->string-list properly closed its ports, but we
shouldn't rely on that.
2021-03-31 06:43:27 +09:00
Alex Shinn
13a2a562d9 forgot to specify literals 2021-03-28 23:43:49 +09:00
Alex Shinn
26d3a010df adding assert macro 2021-03-26 23:12:37 +09:00
Alex Shinn
adec61993b adding domain checks on uvector accessors 2021-03-26 17:34:25 +09:00
Alex Shinn
70af1d6394 Friendlier error for bad trace command (issue #733). 2021-03-23 12:13:09 +09:00
Alex Shinn
969f24db96
Merge pull request #722 from flynn162/patch-1
Typo in the documentation
2021-03-04 19:31:09 +09:00
Alex Shinn
2d562bdae1
Merge pull request #730 from smazga/plan9
make 9front "work" again by properly handling 64-bit typedefs
2021-02-21 10:10:46 +09:00
McKay Marston
683554c2ab make 9front "work" again by properly handling 64-bit typedefs 2021-02-20 17:10:43 -07:00
Alex Shinn
de02feb8ff
Merge pull request #729 from lassik/srfi-193
Add SRFI 193 Scheme library
2021-02-05 21:36:20 +09:00
Lassi Kortela
fa52b4987a Add SRFI 193 Scheme library
This was accidentally left out of the previous commit.
2021-02-05 14:08:31 +02:00
Alex Shinn
08a7ec736c
Merge pull request #728 from lassik/command-lines
Re-implement SRFI 193 (Command line)
2021-02-04 23:00:31 +09:00
Lassi Kortela
ac698ce6ae Re-implement SRFI 193 (Command line) 2021-02-01 21:29:26 +02:00
Alex Shinn
19228cbfb8 cleaning up more dirs on uninstall (issue #725) 2021-01-25 11:07:48 +09:00
Alex Shinn
b2bd44eaf0
Merge pull request #724 from ashinn/revert-619-command-lines
Revert "Implement SRFI 193: Command lines"
2021-01-24 19:58:13 +09:00
Alex Shinn
9f0ed1a869
Revert "Implement SRFI 193: Command lines" 2021-01-24 19:57:55 +09:00
Alex Shinn
751675c6b2
Merge pull request #619 from lassik/command-lines
Implement SRFI 193: Command lines
2021-01-24 16:44:35 +09:00
Alex Shinn
e53d79adfd
Merge pull request #723 from lassik/typo
Fix typo
2021-01-18 09:44:53 +09:00
Lassi Kortela
0be78ed7e6 Fix typo 2021-01-17 14:10:41 +02:00
Flynn Liu
0ccfb57833
Typo in the documentation 2021-01-10 14:13:01 -08:00
Alex Shinn
1828ef068e fix env size (issue #453) 2020-12-28 12:07:54 +09:00
Alex Shinn
b4dd757e3f more consistently setting renames (issue #453) 2020-12-28 11:55:10 +09:00
Alex Shinn
4edf3344f8
Merge pull request #721 from ilammy/aliasing-issues
Fix unaligned access in bytevector-{u,s}{16,32,64}-{ref,set!}
2020-11-30 20:11:54 +09:00
Alexei Lozovsky
266a188ce2
More tests for unaligned bytevector access
Make sure that we don't miss anything and cover the rest of bytevector
accessors with tests for unaligned memory access. Include both integers
and floats, in little and big endian flavors.
2020-11-30 17:15:57 +09:00
Alexei Lozovsky
af60b8d937
Fix unaligned access in bytevector-{u,s}{16,32,64}-{ref,set!}
Native code implementing bytevector accessors uses the following access
pattern:

    *(intNN_t*)(base+offset)

This can result in so called "unaligned memory access" if the offset is
not a multiple of 2, 4, 8, or if the base address has not been allocated
at an aligned address (unlikely).

Most popular modern architectures--x86 and ARMs--allow unaligned memory
accesses on the instruction level but they are typically performed a bit
slower than properly aligned accesses.

On the other hand, there are architectures which do not allow unaligned
memory accesses. Each load or store of a value longer than 1 byte should
use properly aligned address on those architectures. That is, u16 should
be loaded from even addresses, s32 should only be stored at an address
which is a multiple of 4, and f64 (aka double) can be located only at
addresses which are multiple of 8. If the address is not aligned, CPU
raises an exception which typically results in the process being killed
by the operating system with a SIGBUS signal.

SPARC is one of those architectures which are strict with alignment. The
current access pattern in bytevector native code can result in unaligned
accesses, which in turn results in crashes. This issue has been found in
this way: Chibi test suite includes some tests for unaligned accesses
and it failed on SPARC.

In order to avoid unaligned accesses, loads and stores need to be
performed a bit differently, doing 'type punning' in a safe way, not
just casting pointers which breaks strict aliasing rules.

The most portable and efficient way to do this is to use memcpy().
Compilers know about this trick and generate very efficient code here,
avoiding the function call and using the most efficient instructions.
(Obviously, only when optimizations are enabled.)

That is, given

    static inline uint32_t ref_u32(const void* p) {
      uint32_t v;
      memcpy(&v, p, sizeof(v));
      return v;
    }

on x86 this will be compiled into a single "movl" instruction because
x86 allows unaligned accesses, similar with ARM where this becomes
a single "ldr" instruction. However, on RISC-V--another platform with
strict alignment rules--this code compiles into 4 "lbu" instructions
fetching 4 bytes, then some more arithmetic to stitch those bytes into
a single 32-bit value.
2020-11-30 16:46:44 +09:00
Alex Shinn
3f228ce731
Merge pull request #716 from amirouche/fix/emscripten-build
Makefile: js: fix build for emscripten 2.0.8.
2020-11-30 13:51:43 +09:00
Alex Shinn
a3afe4e804 don't change dir when generating images (issue #707) 2020-11-25 23:26:18 +09:00
Alex Shinn
56a31f9cb0 don't declare image loading operations if not enabled (issue #714) 2020-11-25 23:16:12 +09:00
Alex Shinn
f9c00e0c21
Merge pull request #713 from mnieper/and-let
Fix and-let* so that it allows bodies according to SRFI 2.
2020-11-25 14:40:16 +09:00
Alex Shinn
0597ea68a5
save a char and a beta reduction 2020-11-25 14:39:49 +09:00
Alex Shinn
54f55569e2 document sexp_lookup_type (issue #718) 2020-11-25 14:36:54 +09:00
Alex Shinn
79e76b295f Merge branch 'master' of github.com:ashinn/chibi-scheme 2020-11-19 13:14:17 +09:00
Alex Shinn
181b7fe7e4 preserve exactness in sqrt of ratios where possible 2020-11-19 13:13:37 +09:00
Alex Shinn
841a8a3167
Merge pull request #717 from bjoli/patch-1
Fix bug in accumulating in (chibi loop)
2020-11-04 21:12:42 +09:00
Linus Björnstam
c896bf90c5
Fix bug in accumulating in (chibi loop)
Accumulating has a bug that makes only lists supported, due to it ignoring the init value and always use the empty list. This fixes that.
2020-11-04 11:56:41 +01:00
Amirouche
f13c826da0 Makefile: js: fix build for emscripten 2.0.8.
$ emcc --version
emcc (Emscripten gcc/clang-like replacement) 2.0.8 (d059fd603d0b45b584f634dc2365bc9e9a6ec1dd)
2020-11-02 11:20:35 +01:00
Marc Nieper-Wißkirchen
306dbd470a Fix and-let* so that it allows bodies according to SRFI 2. 2020-10-22 15:13:04 +02:00
Alex Shinn
12636f4b19
Merge pull request #711 from woodfinisc/patch-1
Fix a typo in README.md
2020-10-17 06:57:39 +09:00
Alex Shinn
b6186d1272
Merge pull request #710 from gahr/freebsd-versioned-so
Produce a versioned so on FreeBSD
2020-10-17 06:41:17 +09:00
Tom Woodfin
0f5f9e3117
Fix a typo in README.md
seemless => seamless
2020-10-16 15:09:29 -04:00
Pietro Cerutti
f48312fad3 Produce a versioned so on FreeBSD 2020-10-16 13:10:58 +00:00
Alex Shinn
30b575debe
Merge pull request #709 from gahr/doc-depends-on-so
Building docs depends on having the shared libraries available
2020-10-14 22:10:09 +09:00
Pietro Cerutti
f85c1a3545 Building docs depends on having the shared libraries available
This unbreaks compiling with multiple make jobs.
2020-10-14 10:06:56 +00:00
Alex Shinn
568206041a Merge branch 'master' of github.com:ashinn/chibi-scheme 2020-10-11 21:31:57 +09:00
Alex Shinn
4e1ff91cbb patch for plan9 build from raingloom 2020-10-11 21:31:42 +09:00
Alex Shinn
3334957956
Merge pull request #708 from pclouds/document-getenv
chibi-scheme.1: document CHIBI_IGNORE_SYSTEM_PATH
2020-10-02 23:00:34 +09:00
Nguyễn Thái Ngọc Duy
78e381ae7d chibi-scheme.1: document CHIBI_IGNORE_SYSTEM_PATH
while at there, spell out the empty CHIBI_MODULE_PATH case. It's obvious
if you really think about it, but it's even better if I don't have to
read between the lines.

I did grep getenv to find if anything was missing. There is
CHIBI_MAX_ALLOC, but I think that one is more about debugging
out-of-memory than to be customized by the user.
2020-09-30 16:15:54 +07:00
Alex Shinn
77aab98784 Merge branch 'master' of github.com:ashinn/chibi-scheme 2020-09-22 17:37:33 +09:00
Alex Shinn
4ef6c57d3e propagating #i prefix across radix prefixes (issue #706) 2020-09-22 17:37:22 +09:00