Commit graph

985 commits

Author SHA1 Message Date
Alex Shinn
9a9f974d69 assert improvements: dedup vars, ignore lambdas, allow report: 2021-05-05 07:56:14 +09:00
Alex Shinn
e3083062fa Flattening indexing further.
We can pre-subtract each coeff times its lower bound from the
base coefficient in SRFI 179 indexers.
2021-04-30 14:25:39 +09:00
Alex Shinn
d11106b2f7 Fix upper bounds checks in u64vectors. 2021-04-30 14:02:29 +09:00
Alex Shinn
3c138dc808 Fix validation on specialized-array-reshape. 2021-04-30 13:38:53 +09:00
Alex Shinn
76284f79f0 flattening array indexers 2021-04-28 22:53:16 +09:00
Alex Shinn
ef9daf22c8 handle include-shared in analyze-module 2021-04-26 14:27:11 +09:00
Alex Shinn
cd5bf03537
Merge pull request #740 from lassik/219
Add SRFI 219: Define higher-order lambda
2021-04-18 18:58:39 +09:00
Lassi Kortela
7178d22928 Add SRFI 219: Define higher-order lambda 2021-04-18 12:21:32 +03:00
Alex Shinn
d0510bebe6 simplify array-reduce 2021-04-16 23:35:16 +09:00
Alex Shinn
c8f5f49890 add initial SRFI 179 implementation 2021-04-16 19:53:51 +09:00
Alex Shinn
487ea21d77 check value domains on uvector-set! ops 2021-04-16 10:13:37 +09:00
Alex Shinn
d64f159608 fix docs on test-group 2021-04-16 10:10:18 +09:00
Alex Shinn
fc6e5da915 make-u1vector takes an optional fill 2021-04-15 17:02:44 +09:00
Alex Shinn
e74614d4b3 removing redundant uvector definitions 2021-04-14 17:06:34 +09:00
Alex Shinn
cfbd64f085 fixing bug in prime-above 2021-04-14 16:47:29 +09:00
Alex Shinn
3fc9c22245 fix regression from shadowed bindings in process->output+error+status 2021-04-09 23:09:53 +09:00
Alex Shinn
4bd4f08b59 fix longstanding todo and get signature from analyzed procedure forms 2021-04-08 23:00:12 +09:00
Alex Shinn
8c45c3fb19 better text display 2021-04-08 22:59:34 +09:00
Alex Shinn
f7b546769c update logging tests for fixes in string-split 2021-04-08 10:08:19 +09:00
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
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
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
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
Lassi Kortela
0be78ed7e6 Fix typo 2021-01-17 14:10:41 +02: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
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
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
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
993a6469fe fix a ... match pattern when a is already bound 2020-09-06 22:59:42 +09:00
Nguyễn Thái Ngọc Duy
f4008c92cf snow: add TODO regarding summary before upload 2020-09-05 09:31:29 +07:00
Nguyễn Thái Ngọc Duy
711c89cd97 snow: confirm before uploading packages
Uploading a package is an irreversible operation. It's not even about
accidentally leaking your secret sauce to the internet. You could upload
a package to snow-fort.org by accident and pullute the package name
space [1].

So let's ask the user first before going ahead uploading stuff. We only
ask once even if we're going to upload a dozen packages, so it's not
that annoying. The target repo is also shown in case you want to upload
to a custom repo and want to make sure it does so.

[1] I did (while attempting to uploading to a local snow-fort instance
    during testing). I guess `(chibi snow commands)` is forever mine
    now.
2020-09-04 19:25:29 +07:00
Alex Shinn
645bf03749 change match names to SRFI 204 2020-09-04 18:33:25 +09:00
Alex Shinn
c82baa3aa9 ignore snow package meta files whose installed files have been removed 2020-09-04 14:04:53 +09:00
Alex Shinn
d0bd93822e specify encoding meta for docs, include doctype 2020-09-02 15:52:20 +09:00
Alex Shinn
8597c3eda5 better error handling in http-server request parsing 2020-09-02 11:53:49 +09:00
Alex Shinn
24d1f6a8a5 fix not+and combo (issue #701) 2020-09-02 10:01:28 +09:00
Nguyễn Thái Ngọc Duy
65a1eba878 make optional-test and diff-test run without (chibi test)
Tested with gauche. It's mostly about not importing (chibi test)
unconditionally, and importing (scheme write). And in one case I need to
exclude some tests because gauche catches invalid call forms at compile
time. I'm not sure if that can be caught...
2020-09-01 20:55:03 +07:00
Alex Shinn
e5cf364360 forgot to wrap inline cond-expand defs in begin 2020-09-01 22:27:59 +09:00
Alex Shinn
e7e034dea0 fix previous fix, fk needs to be made cheap, not sk (issue #698) 2020-09-01 17:01:27 +09:00
Alex Shinn
717aeb9e8b fix combinatorial explosion in match-not (issue #698) 2020-09-01 16:38:42 +09:00
Alex Shinn
29df4211ee fix circular expansion (issue #697) 2020-09-01 16:25:00 +09:00
Alex Shinn
9433b8b912 doc style tweaks 2020-09-01 10:59:44 +09:00
Alex Shinn
f6bd8b6266 fix inlined (chibi test) lite 2020-09-01 10:59:25 +09:00
Alex Shinn
217baeeb57 avoid cyclic test deps in snow 2020-08-31 21:52:01 +09:00