summaryrefslogtreecommitdiff
path: root/libguile
AgeCommit message (Collapse)AuthorFilesLines
2019-04-04Merge from upstream LighteningAndy Wingo1-0/+1
2019-04-04Fix some aspects of instruction mcode addressesAndy Wingo1-5/+3
* libguile/jit.c (struct scm_jit_state): Remove entry_mcode member. (add_inter_instruction_patch): Fix off-by-one. (compile): Reset reloc_idx when restarting a compile. All instructions record their addresses.
2019-04-04Fix JIT bugsAndy Wingo1-2/+2
* libguile/jit.c (compile): Fix reloc fixup. (compute_mcode): Correctly compute entry mcode.
2019-04-04Merge from upstream LighteningAndy Wingo1-2/+2
2019-04-04Fix jit_gpr_is_callee_save usageAndy Wingo1-5/+5
* libguile/jit.c (emit_entry_trampoline): Fix invocations for jit_gpr_is_callee_save.
2019-04-04Merge from upstream LighteningAndy Wingo6-20/+23
2019-04-04jit: Fix inter-instruction relocs.Andy Wingo1-6/+38
* libguile/jit.c (struct pending_reloc, emit_entry_trampoline) (add_inter_instruction_patch, compile, compute_mcode): Fix inter-instruction relocs.
2019-04-03Fix jit.c compilationAndy Wingo1-160/+234
* libguile/jit.c: Finish adaptation for lightening. Still crashes though.
2019-04-03Merge from upstream lighteningAndy Wingo1-0/+12
2019-04-03Checkpoint for lightning to lightening conversionAndy Wingo1-463/+444
2019-04-03Merge from upstream LighteningAndy Wingo3-8/+28
2019-04-03Adapt to lightning -> lightening name changeAndy Wingo257-85/+87
* libguile/jit.c: Include lightening.h. * libguile/Makefile.am: Adapt.
2019-04-03Merge in changes from upstream lighteningAndy Wingo48-20/+20
2019-04-03Add subdir-objects option to libguile makefile.Andy Wingo1-1/+1
* libguile/Makefile.am (AUTOMAKE_OPTIONS): Add subdir-objects, to allow for having two files named "jit.c".
2019-04-03Replace GNU Lightning with LighteningAndy Wingo275-33108/+24933
2019-02-23Handle newlib C library's langinfo constant namesMichael Gran1-1/+26
The newlib C library (used in Cygwin) has alternative names for nl_langinfo GNU extensions * configure.ac (_NL_NUMERIC_GROUPING): new test * libguile/i18n.c (INT_CURR_SYMBOL, MON_DECIMAL_POINT, MON_THOUSANDS_SEP) (MON_GROUPING, POSITIVE_SIGN, NEGATIVE_SIGN, GROUPING, INT_FRAC_DIGITS) (FRAC_DIGITS, P_CS_PRECEDES, P_SEP_BY_SPACE, N_CS_PRECEDES, N_SEP_BY_SPACE) (P_SIGN_POSN, N_SIGN_POSN, INT_P_CS_PRECEDES, INT_P_SEP_BY_SPACE) (INT_N_CS_PRECEDES, INT_N_SEP_BY_SPACE, INT_P_SIGN_POSN, INT_N_SIGN_POSN) [HAVE_DECL__NL_NUMERIC_GROUPING]: map to newlib C constants, when present
2019-02-22Fix race when expanding syntax-parameterize and define-syntax-parameterAndy Wingo1-2/+4
* libguile/macros.c (scm_i_make_primitive_macro): Give primitive macros a primitive-macro macro-type. * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook): Inline into uses. (make-binding): Change format of lexically defined or rebound syntax parameters to just be the transformer, not a list of the transformer. (resolve-identifier, expand-install-global, expand-body) (syntax-parameterize): Adapt to use the variable object (box) holding the top-level syntax parameter as the "key" for lookups into the lexical environment, instead of a fresh object associated with the syntax transformer. * module/ice-9/psyntax-pp.scm: Regenerate. Fixes #27476, a horrible race when one thread is expanding a syntax-parameterize form including uses, and another thread is expanding the corresponding define-syntax-parameter. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27476#102.
2019-02-09Fix binary output on files created by mkstemp!Mike Gran1-4/+4
Some operating systems require a O_BINARY flag. * libguile/filesys.c (scm_i_mkstemp): Don't mask out O_BINARY flag * test-suite/tests/posix.test ("binary mode honored"): new test
2019-02-09Fix strftime compile with null threadsMike Gran1-2/+2
* libguile/stime.c (scm_strftime): use correct pthread lock function
2018-12-16Do not warn the user when 'madvise' returns ENOSYS.Ludovic Courtès1-2/+5
* libguile/vm.c (return_unused_stack_to_os): Avoid 'perror' calls when 'madvise' returns ENOSYS.
2018-10-19scm_seed_to_random_state: Support wide string arguments.Mark H Weaver1-2/+24
Partially fixes <https://bugs.gnu.org/33044>. Reported by Tom de Vries <tdevries@suse.de>. * libguile/random.c (scm_seed_to_random_state): Use 'scm_to_utf8_string' (or 'scm_to_latin1_string' for a narrow string, for compatibility) to convert the string into raw bytes for use by 'scm_c_make_rstate'. Make sure the length in bytes fits within an 'int'.
2018-10-19Fix typo in strings.h.Mark H Weaver1-2/+2
* libguile/strings.h: In a comment, add the missing "i_" in "scm_i_is_narrow_string".
2018-10-17Use 'scm_from_utf8_{string,symbol,keyword}' for C string literals.Mark H Weaver22-102/+115
Partial fix for <https://bugs.gnu.org/33044>. Reported by Tom de Vries <tdevries@suse.de>. Fix several instances of the mistake of using 'scm_from_locale_*' for C strings that originally came from a C string literal. Change several uses of 'scm_from_latin1_*' as well, to promote the practice of writing code that works for arbitrary C string literals. Also add missing years to the copyright notices of changed files, based on the git history. * libguile/debug-malloc.c, libguile/deprecation.c, libguile/error.c, libguile/eval.c, libguile/expand.c, libguile/extensions.c, libguile/filesys.c, libguile/init.c, libguile/load.c, libguile/modules.c, libguile/pairs.c, libguile/posix.c, libguile/print.c, libguile/random.c, libguile/read.c, libguile/regex-posix.c, libguile/snarf.h, libguile/srfi-13.c, libguile/stacks.c, libguile/stime.c, libguile/strports.c, libguile/values.c: Use 'scm_from_utf8_*' where appropriate.
2018-10-14In 'ash' and 'round-ash', handle right shift count of LONG_MIN.Mark H Weaver1-2/+11
Fixes <https://bugs.gnu.org/21901>. Reported by Zefram <zefram@fysh.org>. * libguile/numbers.c: Add another top-level 'verify' to ensure that LONG_MIN is not a fixnum. (scm_ash, scm_round_ash): Ensure that when the shift count is LONG_MIN, it is not handled via the normal code path, to avoid signed overflow when the shift count is negated. * test-suite/tests/numbers.test: Add tests.
2018-10-14Fix 'round-ash' of negative integers by huge right shift counts.Mark H Weaver1-6/+10
This is a followup to commit 011aec7e240ef987931548d90c53e6692c85d01c. When rounding, right shifting a negative integer by a huge shift count results in 0, not -1. * libguile/numbers.c: Add top-level 'verify' to ensure that the assumptions in 'scm_ash' and 'scm_round_ash' are valid. (scm_round_ash): In the case that handles huge right shifts, require that the shift count _exceeds_ the integer length, and return 0 instead of -1. * test-suite/tests/numbers.test: Adjust tests accordingly.
2018-10-14Gracefully handle huge shift counts in 'ash' and 'round-ash'.Mark H Weaver1-3/+31
Fixes <https://bugs.gnu.org/32644>. Reported by Stefan Israelsson Tampe <stefan.itampe@gmail.com>. The need for this arose because the type inferrer for 'ursh' sometimes passes (- 1 (expt 2 64)) as the second argument to 'ash'. * libguile/numbers.c (scm_ash, scm_round_ash): Gracefully handle several cases where the shift count does not fit in a C 'long'. * test-suite/tests/numbers.test: Add tests.
2018-10-14Fix list validation of *list->bytevector procedures.Mark H Weaver1-4/+8
Fixes <https://bugs.gnu.org/32938>. Reported by Josh Datko <jbd@cryptotronix.com>. * libguile/validate.h (SCM_VALIDATE_LIST_COPYLEN) (SCM_VALIDATE_NONEMPTYLIST_COPYLEN): Use '!=' instead of '>=' to validate the result of 'scm_ilength' after it has been stored in the user variable 'cvar'. * test-suite/tests/bytevectors.test: Add tests. Use '#:use-module' instead of ':use-module' in 'define-module' form.
2018-10-14Improve the documentation for 'nil?'.Mark H Weaver1-2/+11
* libguile/boolean.c (scm_nil_p): Improve docstring. * doc/ref/api-languages.texi (Nil): Add documentation for 'nil?', along with a description of how Elisp interprets Scheme booleans and end-of-list.
2018-10-10Fix 32/64 bit bug in INTEGER_ACCESSOR_PROLOGUEDaniel Llorens1-1/+1
2018-10-09Fix JIT of 64-bit comparisons on 32-bit architecturesAndy Wingo1-8/+8
* libguile/jit.c (compile_u64_imm_less): Compare high word using not-equal, to avoid a signedness compare. (compile_s64_imm_less, compile_imm_s64_less): Fix the not-less cases.
2018-10-09Better ursh/ulsh/srsh JIT on 32-bit platformsAndy Wingo1-21/+39
* libguile/jit.c (compile_ursh_immediate, compile_ulsh_immediate) (compile_srsh_immediate): Special-case shifts by 32 bits on 32-bit platforms. Avoids shifting by 0.
2018-10-09Fix JIT register state tracking for use of SP or FP as tempAndy Wingo1-1/+7
* libguile/jit.c (record_gpr_clobber): If we clobber SP or FP, clear the appropriate register state bits. Only exercised for 32-bit targets in practice! (emit_alloc_frame, emit_push_frame): Fix a couple places where we were failing to track the register state correctly. (compile_umul): Remove a needless register state flush, nowthat qmulr_u has a wrapper that tracks this for us.
2018-10-08Fix JIT compilation on 32-bit targetsAndy Wingo1-7/+37
* libguile/jit.c: Fix compilation on 32-bit targets. Still not working however.
2018-10-07Fix -Wunused-function error for x86 not on sunAndy Wingo1-1/+5
* libguile/lightning/lib/jit_x86-x87.c (_fstcwm): Surround definition with ifdef(sun).
2018-10-07Fix unused local warning in vm-engine.cAndy Wingo1-1/+0
* libguile/vm-engine.c (return-values): Remove needless frame_size=3 local var.
2018-10-07Fix lightning build with jit_names.cAndy Wingo1-1/+1
* libguile/lightning/lightning.am (lightning_extra_files): Move jit_names.c here.
2018-10-07Revert "Remove jit_names.c."Andy Wingo3-0/+236
This reverts commit b74e1f0de322e74930b46b826b0492638eb521b1.
2018-10-07Remove jit_names.c.Andy Wingo3-236/+0
* libguile/lightning/lib/jit_names.c: Remove unused file. * libguile/lightning/lightning.am (lightning_c_files): Remove jit_names.c. * libguile/lightning/lib/jit_print.c: Remove jit_names.c inclusion.
2018-10-07Fix GCC warning with %char-set-dump.Andy Wingo1-1/+1
* libguile/srfi-14.c (scm_sys_char_set_dump): Silence an erroneous -Wformat-overflow warning based on an incorrect range inference by increasing output buffer size.
2018-10-07Deprecate scm_find_executableAndy Wingo4-71/+52
* libguile/deprecated.h: * libguile/deprecated.c (scm_find_executable): Deprecate. Use strdup instead of weird scm_cat_path function. * libguile/script.h: * libguile/script.c: Remove old decls.
2018-10-07Remove unimplemented decl in script.hAndy Wingo1-4/+0
* libguile/script.h (scm_find_impl_file): Remove unimplemented decl.
2018-10-07Comment out some unused definitionsAndy Wingo1-2/+2
* libguile/jit.c: Comment out unused var decls.
2018-10-07Fix use of uninstalled header by installed headersAndy Wingo28-2/+26
* libguile/Makefile.am (libpath.h): Remove definition of SCM_EFFECTIVE_VERSION, which is defined in version.h. * libguile/extensions.h: Remove libpath.h inclusion, as it's not installed. * libguile/atomic.c: * libguile/bytevectors.c: * libguile/control.c: * libguile/fdes-finalizers.c: * libguile/foreign-object.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/goops.c: * libguile/i18n.c: * libguile/instructions.c: * libguile/intrinsics.c: * libguile/ioext.c: * libguile/load.c: * libguile/loader.c: * libguile/poll.c: * libguile/ports.c: * libguile/posix.c: * libguile/programs.c: * libguile/r6rs-ports.c: * libguile/srfi-1.c: * libguile/srfi-60.c: * libguile/threads.c: * libguile/unicode.c: * libguile/vm.c: * libguile/weak-vector.c: Include version.h for the SCM_EFFECTIVE_VERSION definition.
2018-10-05Fix 'atomic-box-compare-and-swap!'.Mark H Weaver2-9/+29
Fixes <https://bugs.gnu.org/32786>. 'scm_atomic_compare_and_swap_scm' is a thin wrapper around 'atomic_compare_exchange_weak' (where available), and therefore it may spuriously fail on some platforms, leaving the atomic object unchanged even when the observed value is equal to the expected value. Since 'scm_atomic_compare_and_swap_scm' returns both a boolean result and the observed value, the caller is able to detect spurious failures when using that API. 'atomic-box-compare-and-swap!' presents a simpler API, returning only the observed value. The documentation advises callers to assume that the exchange succeeded if the observed value is 'eq?' to the expected value. It's therefore not possible to report spurious failures with this API. 'atomic-box-compare-and-swap!' uses 'scm_atomic_compare_and_swap_scm', and prior to this commit would simply ignore the boolean result and return the observed value. In case of spurious failures, the caller would legitimately conclude that the exchange had succeeded. With this commit, 'atomic-box-compare-and-swap!' now retries in case of spurious failures. * libguile/atomic.c (scm_atomic_box_compare_and_swap_x): If 'scm_atomic_compare_and_swap_scm' returns false and the observed value is equal to 'expected', then try again. * libguile/vm-engine.c (atomic-box-compare-and-swap!): Ditto.
2018-10-04Fix f32-set! JIT compilationAndy Wingo1-1/+1
* libguile/jit.c (compile_f32_set): Fix to write an f32, not a f64.
2018-09-30Finish updating vm.texiAndy Wingo1-8/+8
* doc/ref/compiler.texi (Bytecode): Update macro-assembler instructions, and move most of them to the instruction set reference. * doc/ref/vm.texi (A Virtual Machine for Guile, VM Programs): Minor fixes. (Instruction Set): Update for Guile 3 instruction set. * libguile/vm-engine.c (vm_engine): Update a few instruction docstrings.
2018-09-23Define AT_SYMLINK_NOFOLLOW et al.Ludovic Courtès1-1/+17
* libguile/posix.c (scm_init_posix): Define AT_SYMLINK_NOFOLLOW, AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, and AT_EMPTY_PATH when available. (scm_utime): Mention AT_SYMLINK_NOFOLLOW. * doc/ref/posix.texi (File System): Update accordingly. * test-suite/tests/posix.test ("utime")["AT_SYMLINK_NOFOLLOW"]: New test.
2018-09-22Update comments in vm-engine.cAndy Wingo2-49/+453
* libguile/jit.c (compile_s64_numerically_equal): Remove as this instruction was removed in previous refactoring. (compile_atomic_scm_set_immediate), compile_atomic_scm_ref_immediate): Adapt to change in C name of these instructions. * libguile/vm-engine.c: Add comments for all instructions.
2018-09-22Fix case where running abort hook could trash registersAndy Wingo1-2/+5
* libguile/vm-engine.c (abort): If the abort doesn't need to longjmp and the abort hook was enabled, cache registers first to avoid restoring a bad IP to the VM.
2018-09-20Renumber instructions and bump objcode versionv2.3.0Andy Wingo2-1289/+1178
* libguile/loader.h (SCM_OBJCODE_MINIMUM_MINOR_VERSION): (SCM_OBJCODE_MINOR_VERSION): Bump version. * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. * libguile/vm-engine.c: Rearrange opcodes to be contiguous and in a somewhat sensible order.