Jan (janneke) Nieuwenhuizen
99fbb9b2e5
bootstrap: Update M2-Planet x86 definitions from 1.7.0-31-g358b6cf.
...
* lib/m2/x86/x86_defs.M1: Update.
2021-01-01 19:07:22 +01:00
Jan (janneke) Nieuwenhuizen
4a77600868
guix: m2-planet: Update to 1.7.0-31-g358b6cf.
...
* guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0-31-g358b6cf.
2021-01-01 18:53:07 +01:00
Jan (janneke) Nieuwenhuizen
c881e18dae
Revert "Mes C Library: m2/getcwd.c: Remove specialization."
...
This reverts commit 37f44ce9453ef5589b1336c981360de16c154999.
2021-01-01 15:54:13 +01:00
Jan (janneke) Nieuwenhuizen
b23c6885a6
core: Move __getcwd_buf to Mes C Library.
...
* include/mes/mes.h (__getcwd_buf): Move to..
* lib/posix/getcwd.c (__getcwd_buf): ...here.
(getcwd): Refactor.
* src/posix.c (getcwd_): Do not use __getcwd_buf.
2021-01-01 15:43:43 +01:00
Jan (janneke) Nieuwenhuizen
0d337be8ff
bootstrap: Support building with M2-Planet 1.4.
...
* lib/m2/x86/x86_defs.M1 (NOP): New define.
2021-01-01 11:40:51 +01:00
Jan (janneke) Nieuwenhuizen
348dcbcbd7
mescc: Only use signed division when numerator is signed.
...
Currently, sign-extension (CLTD vs XOR EDX) and signed division (IDIV vs
DIV) selected by setting "signed?". See, module/mescc/x86/as.scm.
Possibly we need a signed? based on numerator and denominator, and
add a extend-sign? based on the signedness of the numerator?
* module/mescc/compile.scm (expr->register): Base "signed?" strictly on
signedness of numerator.
2021-01-01 10:31:46 +01:00
Jan (janneke) Nieuwenhuizen
fac6a873f7
mescc: Use unsigned type for sizeof expression.
...
* module/mescc/compile.scm (ast->type): Use unsigned type for sizeof
expression.
2021-01-01 10:30:48 +01:00
Jan (janneke) Nieuwenhuizen
da03a384c8
mescc: Respect integer literal type suffixes.
...
* module/mescc/compile.scm (ast->type): Respect ULL, UL, U, LL, L suffix
on integer literals.
2021-01-01 10:28:24 +01:00
Jan (janneke) Nieuwenhuizen
8f67315eb6
core: Use unsigned constants.
...
* src/gc.c (FRAME_SIZE, M2_CELL_SIZE): Declare unsigned.
(gc_init): Use unsigned suffixes for divisions.
* src/posix.c (TIME_UNITS_PER_SECOND): Declare unsigned.
(UL1000000000): New constant.
(seconds_and_nanoseconds_to_long): Use it.
* src/gc.c (U10, U100): New constants.
(gc_init): Use them.
2021-01-01 10:24:22 +01:00
Jan (janneke) Nieuwenhuizen
b237308f26
core: Use size_t instead of long for gc sizes.
...
* include/mes/mes.h (ARENA_SIZE, MAX_ARENA_SIZE, STACK_SIZE, JAM_SIZE,
GC_SAFETY, MAX_STRING): Use size_t instead of long.
2021-01-01 09:47:22 +01:00
Jan (janneke) Nieuwenhuizen
1a97f941c3
core: Avoid Floating point exception dividing negative numbers.
...
* src/posix.c (seconds_and_nanoseconds_to_long): Use unsigned division.
2021-01-01 09:46:20 +01:00
Jan (janneke) Nieuwenhuizen
6a25b8d3aa
core: Avoid Floating point exception dividing negative numbers.
...
This fixes
kaem --verbose --strict
bin/mes-m2 -c '(display (modulo -1 -1))'
* src/math.c (modulo): Use unsigned division.
2021-01-01 09:04:39 +01:00
Jan (janneke) Nieuwenhuizen
aac33c44b7
bootstrap: Use ./pre-inst-env mescc default.
...
* configure.sh: When CC is mescc, M2-Planet or unset, use
"./pre-inst-env mescc" as default.
2021-01-01 08:52:49 +01:00
Jan (janneke) Nieuwenhuizen
99adc7efdc
tests: string-join: Be noisy.
...
* scaffold/boot/50-string-join.scm ("string-join\n"): Avoid exit 0
without output.
2020-12-30 18:45:18 +01:00
Jan (janneke) Nieuwenhuizen
d79b5edb4f
mes: simple-format: Use core display.
...
* mes/module/mes/simple-format.mes: Do not import (mes display).
2019-11-16 23:05:10 +01:00
Jan (janneke) Nieuwenhuizen
6561480506
mes: Resurrect backtraces.
...
* mes/module/mes/catch.mes (%eh): Resurrect backtraces.
(display-frame): New function.
(display-backtrace): Use it.
2019-11-10 16:08:13 +01:00
Jan (janneke) Nieuwenhuizen
96e6ecaf7d
core: Add abort.
...
* lib/stub/__raise.c: New file.
* kaem.run: Use it.
* src/posix.c (__raise)[SYSTEM_LIBC]: New macro.
(abort_): New function: possibly use it.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
2019-11-10 16:04:25 +01:00
Jan (janneke) Nieuwenhuizen
94643f8361
mes: Remove PEG.
...
PEG is not used and mostly broken.
* mes/module/mes/peg.mes,
mes/module/mes/peg/cache.scm,
mes/module/mes/peg/codegen.scm,
mes/module/mes/peg/simplify-tree.scm,
mes/module/mes/peg/string-peg.scm,
mes/module/mes/peg/using-parsers.scm,
tests/peg.test: Remove.
* AUTHORS: Remove mention.
2020-12-30 17:28:21 +01:00
Jan (janneke) Nieuwenhuizen
ed62c40cc6
.dir-locals: Add test macro indentation.
...
* .dir-locals.el (scheme-mode): Add indentation for pass-if,
pass-if-not, pass-if-eq, pass-if-equal, expect-fail, pass-if-timeout.
2020-12-30 11:47:32 +01:00
Jan (janneke) Nieuwenhuizen
a551d9dcde
mescc: Use (format (current-error-port) ...) instead of stderr.
...
* module/mescc/M1.scm: Use (format (current-error-port) ...) instead of
stderr.
* module/mescc/compile.scm: Likewise.
* module/mescc/mescc.scm: Likewise.
* module/mescc/preprocess.scm: Likewise.
2020-12-30 21:20:19 +01:00
Jan (janneke) Nieuwenhuizen
a788fcfda7
core: Add gc-stats.
...
* include/mes/mes.h (gc_start_time, gc_end_time, gc_time): New
variables.
* src/mes.c (init): Initialize them.
* src/gc.c: Use them.
* src/gc.c (gc_stats): New function.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
* tests/gc.test: Use it.
2020-12-31 10:34:07 +01:00
Jan (janneke) Nieuwenhuizen
c16bdb576b
core: Avoid Floating point exception dividing negative numbers.
...
This fixes
kaem --verbose --strict
bin/mes-m2 -c '(display (/ -1 1))'
* src/math.c (divide): Use signed division.
2020-12-29 22:39:31 +01:00
Jan (janneke) Nieuwenhuizen
d984618a48
Mes C Library: m2/execve.c: Remove specialization.
...
* lib/linux/execve.c (execve): Cater for M2-Planet.
* lib/m2/execve.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
2020-12-29 19:13:02 +01:00
Jan (janneke) Nieuwenhuizen
f07856de0f
Mes C Library: m2/getcwd.c: Remove specialization.
...
* lib/posix/getcwd.c (getcwd): Cater for M2-Planet.
* lib/m2/getcwd.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
2020-12-29 18:52:37 +01:00
Jan (janneke) Nieuwenhuizen
fca14d27ad
Mes C Library: m2/ioctl.c: Remove specialization.
...
* lib/stub/ioctl.c (ioctl3): Move to...
* lib/stub/ioctl3.c: ...new file.
* lib/m2/ioctl3.c: Move to...
* lib/linux/ioctl3.c: ...here.
* include/mes/lib.h (ioctl3): Declare it.
* lib/m2/isatty.c (isatty): Use it.
* build-aux/configure-lib.sh (libc_SOURCES): Include it; move
lib/linux/ioctl.c to ...
(libc_gnu_SOURCES): ... here.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
* simple.sh (compiler): Likewise.
2020-12-29 18:41:45 +01:00
Jan (janneke) Nieuwenhuizen
a4e56aac56
Mes C Library: m2/ntoab.c: Remove specialization.
...
* lib/mes/ntoab.c (__mesabi_uldiv)[__M2_PLANET__ || !(__MESC__ &&
__arm__)]: New function.
* lib/mes/ntoab.c (ntoab): Use it to cater for M2-Planet.
* lib/m2/ntoab.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES, (M2_TODO): Likewise.
2020-12-29 15:39:33 +01:00
Jan (janneke) Nieuwenhuizen
f7e772d7e0
build: Resurrect simple.sh.
...
* simple.sh: Do not attempt to build multiple C files with mescc.
Update for new and split C files.
2020-12-29 15:39:19 +01:00
Jan (janneke) Nieuwenhuizen
b4f57f158a
guix: m2-planet: Update to 1.7.0.
...
* guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0.
(native-inputs): Remove gcc-toolchain-7.
[arguments]: Add CC to make-flags. Update sha256sum patch.
2020-12-29 11:28:13 +01:00
Jan (janneke) Nieuwenhuizen
795225ec29
core: Prepare for M2-Planet 1.7.0.
...
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2020-12-29 13:38:38 +01:00
Jan (janneke) Nieuwenhuizen
41c126759e
mescc: Mes C Library: Prepare for M2-Planet 1.7.0.
...
* lib/m2/ntoab.c (ntoab): Declare variables at toplevel.
* lib/mes/abtol.c (abtol): Likewise.
* lib/posix/getenv.c (getenv): Likewise.
* lib/posix/setenv.c (setenv): Likewise.
2020-12-29 13:37:20 +01:00
Jan (janneke) Nieuwenhuizen
74d7d097e4
mescc: Mes C Library: isatty: Use fixed array size for M2-Planet.
...
* lib/m2/isatty.c (struct ktermios)[c_cc]: Hardcode to size 19.
2020-12-29 13:34:24 +01:00
Jan (janneke) Nieuwenhuizen
a87e014ed6
mescc: Mes C Library: Update M2-Planet macros.
...
* lib/m2/x86/x86_defs.M1: Update from M2-Planet 1.7.0.
2020-12-29 13:33:12 +01:00
Jan (janneke) Nieuwenhuizen
40efaa47a3
mes: compatibility: Move (mes pmatch) to (system base pmatch).
...
* mes/module/system/base/pmatch.scm: Move from mes/pmatch.scm. Update
users.
2020-11-01 16:20:12 +01:00
Jan (janneke) Nieuwenhuizen
c30da3435f
mes: compatibility: Make base.mes pure guile.
...
* mes/module/mes/type-0.mes (procedure?): New function. Rewrite
without `cond' from
* mes/module/mes/base.mes (procedure?): here; Remove.
2020-11-01 16:09:27 +01:00
Jan (janneke) Nieuwenhuizen
7a6505be6e
build: Cater for M2-Planet.
...
* configure: Drop MES_SEED, support M2-Planet.
* kaem.run: Also build bin/mes.
* build-aux/bootstrap.sh.in: Run kaem bootstrap.
* build-aux/build.sh.in: Set stage0_cpu. On x86, run kaem bootstrap.
Build bin/mes. Update scripts and users.
* build-aux/install.sh.in: Install all built bin/mes-* flavours.
2020-10-18 23:15:11 +02:00
Jan (janneke) Nieuwenhuizen
d06a13aee4
guix: Update M2-Planet to 1fc2aeab483208bd2ba117b21df3894c182470ec.
...
* guix/git/mes.scm (m2-planet): Update to 1fc2aeab483208bd2ba117b21df3894c182470ec.
(native-inputs): Add gcc-toolchain-7.
* lib/m2/x86/x86_defs.M1: Update from M2-Planet.
2020-10-18 23:29:15 +02:00
Jan (janneke) Nieuwenhuizen
cd0eb07c40
guix: Add m2-planet.
...
* guix/git/mes.scm (m2-planet): New variable.
2020-10-18 23:14:30 +02:00
Jan (janneke) Nieuwenhuizen
8f2bc16e7a
core: Use casting functions.
...
Silence all casting errors by using casting functions.
* src/cc.c (cast_charp_to_scmp, cast_charp_to_scmpp,
cast_voidp_to_charp, cast_scmp_to_long, cast_scmp_to_charp): New function.
* src/m2.c (cast_charp_to_scmp, cast_charp_to_scmpp,
cast_voidp_to_charp, cast_scmp_to_long, cast_scmp_to_charp): New function.
* include/mes/mes.h: Declare them.
(struct scm): Add car_value, cdr_value, function.
(g_continuations): Change to long.
* src/mes.c: Silence all casting errors by using casting functions.
2020-10-18 15:44:49 +02:00
Jan (janneke) Nieuwenhuizen
ca8e9f0342
mescc: Mes C Library: Use casting functions.
...
Silence all casting errors by using casting functions.
* lib/mes/cast.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES): Add it.
* lib/m2/cast.c: New file.
* kaem.run: Add it.
* simple.make: Add them both.
* include/mes/lib.h: Add cast prototypes.
* include/m2/lib.h: Likewise.
* lib/linux/_getcwd.c (_getcwd): Use them.
* lib/linux/access.c (access): Likewise.
* lib/linux/brk.c (brk): Likewise.
* lib/linux/chmod.c (chmod): Likewise.
* lib/linux/clock_gettime.c (clock_gettime): Likewise.
* lib/linux/gettimeofday.c (gettimeofday): Likewise.
* lib/linux/unlink.c (unlink): Likewise.
* lib/mes/fdputc.c (fdputc): Likewise.
* lib/stdio/putchar.c (putchar): Likewise.
* lib/linux/malloc.c (malloc): Likewise.
2020-10-18 14:55:24 +02:00
Jan (janneke) Nieuwenhuizen
3b29abc850
core: Switch to pointer cells.
...
Run
build-aux/pointer.sh
* include/mes/macros.h: Remove.
* src/*.c: Update.
* include/mes/*.h: Update.
* simple.make: Update.
* kaem.run: Update.
2020-10-18 11:34:32 +02:00
Jan (janneke) Nieuwenhuizen
e4a8bdcc8f
build: Update snarfer.
...
* build-aux/mes-snarf.scm (symbol->header): Update for pointer cells.
(snarf-symbols): Likewise.
(snarf-functions): Likewise.
2020-09-27 19:07:00 +02:00
Jan (janneke) Nieuwenhuizen
1cdbadfe98
core: Drop support for number based cells.
...
This removes the POINTER_CELLS define and all its references.
* simple.make (CFLAGS): Remove -D POINTER_CELLS.
* include/mes/mes.h: Remove #define POINTER_CELLS.
* include/mes/cc.h: Remove !POINTER_CELLS branches.
* include/mes/macros.h: Likewise.
* src/gc.c: Likewise.
* src/symbol.c: Likewise.
* src/test/gc.c: Likewise.
2020-09-20 11:32:38 +02:00
Jan (janneke) Nieuwenhuizen
5c9f2edd90
core: gc: Pointer cells: Drop cells->news->cells flipping.
...
* src/gc.c (gc_init): Undo doubling of initial memory.
(gc_init_news)[!GC_NOFLIP]: Remove.
(gc_)[!GC_NOFLIP]: Remove symbol relocation.
(gc)[!GC_NOFLIP]: Remove second gc.
2020-09-20 11:11:08 +02:00
Jan (janneke) Nieuwenhuizen
3f368e29e1
core: gc: Abort upon broken heart failure.
...
* src/gc.c (gc_cellcpy, gc_loop): Abort upon broken heart failure.
2020-09-20 10:58:36 +02:00
Jan (janneke) Nieuwenhuizen
20595cd044
core: gc: Enable memory dump debugging.
...
* src/gc.c (gc): If MES_DUMP is set, dump arena. [POINTER_CELLS &&
!GC_NOFLIP]: Run gc_ twice to enable comparing memory dumps.
2020-09-20 09:35:56 +02:00
Jan (janneke) Nieuwenhuizen
b05558ec00
core: gc: Add gc_dump_arena.
...
* src/gc.c (dumpc, dumps, gc_dump_register, gc_dump_state,
gc_dump_stack, gc_dump_arena): New function.
2020-09-14 14:53:56 +02:00
Jan (janneke) Nieuwenhuizen
3de592d441
core: Pointer cells: Allow smaller memory footprint using cellcpy.
...
* src/gc.c (gc_init)[GC_NOFLIP]: Do not use double sized arena.
(gc_cellcpy): New function.
* src/gc.c (gc_flip): Use it, do not flip.
(gc_init_news)[GC_NOFLIP]: Update.
2020-09-13 18:20:52 +02:00
Jan (janneke) Nieuwenhuizen
543419134f
test/gc: Add three extra gc's.
...
* src/test/gc.c (test_gc): Add three extra gc's.
2020-08-17 20:46:47 +02:00
Jan (janneke) Nieuwenhuizen
0d6971b560
test/gc: struct.
...
* src/test/gc.c (test_struct): New function.
(main): Call it.
2020-08-16 17:20:28 +02:00
Jan (janneke) Nieuwenhuizen
b8a4869c3e
test/gc: vector.
...
* src/test/gc.c (test_vector): New function.
(main): Call it.
(print_arena): New function.
(test_gc): Call it.
2020-08-16 16:24:42 +02:00