Commit Graph

2274 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen bdb9e83978 ARM: Fix unsigned modulo.
* lib/arm-mes/arm.M1 (mov____%esp,%r3): New macro.
* module/mescc/armv4/as.scm (armv4:r0%r1): Use it to avoid overwriting
%r0 before caling __mesabi_uldiv.
2022-09-12 09:50:57 +02:00
Jan (janneke) Nieuwenhuizen f3993ad26f STUK! 2022-09-12 09:50:57 +02:00
Jan (janneke) Nieuwenhuizen b07618819f wip 2022-09-12 09:50:57 +02:00
Jan (janneke) Nieuwenhuizen 89c21c5fe7 wip 2022-09-12 09:50:57 +02:00
Jan (janneke) Nieuwenhuizen 298420cffe wip 2022-09-12 09:50:57 +02:00
Jan (janneke) Nieuwenhuizen d47f02aee2 wip 2022-09-12 09:50:57 +02:00
Jan (janneke) Nieuwenhuizen 1985a85be0 wip 2022-09-12 09:50:57 +02:00
Jan (janneke) Nieuwenhuizen 8a531e0f1d DRAFT test: Add 60-math-modulo.c.
* lib/tests/scaffold/60-math-modulo.c: New test.
* build-aux/check-mescc.sh (mes_tests): Add it.
2022-09-12 09:50:57 +02:00
Jan (janneke) Nieuwenhuizen 163436cff7 still ok => modulo is problematic 2022-09-11 23:04:24 +02:00
Jan (janneke) Nieuwenhuizen bacdf3bf70 remove cruft 2022-09-11 22:41:27 +02:00
Jan (janneke) Nieuwenhuizen f69f6e412e still OK 2022-09-11 22:39:42 +02:00
Jan (janneke) Nieuwenhuizen 4699c1913d HACK core: Revert math.c -- fixes arm-fsb.s 2022-09-11 22:28:07 +02:00
Jan (janneke) Nieuwenhuizen 6db1ec242c Revert "guix: Update package inputs to new style."
This reverts commit 22f24be26a.
2022-06-01 17:40:20 +02:00
Jan (janneke) Nieuwenhuizen 675b90b824 squash! PORTING gcc minus @7 2022-06-01 14:26:55 +02:00
Jan (janneke) Nieuwenhuizen 9d32bfe92b squash! PORTING guile2.2 2022-06-01 14:24:34 +02:00
Jan (janneke) Nieuwenhuizen ffe0e2c1c7 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.
2022-06-01 14:03:09 +02:00
Jan (janneke) Nieuwenhuizen 95b26ccf6a Revert "mescc: Only use signed division when numerator is signed."
This breaks the --with-bootstrap build and the Guix bootstrap on ARM.

This reverts commit 348dcbcbd7.
2022-05-30 06:46:32 +02:00
Jan (janneke) Nieuwenhuizen 11ef9fa229 WIP ARM: Use mes-style crt1.M1. 2022-05-21 16:09:28 +02:00
Jan (janneke) Nieuwenhuizen 8be532e09c core: Move M2_PTR_SIZE, M2_CELL_SIZE to include file.
* lib/posix/getenv.c (M2_PTR_SIZE),
lib/posix/setenv.c (M2_PTR_SIZE): Move definition...
* include/mes/lib-mini.h (M2_PTR_SIZE): ...here.
* src/gc.c (M2_CELL_SIZE),
src/symbol.c (M2_CELL_SIZE),
src/test/gc.c (M2_CELL_SIZE),
src/vector.c (M2_CELL_SIZE): Move definition...
* include/mes/mes.h (M2_CELL_SIZE): ...here.
2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen 391210574e scaffold: Remove obsolete malloc.
* scaffold/lib/stdlib/malloc.c: Remove.
2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen a4dd86eaa9 wait4: include mes/lib.h for cast 2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen 03a374750c time.c: include sys/time for gettimeofday 2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen eb59ffa1a9 linux/read.c remove extra mes.h include. 2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen 798fe13c16 lib: linux: Add wait4.
* lib/linux/waitpid.c (waitpid): Factor-out wait4 call to...
* lib/linux/wait4.c: ...new file here.
* include/sys/wait.h (wait4): Add prototype.  Include sys/resource.h.
* include/sys/resource.h (struct rusage): Remove gratuitous "int" for
M2-Planet.
* build-aux/configure-lib.sh (libc_SOURCES): Add it.
* kaem.run,
simple.make (M2_SOURCES),
simple.sh: Likewise.  Also add resource.h.
2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen c0820603e8 lib: linux/time: Remove SYS_time specialization.
* lib/linux/time.c (time)[SYS_time]: Remove specialization.
[!SYS_time && !SYS_gettimeofday]: Remove fallback.
2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen 9ab69b6820 kaem: Add kaem.arm and kaem.x86.
* kaem.arm,
kaem.x86: New files.
2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen b693b8f7ca squash! lib: ntoab: M2-Planet Compile fix.
This is a follow-up to commit
    67120c3a21f58308b08b1ddc00ca11a335116577
    DRAFT kaem.run: Remove --bootstrap-mode.

