Jan Nieuwenhuizen [Wed, 14 Nov 2018 07:16:58 +0000 (08:16 +0100)]
core: struct_set_: Oops typo.
* src/struct.c (struct_set_x_): Oops, remove indirection.
Jan Nieuwenhuizen [Wed, 14 Nov 2018 07:19:01 +0000 (08:19 +0100)]
mes: Remove copy of make-string.
* mes/module/mes/guile.mes (make-string): Remove copy.
Jan Nieuwenhuizen [Wed, 14 Nov 2018 12:07:59 +0000 (13:07 +0100)]
mescc: Compile fixes.
* include/libmes-mini.h[WITH_GLIBC]: Do not declare strlen, write, types.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 13:47:14 +0000 (14:47 +0100)]
mes: Oops, %moduledir debug info.
* mes/module/mes/boot-0.scm.in: Oops, %moduledir debug info.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:38:02 +0000 (10:38 +0100)]
build: configure: Support Mes.
* configure: Support Mes.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 15:57:58 +0000 (16:57 +0100)]
mes; Add read-line.
* mes/module/mes/guile.mes (read-line): New function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:15:12 +0000 (10:15 +0100)]
mes: dirname: Fix for absolute file names.
* mes/module/mes/guile.mes (dirname): Fix absolute files.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:14:50 +0000 (10:14 +0100)]
mes: Add file-exists?.
* mes/module/mes/guile.mes (file-exists?): New function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:14:10 +0000 (10:14 +0100)]
mes: Add with-error-to-file.
* mes/module/mes/guile.mes (with-error-to-file): New function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:00:04 +0000 (10:00 +0100)]
mes: Add string-downcase, string-upcase, string-tokenize.
* mes/module/srfi/srfi-13.mes (string-downcase, string-upcase,
string-tokenize): New function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:10:43 +0000 (10:10 +0100)]
mes: Add char-downcase, char-upcase.
* mes/module/srfi/srfi-14.mes (char-downcase, char-upcase): New
function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:09:41 +0000 (10:09 +0100)]
mes: Add char-set:digit, char-set:lower-case, char-set:upper-case.
* mes/module/srfi/srfi-14.mes (char-set:digit, char-set:lower-case,
char-set:upper-case): New variable.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:08:03 +0000 (10:08 +0100)]
mes: Add char-set-adjoin, char-set-complement.
* mes/module/srfi/srfi-14.mes (char-set-adjoin, char-set-complement):
New function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:00:50 +0000 (10:00 +0100)]
mes: system*: Support redirection.
* mes/module/mes/posix.mes (system*): Support redirection.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:17:50 +0000 (10:17 +0100)]
core: read_string: Allow for gc.
* src/posix.c (read_char): Add optional port parameter.
(read_string): Allow for gc.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 10:03:03 +0000 (11:03 +0100)]
core: Add delete_file.
* src/posix.c (delete_file): New function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:18:50 +0000 (10:18 +0100)]
core: Add dup, dup2.
* src/posix.c (dup_, dup2_): New function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:16:19 +0000 (10:16 +0100)]
core: Add getcwd.
* src/posix.c (getcwd_): New function.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:04:03 +0000 (10:04 +0100)]
core: Support redirection of stderr.
* include/libmes-mini.h (g_stderr): New global.
* lib/mes/eputc.c (eputc): Use it.
* lib/mes/eputs.c (eputs): Likewise.
* lib/mes/oputc.c (oputc): Likewise.
* lib/mes/oputs.c (oputs): Likewise.
* src/lib.c (display_error_, write_error_): Likewise.
* src/posix.c (write_byte): Likewise.
* src/mes.c (mes_builtins): Likewise.
(main): Iniitalize g_stderr.
* src/posix.c (current_error_port, set_current_error_port): New
function.
* mes/module/mes/boot-0.scm.in (current-output-port,
current-error-port): Remove.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:01:49 +0000 (10:01 +0100)]
core: Assert g_free in alloc.
* src/mes.c (alloc): Assert g_free.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 10:00:42 +0000 (11:00 +0100)]
mescc: unlink: Move to libc.
* lib/linux/libc.c (unlink): New function.
* lib/linux/tcc.c (unlink): Remove.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:13:01 +0000 (10:13 +0100)]
mescc: dup, dup2: Move to libc.
* lib/linux/libc.c (dup, dup2): New function.
* lib/linux/gnu.c (dup, dup2): Remove.
Jan Nieuwenhuizen [Sun, 11 Nov 2018 09:12:19 +0000 (10:12 +0100)]
mescc: getcwd: Move to libc.
* lib/linux/libc.c (getcwd): New function.
* lib/linux/tcc.c (getcwd): Remove.
Jan Nieuwenhuizen [Sat, 10 Nov 2018 07:32:42 +0000 (08:32 +0100)]
mescc: Support GNU make with POSIX.
* include/linux/x86/syscall.h (SYS_sigprocmask): New macro.
* include/linux/x86_64/syscall.h (SYS_rt_sigprocmask): New macro.
* include/signal.h (SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK): New macro.
(sigprocmask): Declare.
* lib/linux/gnu.c (sigprocmask): New function.
Jan Nieuwenhuizen [Fri, 9 Nov 2018 20:26:10 +0000 (21:26 +0100)]
mescc: Support GNU Bash.
* include/errno.h (EACCES, ENOSPC, ESPIPE): New macro.
* include/linux/x86/syscall.h (SYS_setuid, SYS_geteuid, SYS_getegid,
SYS_setgid): New macro.
* include/linux/x86_64/syscall.h: Likewise.
* include/stdint.h (LLONG_MIN, LLONG_MAX, SIZE_MAX): New macro.
* include/sys/stat.h (S_ISUID, S_ISGID, S_IXGRP, S_IXOTH, S_IRGRP,
S_IROTH, S_IWGRP, S_IWOTH, S_IRWXG, S_IRWXO): New macro.
* include/termio.h: New file.
* include/unistd.h (_POSIX_VERSION): New macro.
* lib/linux/gnu.c (geteuid, getegid, setuid, setgid): New function.
* lib/string/memchr.c: New file.
* lib/stub/getpwuid.c: New file.
* lib/stub/rand.c: New file.
* lib/stub/ttyname.c: New file.
* include/string.h (memchr): Declare.
* include/unistd.h (geteuid, getegid, setuid, setgid): Declare.
Jan Nieuwenhuizen [Tue, 6 Nov 2018 19:29:35 +0000 (20:29 +0100)]
build: Simplify: cater for one compiler at a time.
* build-aux/build-cc.sh: Remove.
* build-aux/build-cc32.sh: Remove.
* build-aux/build-cc64.sh: Remove.
* build-aux/build-x86_64-mes.sh: Remove.
* build-aux/cc-mes.sh: Remove.
* build-aux/cc-x86_64-mes.sh: Remove.
* build-aux/cc32-mes.sh: Remove.
* build-aux/cc64-mes.sh: Remove.
* build-aux/test64.sh: Remove.
* build-aux/bootstrap-mes.sh: New file.
* build-aux/config.make.in: New file.
* build-aux/config.status.in: New file.
* build-aux/test-cc.sh: New file.
* .gitignore: Update.
* build-aux/GNUmakefile.in: Update.
* build-aux/build-guile.sh: Update.
* build-aux/build-mes.sh: Update.
* build-aux/build.sh.in: Update.
* build-aux/cc.sh: Update.
* build-aux/check-boot.sh: Update.
* build-aux/check-mes.sh: Update.
* build-aux/check-mescc.sh: Update.
* build-aux/check-tcc.sh: Update.
* build-aux/check.sh.in: Update.
* build-aux/config.sh: Update.
* build-aux/export.make: Update.
* build-aux/install.sh.in: Update.
* build-aux/pre-inst-env.in: Update.
* build-aux/test.sh: Update.
* build-aux/uninstall.sh.in: Update.
* configure: Update.
* configure.sh: Update.
* module/mescc/i386/as.scm: Update.
* module/mescc/preprocess.scm: Update.
* module/mescc/x86_64/as.scm: Update.
* scripts/mescc.in: Update.
* tests/psyntax.test: Update.
Jan Nieuwenhuizen [Fri, 9 Nov 2018 15:56:54 +0000 (16:56 +0100)]
mescc: Add missing define.
* lib/x86-mes/x86.M1: Add missing define.
Jan Nieuwenhuizen [Thu, 8 Nov 2018 13:46:46 +0000 (14:46 +0100)]
mescc: Exit if library cannot be found.
* module/mescc/mescc.scm (arch-find): Exit upon failure.
Jan Nieuwenhuizen [Thu, 8 Nov 2018 13:07:27 +0000 (14:07 +0100)]
mescc: Accept -O, --std, -x.
* scripts/mescc.in (parse-opts): Accept -O, --std, -x.
Jan Nieuwenhuizen [Thu, 8 Nov 2018 21:41:20 +0000 (22:41 +0100)]
mescc: Support -dumpmachine.
* scripts/mescc.in (parse-opts): Support -dumpmachine.
Jan Nieuwenhuizen [Mon, 22 Oct 2018 16:33:40 +0000 (18:33 +0200)]
mescc: vsnprintf: Compliant implementation.
* lib/stdio/vsnprintf.c (vsnprintf): New, complient implementation,
replacing vsnprint.
* lib/stdio/vsprintf.c (vsnprint): Forward to vsnprint.
* lib/stdio/snprintf.c (snprintf): Likewise.
* scaffold/tests/9a-snprintf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
Jan Nieuwenhuizen [Sun, 21 Oct 2018 10:04:25 +0000 (12:04 +0200)]
test: Add performance test.
* module/mes/test.scm (pass-if-timeout): New macro.
* tests/perform.test: New test.
* build-aux/check-mes.sh (tests): Run it.
Jan Nieuwenhuizen [Sun, 21 Oct 2018 10:07:06 +0000 (12:07 +0200)]
mes: Add ceil, floor, round, inexact->exact.
* mes/module/mes/scm.mes (ceil, floor, round, inexact->exact,
exact->inexact): New function.
Jan Nieuwenhuizen [Sun, 21 Oct 2018 10:00:00 +0000 (12:00 +0200)]
mes: read-string: Take optional port argument.
* src/posix.c (read_string): Take optional port argument.
* mes/module/mes/guile.mes (read-string): Remove.
Jan Nieuwenhuizen [Sun, 21 Oct 2018 06:50:45 +0000 (08:50 +0200)]
core: eval_apply: Order gotos according to frequency.
* src/mes.c (eval_apply): Order gotos according to frequency.
Jan Nieuwenhuizen [Sun, 21 Oct 2018 06:43:35 +0000 (08:43 +0200)]
Revert "core: eval_apply profile."
This reverts commit
d61e6be0b18459a8e3c262eab448b428dc81937a.
Jan Nieuwenhuizen [Sun, 21 Oct 2018 06:25:07 +0000 (08:25 +0200)]
core: eval_apply profile.
* src/mes.c: Poor man's eval_apply profile.
Jan Nieuwenhuizen [Sat, 20 Oct 2018 18:01:45 +0000 (20:01 +0200)]
core: Fix displaying of closure.
* src/lib.c (display_helper): Fix displaying of closure.
Jan Nieuwenhuizen [Sat, 20 Oct 2018 16:24:37 +0000 (18:24 +0200)]
mes: Print backtrace upon exception.
* mes/module/mes/catch.mes (display-backtrace,
frame-function): New function.
(%eh): Use them.
Jan Nieuwenhuizen [Sat, 20 Oct 2018 16:27:13 +0000 (18:27 +0200)]
core: Set procedure in stack frame.
* src/mes.c (eval_apply): Set procedure in stack frame.
Jan Nieuwenhuizen [Sat, 20 Oct 2018 16:23:20 +0000 (18:23 +0200)]
core: Implement stack and frame.
* src/lib.c (frame_printer make_frame_type, make_frame,
make_stack_type, make_stack, stack_length, stack_ref): New function.
Jan Nieuwenhuizen [Sat, 20 Oct 2018 12:18:04 +0000 (14:18 +0200)]
core: Support time functions.
* lib/linux/clock_gettime.c: New file, move from gnu.c.
* lib/linux/gettimeofday.c: New file, move from tcc.c.
* lib/linux/time.c: New file, move from tcc.c.
* lib/linux/libc.c: Include them.
* lib/linux/gnu.c (clock_gettime): Remove.
* lib/linux/tcc.c (time, gettimeofday): Remove.
* include/time.h (CLOCK_PROCESS_CPUTIME_ID): New define.
* src/posix.c (init_time, current_time, gettimeofday_,
seconds_and_nanoseconds_to_long, get_internal_run_time): New function.
* src/mes.c (scm_symbol_internal_time_units_per_second): New symbol.
(main): Call init_time.
Jan Nieuwenhuizen [Thu, 18 Oct 2018 16:50:09 +0000 (18:50 +0200)]
core: Use hash table for symbols.
* src/mes.c (mes_symbols): Use hash table for symbols. Update users.
Jan Nieuwenhuizen [Fri, 19 Oct 2018 21:01:59 +0000 (23:01 +0200)]
core: Use assert before failure exit.
* src/mes.c (error): Use assert before failure exit. Helps debugging.
Jan Nieuwenhuizen [Thu, 18 Oct 2018 05:55:28 +0000 (07:55 +0200)]
core: Add hashq_get_handle, hash, hash_ref, hash_set_x.
* src/mes.c (scm_symbol_hashq_table, scm_symbol_record_type,
scm_symbol_module, scm_symbol_buckets, scm_symbol_size): New symbols.
Update users.
* src/hash.c (hash_list_of_char): Rename from hashq_. Respect size,
update callers.
(hashq_, hash_ hash, hashq_get_handle, hash_ref, hash_set_x_,
hash_set_x): New function.
(hashq_ref): Do not return handle. Update callers.
Jan Nieuwenhuizen [Thu, 18 Oct 2018 18:06:10 +0000 (20:06 +0200)]
mes: Move pair? to core.
* src/lib.c (pair_p): New function. Gains 8% performance on MesCC.
Jan Nieuwenhuizen [Fri, 19 Oct 2018 20:38:19 +0000 (22:38 +0200)]
mes: Move assoc to core.
* mes/mes.c (assoc_string, assoc): New function.
* mes/module/mes/scm.mes (assoc): Remove. Gains 12% performance for
MesCC.
Jan Nieuwenhuizen [Sat, 20 Oct 2018 08:58:56 +0000 (10:58 +0200)]
Revert "core: Add gc-debug for stack array."
This reverts commit
f35084d1dbea889d107824e7596da1701c6b90ad.
Jan Nieuwenhuizen [Fri, 19 Oct 2018 19:23:17 +0000 (21:23 +0200)]
core: Add gc-debug for stack array.
* src/gc.c (gc_debug): New function.
Jan Nieuwenhuizen [Fri, 19 Oct 2018 18:20:00 +0000 (20:20 +0200)]
scaffold: Resurrect mini-mes.
* src/mini-mes.c: Resurrect.
Jan Nieuwenhuizen [Thu, 14 Dec 2017 06:05:53 +0000 (07:05 +0100)]
core: Use array-based stack.
* src/mes.c (STACK_SIZE)[MES_ARRAY_STACK]: New variable.
(g_stack_array): New variable.
(g_stack): Change type to SCM*.
(gc_push_frame)[MES_ARRAY_STACK]: Use g_stack_array, g_stack.
(gc_peek_frame): Likewise.
(gc_pop_frame): Likewise.
* src/gc.c (gc_check): Likewise.
(gc): Likewise.
Jan Nieuwenhuizen [Wed, 17 Oct 2018 07:47:20 +0000 (09:47 +0200)]
mes: Resurrect Guile-1.8 support.
* module/mes/mes-0.scm: Resurrect Guile-1.8 support.
Jan Nieuwenhuizen [Tue, 16 Oct 2018 15:13:04 +0000 (17:13 +0200)]
core: expand_variable: Remove weird exceptions: begin, if.
* src/mes.c (expand_variable_): Remove weird exceptions: begin, if.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 18:42:10 +0000 (20:42 +0200)]
mes: Switch to srfi-9 based on structs.
* mes/module/srfi/srfi-9.mes: Swap symlink to srfi-9-struct.mes.
* mes/module/srfi/srfi-9/gnu.mes: Swap symlink to gnu-struct.mes.
* src/module.c (make_module_type): Update to match srfi-9-struct
records. Update users.
* src/hash.c (make_hashq_type): Likewise.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 14:57:00 +0000 (16:57 +0200)]
mes: srfi-9: Add implementation based on struct.
* mes/module/srfi/srfi-9-struct.mes: New file.
* mes/module/srfi/srfi-9-vector.mes: Rename from srfi-9.mes
* mes/module/srfi/srfi-9.mes: Symlink to srfi-9-vector.mes.
* mes/module/srfi/srfi-9/gnu-struct.mes: Add srfi-9-struct
implementation.
* mes/module/srfi/srfi-9/gnu-vector.mes: Rename from gnu.mes.
* mes/module/srfi/srfi-9/gnu.mes: Symlink to gnu-vector.mes.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 13:45:41 +0000 (15:45 +0200)]
core: hashq-table: Refactor to be a record-like struct.
* src/hash.c (hash_table_printer): New function.
(make_hashq_type): New function.
* src/module.c (module_printer): Use it.
(make_module_type): New function.
(make_initial_module): Use them.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 13:44:47 +0000 (15:44 +0200)]
mescc: Mes C Library: oputs: New function.
* lib/mes/oputc.c: New file.
* lib/libmes.c: Include it.
* include/libmes.h: Declare it.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 12:13:51 +0000 (14:13 +0200)]
core: Use hashq-table for macros.
* src/mes.c (lookup_macro_): Remove.
(macro_ref, get_macro, macro_set_x): New function. Update callers.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 11:36:19 +0000 (13:36 +0200)]
core: Add hashq-table type.
src/hash.c: New file.
src/module.c (char_hash, module_hash): Remove.
* src/module.c (make_initial_module): Use hash primitives.
(module_define_x): Likewise.
(module_variable): Likewise.
* build-aux/snarf.sh: Snarf it.
* src/mes.c: Include it.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 08:44:47 +0000 (10:44 +0200)]
core: Add boot-module.
* src/mes.c (scm_symbol_boot_module): New symbol.
(eval_apply): Handle it.
(mes_symbols): Initialize it.
Jan Nieuwenhuizen [Sun, 14 Oct 2018 07:10:30 +0000 (09:10 +0200)]
core: Add module-define!
* src/module.c (module_define_x, module_printer): New function.
(make_initial_module): Use them.
* tests/srfi-0.test: Test it.
* src/mes.c (display_m0): Remove. Update callers.
* mes/module/mes/fluids.mes (make-fluid): Rewrite.
* tests/macro.test: Test it.
* mes/module/mes/boot-0.scm.in (module-define!): Remove.
* mes/module/mes/boot-02.scm: Likewise.
* module/mes/misc.scm (pk, warn): New function.
* build-aux/check-mes.sh (tests): Run tests.
Jan Nieuwenhuizen [Sun, 14 Oct 2018 06:30:18 +0000 (08:30 +0200)]
core: Add module indirection for variable lookup.
* src/module.c (module_ref, module_variable): New function.
* src/mes.c: Thoughout: Use them.
(assq_ref_env): Remove.
* mes/module/mes/boot-0.scm.in (defined?): Use module-variable.
* mes/module/mes/boot-00.scm (defined?): Likewise.
* mes/module/mes/boot-01.scm (defined?): Likewise.
* mes/module/mes/boot-02.scm (defined?): Likewise.
* scaffold/boot/53-closure-display.scm: Likewise.
Jan Nieuwenhuizen [Sun, 14 Oct 2018 06:15:22 +0000 (08:15 +0200)]
core: Add module type.
* src/module.c: New file.
* build-aux/snarf.sh: Snarf it.
* src/mes.c: Include it.
Jan Nieuwenhuizen [Sun, 14 Oct 2018 05:38:51 +0000 (07:38 +0200)]
core: Add cstring_to_symbol.
* src/mes.c (make_symbol): Rename from lookup_symbol_. Update
callers.
(cstring_to_symbol): New function.
* src/reader.c (reader_read_identifier_or_number): Use it.
Jan Nieuwenhuizen [Sat, 13 Oct 2018 15:34:27 +0000 (17:34 +0200)]
core: Add struct type.
* src/struct.c: New file.
* build-aux/snarf.sh: Snarf it.
* src/mes.c: Include it.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 11:48:50 +0000 (13:48 +0200)]
build: factor-out snarfing.
* build-aux/snarf.sh: New file.
* build-aux/build-cc.sh: Use it.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-cc64.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-x86_64-mes.sh: Likewise.
* build-aux/snarf.sh: Likewise.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 10:28:02 +0000 (12:28 +0200)]
core: core:cdr: Support port type.
* src/mes.c (cdr_): Support port type.
* mes/module/mes/display.mes (display): Add space between fields.
Jan Nieuwenhuizen [Mon, 15 Oct 2018 08:39:02 +0000 (10:39 +0200)]
mes: with-fluids: Fix reset.
* mes/module/mes/fluids.mes (with-fluids): Fix reset.
* tests/fluids.test (report): Remove Mes failure expectation.
Jan Nieuwenhuizen [Fri, 19 Oct 2018 21:31:30 +0000 (23:31 +0200)]
mescc: Recognize U integer suffix.
* module/mescc/compile.scm (cstring->int): Recognize U integer
suffix. Thanks, Peter de Wachter!
Peter De Wachter [Tue, 16 Oct 2018 18:40:41 +0000 (20:40 +0200)]
mescc: Add INTn_MIN/MAX defines to stdint.h.
* include/stdint.h: Add INTn_MIN/MAX defines. Move integere size
defines from limits.h
* include/limits.h: Include it.
Peter De Wachter [Tue, 16 Oct 2018 18:40:40 +0000 (20:40 +0200)]
mescc: Allow superfluous parentheses in function declarations.
E.g.: int (f)();
This is obscure but valid C. It occurs in the csmith headers (thanks
to macro shenanigans).
* module/mescc/compile.scm (fctn-defn:get-name,
fctn-defn:get-statement): Allow superfluous parentheses in function declarations.
Peter De Wachter [Tue, 16 Oct 2018 18:40:38 +0000 (20:40 +0200)]
mescc: Implement unary plus operator.
* module/mescc/compile.scm (ast->type, expr->register,
try-expr->number):): Implement unary plus operator.
Peter De Wachter [Tue, 16 Oct 2018 18:40:37 +0000 (20:40 +0200)]
mescc: Add missing assembly defines.
* lib/x86-mes/x86.M1: Add missing assembly defines.
* lib/x86_64-mes/x86_64.M1: Likewise.
Peter De Wachter [Tue, 16 Oct 2018 18:40:36 +0000 (20:40 +0200)]
mescc: Delete duplicate assembly defines.
* lib/x86-mes/x86.M1: Delete duplicate assembly defines.
* lib/x86_64-mes/x86_64.M1: Likewise.
Peter De Wachter [Tue, 16 Oct 2018 18:40:35 +0000 (20:40 +0200)]
mescc: Exit with non-zero exit code when subprocess fails.
system* returns the result of waitpid. So, suppose that a subprocess
fails with exit code 1. Then the waitpid return value will be 256.
And exit(256) is equivalent to exit(0).
Modified-by: Jan Nieuwenhuizen <janneke@gnu.org>
* mes/module/mes/posix.mes (status:exit-val): New function.
* module/mescc/mescc.scm (assert-system*): Use it.
Jan Nieuwenhuizen [Fri, 12 Oct 2018 07:37:10 +0000 (09:37 +0200)]
mescc: Oops typo.
* module/mescc/M1.scm (hex2:immediate8): Typo.
Jan Nieuwenhuizen [Thu, 13 Dec 2018 17:19:19 +0000 (18:19 +0100)]
core: Support \xNN in reader. Fixes tcc-boot running on Mes.
* src/reader.c (reader_read_string): Support \xNN. Fixes Guix
bootstrap chain; i.e., compilation of gcc-2.95.3 using tcc-boot.
* tests/base.test ("reader: \\x08"): Test it.
* scaffold/tests/17-compare-char.c: Likewise, for mescc.
* build-aux/check-mescc.sh (tests): Run it.
Jan Nieuwenhuizen [Sun, 18 Nov 2018 13:30:47 +0000 (14:30 +0100)]
build: configure: Make dot optional.
* configure: Make dot optional.
Jan Nieuwenhuizen [Thu, 11 Oct 2018 19:14:14 +0000 (21:14 +0200)]
build: Oops, remove stray lib/linux/x86_64-mes/crt1.
* lib/linux/x86_64-mes/crt1: Remove.
Jan Nieuwenhuizen [Tue, 9 Oct 2018 17:22:51 +0000 (19:22 +0200)]
build: x86_64 bootstrap build fixes and workaround.
* configure: Substitute @arch@ (WAS: ARCH). Update users.
* configure.sh: Substitute @arch@.
* build-aux/build-mes.sh: Use $GUILE for x86_64 build.
* build-aux/install.sh.in: Install mes.S, mes.x86_64-mes-S too.
Prune *.E, *.out.
Jan Nieuwenhuizen [Sun, 7 Oct 2018 15:19:04 +0000 (17:19 +0200)]
doc: Release update.
Jan Nieuwenhuizen [Mon, 8 Oct 2018 05:53:09 +0000 (07:53 +0200)]
mescc: Oops, delete wrong line of assembly.
* lib/x86-mes/x86.M1 (movzbl_%bx,%ebx): Delete wrong line. Thanks, pdewacht!
Jan Nieuwenhuizen [Sun, 7 Oct 2018 13:29:42 +0000 (15:29 +0200)]
admin: Release update.
* doc/announce/ANNOUNCE-0.18: New file.
* guix/git/mes.scm (mes): Update hash.
Jan Nieuwenhuizen [Thu, 4 Oct 2018 21:15:25 +0000 (23:15 +0200)]
Release 0.18.
* configure (VERSION): Update to 0.18.
(main): Likewise.
* configure.sh (VERSION): Likewise.
* guix/git/mes.scm (mes, mes.git): Likewise.
* guix/mescc-tools-boot.patch: New file.
Jan Nieuwenhuizen [Wed, 5 Sep 2018 05:05:08 +0000 (07:05 +0200)]
doc: Release update.
* BOOTSTRAP: Update.
* HACKING: Update.
* NEWS: Update.
* README: Update.
* doc/mes.texi (Submitting Patches): Fix misquoting, misattribution.
Jan Nieuwenhuizen [Sun, 7 Oct 2018 13:15:45 +0000 (15:15 +0200)]
mescc: Another attempt at divide.
* module/mescc/i386/as.scm (i386:r0/r1): Never be signed. Use div for unsigned.
(i386:r0%r1): Likewise.
* module/mescc/x86_64/as.scm (x86_64:r0/r1): Likewise.
(x86_64:r0%r1): Likewise.
* lib/x86-mes/x86.M1: Add div.
* lib/x86_64-mes/x86_64.M1: Likewise.
Jan Nieuwenhuizen [Sun, 7 Oct 2018 12:14:50 +0000 (14:14 +0200)]
tests: Expect srfi-13 failure, MesCC more resembles Gcc.
* tests/srfi-13.test (report): Expect INT-MIN failure for x86.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 22:58:31 +0000 (00:58 +0200)]
core: reader: Support 64 bit.
* src/reader.c (reader_read_identifier_or_number): Support 64 bit.
(reader_read_binary): Likewise.
(reader_read_octal): Likewise.
(reader_read_hex): Likewise.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 20:38:28 +0000 (22:38 +0200)]
mescc: Mes C Library: Fix execve on x86_64.
* include/linux/x86_64/syscall.h (SYS_execve): Typo. Fixes execve on
x86_64.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 20:26:07 +0000 (22:26 +0200)]
build: Support make seed for x86_64.
* build-aux/GNUmakefile.in (seed): Support make seed for x86_64.
* build-aux/build-mes.sh[SEED]: Also build src/mes.S.
* build-aux/build-x86_64-mes.sh[SEED]: Also build src/mes.x86_64-mes.S.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 19:05:43 +0000 (21:05 +0200)]
mes: Support fold-right 3.
* mes/module/srfi/srfi-1.mes (fold-right): Support fold-right 3.
* tests/srfi-1.test ("fold-right-3"): Test it.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 18:32:49 +0000 (20:32 +0200)]
mescc: Nyacc comment escapes.
* module/mescc/compile.scm (ast->comment): Nyacc comment escapes.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 18:23:43 +0000 (20:23 +0200)]
mescc: Fix clobbering of struct by value assign.
* module/mescc/x86_64/as.scm (long-r0->r1-mem): New instruction.
* module/mescc/i386/as.scm: Likewise.
* lib/x86_64-mes/x86_64.M1: Support it.
* module/mescc/compile.scm (r0->r1-mem*n-): Fix clobbering.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 05:13:04 +0000 (07:13 +0200)]
core: Add vector test.
* scaffold/boot/11-vector.scm: New test.
* build-aux/check-boot.sh: Run it.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 17:22:16 +0000 (19:22 +0200)]
mescc: Fix obnoxious assignment ERROR message.
* module/mescc/compile.scm (expression->register): Fix assignment
ERROR message.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 22:25:33 +0000 (00:25 +0200)]
core: Avoid 64bit zero divide.
* src/math.c (divide): Avoid (64bit) 0 divide.
(modulo): Likewise.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 15:28:08 +0000 (17:28 +0200)]
mescc: Support negative divide.
* module/mescc/i386/as.scm (i386:r0/r1, i386:r0%r1): Support
negative divide.
* module/mescc/x86_64/as.scm (x86_64:r0/r1, x86_64:r0%r1): Likewise.
* lib/x86-mes/x86.M1: Likewise.
* lib/x86_64-mes/x86_64.M1: Likewise.
* scaffold/tests/a0-math-divide-signed-negative.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 13:56:14 +0000 (15:56 +0200)]
mescc: Support --align, off by default.
* scripts/mescc.in (parse-opts): Add --align.
* module/mescc/mescc.scm (mescc:compile): Support --align, off by
default.
* module/mescc/M1.scm (infos->M1): Add #:align parameter.
(M1:merge-infos): Likewise. Keep types.
(info->M1): Likewise. Make alignment switchable.
* module/mescc/compile.scm (r->ident): Do not clobber.
(ident-add): Likewise.
(clean-info): Keep types.
* module/mescc/i386/as.scm (i386:r->byte-label): New instruction.
* lib/x86-mes/x86.M1: Add instructions.
* lib/x86_64-mes/x86_64.M1: Add instructions.
* module/mescc/x86_64/as.scm (x86_64:r->byte-label,
x86_64:r->word-label, x86_64:r->long-label): New instruction.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 13:57:52 +0000 (15:57 +0200)]
Revert "mescc: Make globals at least reg-size."
This reverts commit
30544316c35ed4a2472f2029beb27e007d913792.
Jan Nieuwenhuizen [Sat, 6 Oct 2018 13:36:32 +0000 (15:36 +0200)]
mescc: Make globals at least reg-size.
* module/mescc/compile.scm (global->info): Make globals at least reg-size.