* lib/mes/ntoab.c: Use defined in #if.
2022-05-21 16:09:10 +02:00
Jan (janneke) Nieuwenhuizen 3b29c700b4 DRAFT kaem.run: Remove --bootstrap-mode.
* include/linux/arm/syscall.h,
include/linux/x86/syscall.h,
include/mes/constants.h: Remove CONSTANTs.
* lib/m2/open.c: Move to...
* lib/linux/open.c: ...here.  Update to make gcc-compatible.
* scaffold/argv.kaem: Update accordingly.
* lib/linux/lseek.c (lseek): Suport M2-Planet.
* lib/linux/waitpid.c (waitpid): Suport M2-Planet.
* lib/m2/getcwd.c (PATH_MAX): Remove CONSTANT.
* lib/m2/isatty.c (TCGETS): Remove CONSTANT.
* lib/mes/ntoab.c: Support M2-Planet.
* lib/posix/getcwd.c (__getcwd_buf): Remove.
* lib/posix/getenv.c (M2_PTR_SIZE)[__M2__]: Update to #define.
* lib/posix/setenv.c: Likewise.
* lib/stub/__raise.c (SIGABRT): Remove CONSTANT.
* src/core.c (error): Use __M2__ instead of __M2_PLANET__.
* src/gc.c (M2_CELL_SIZE)[__M2__]: Update to #define.  Support
non-bootstrap-mode.
* src/posix.c: Likewise.
* src/symbol.c: Likewise.
* src/vector.c: Likewise.
* kaem.run: Remove --botstrap-mode.  Update source list accordingly.
* simple.make (M2_PLANET_FLAGS): Remove --bootstrap-mode.
* simple.make (M2_SOURCES, M2_PLANET_INCLUDES): Update source list
accordingly.
2022-05-21 16:09:09 +02:00
Jan (janneke) Nieuwenhuizen fe3dcc66d4 lib: posix/open: Support M2-Planet.
* lib/posix/open.c (open)[__M2__]: New function.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen b6d33fd3b2 lib: linux/_open3: Support M2-Planet.
* lib/linux/_open3.c (_open3): Use function casting.  Also call
__ungetc_init.
* lib/stub/__buffered_read.c: New file.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen 9232eaf7bc kaem: read: Remove --bootstrap-mode.
* include/mes/lib.h[__M2__](__call_at_exit,abtod,dtoab,ultoa,
* include/sys/types.h[__M2__]: Fall back to unsigned instead of using
unsigned long.
* include/stdio.h[__M2__](fprintf, fscanf, printf, snprintf, sprintf,
sscanf): Hide prototypes.
* lib/stdlib/exit.c (exit)[__M2__]: Hide call to __call_at_exit.
* lib/linux/read.c (read)[__M2__]: Hide debugging.
* lib/linux/malloc.c (malloc)[__M2__]: Hide alignment.
__mesabi_umod, __mesabi_udiv, __mesabi_uldiv): Hide prototypes.
* scaffold/argv.kaem: Use them together with lib/mes/lib-mini.h instead of
lib/mes/* specializations.  Remove --bootstrap-mode from M2-Planet call.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen ccd1f64a53 kaem: argv: Remove --bootstrap-mode.
* scaffold/argv.kaem: Use lib/mes/lib-mini.h instead of lib/m2/lib.h.
Remove --bootstrap-mode from M2-Planet call.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen 11e291200c kaem: hello: Remove --bootstrap-mode.
* include/mes/lib-mini.h: Remove M2 bootstrap constants.
[__M2__](size_t): Fall-back to unsigned instead of unsigned long.
* scaffold/hello.kaem: Use it instead of lib/m2/lib.h.  Remove
--bootstrap-mode from M2-Planet call.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen 3112b851b0 kaem: main: Remove --bootstrap-mode.
* scaffold/main.kaem: Remove --bootstrap-mode from M2-Planet call.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen 13a619b713 simple.sh: Resurrect.
* simple.sh: Add src/globals.c, lib/stub/__raise.c.  Use
lib/linux/malloc.c instead of lib/stdlib/malloc.c.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen 022a6b9936 simple.make: Resurrect.
* simple.make (M2_PLANET_FLAGS): Add --bootstrap-mode.
(M2_SOURCES): Use lib/mes/mini-write.c instead of lib/mes/write.c
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen 607a918686 lib: linux/read: Fix compile warnings.
* lib/linux/read.c (read): Cast filedes, buffer to long.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen ded879f087 kaem: Fix version.
* src/symbol.c (MES_VERSION): Update to 0.24.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen 947898bd70 lib: mes/write: Rename from mes/mini-write.c
* lib/mes/mini-write.c: Move to...
* lib/mes/write.c: ...here.
* build-aux/configure-lib.sh,
kaem.run,
scaffold/argv.kaem,
scaffold/global-array.kaem,
scaffold/hello.kaem,
scaffold/local-array.kaem,
scaffold/local-static-array.kaem,
scaffold/read.kaem,
simple.make,
simple.sh: Update accordingly.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen 5a22ea4845 build: Cater for colliding basename in C sources.
This is a follow-up to commit
    f785f8d560
    build: Fix --with-bootstrap build.

* build-aux/cc.sh: Retain directory name in object file name.
* build-aux/bootstrap.sh.in: Likewise.  Compile crt1.c from local
directory.
* build-aux/build-lib.sh: Likewise.
* build-aux/build.sh.in: Remove globals.o hack.
2022-05-21 16:08:27 +02:00
Jan (janneke) Nieuwenhuizen d6f09c560a guix: m2-planet: Update to 1.10.0.
* guix/git/mes.scm (m2-planet): Update to 1.10.0.
2022-05-21 14:18:39 +02:00
Gabriel Wicki b14d08251f core: Simplify math expressions.
* src/gc.c (gc_up_arena): Use division instead of shift.
(gc_flip): Simplify (free-news) * 1.5.
2022-05-21 14:18:38 +02:00
Jan (janneke) Nieuwenhuizen aa7f82a495 build: Also use stage0_cpu detection in bootstrap.sh build.
* build-aux/build-scaffold.sh: Include cflags.sh.
(stage0_cpu): Move to...
* build-aux/cflags.sh (stage0_cpu): ...here.
* build-aux/build.sh.in (stage0_cpu): Remove.
2022-05-21 14:18:10 +02:00
Jan (janneke) Nieuwenhuizen aa5f1533e1
build: Fix configure crashing when no compiler is present.
Reported by Andrius Štikonas <andrius@stikonas.eu> via IRC.

* configure (main): Cater for missing cc, actually set m2-planet when
found.
2022-05-14 21:09:06 +02:00
Gabriel Wicki 7b993b35b9
core: Remove code duplication.
* src/gc.c (copy_news): Remove copy of copy_cell.
(gc_copy): Use copy_cell instead.
2022-05-13 08:27:57 +02:00
Gabriel Wicki c7777121e8
core: Remove code duplication.
* src/gc.c (news_bytes): Remove copy of cell_bytes.
(gc_copy): Use cell_bytes instead.
* include/mes/mes.h (news_bytes): Remove prototype.
2022-05-13 08:27:56 +02:00
Jan (janneke) Nieuwenhuizen 810451c76b
build: Add publish-local.
* build-aux/GNUmakefile.in (publish-local): New target.
2022-05-13 08:27:56 +02:00
Jan (janneke) Nieuwenhuizen 6301625cf6
doc: Update `README'.
* README: Update to mention Further Reduced Binary Seed bootstrap.
2022-05-13 08:27:50 +02:00
Dor Askayo ce54ccc2c0
Fix definition of S_ISUID.
* include/sys/stat.h (S_ISUID: Append missing zero.
2022-05-09 07:01:01 +02:00
Jan (janneke) Nieuwenhuizen f785f8d560
build: Fix --with-bootstrap build.
Reported by Vagrant Cascadian <vagrant@debian.org>.

* build-aux/build.sh.in: Before building mes using mescc, in bootstrap
mode, remove globals.o built for lib.
2022-05-06 12:27:46 +02:00