summaryrefslogtreecommitdiff
path: root/libguile
AgeCommit message (Collapse)AuthorFilesLines
2013-07-17Fix 'SCM_SYSCALL' to really swallow EINTR.Ludovic Courtès1-25/+25
* libguile/_scm.h (SCM_SYSCALL): Keep looping upon EINTR. Reported at <http://lists.gnu.org/archive/html/guile-devel/2013-06/msg00050.html>.
2013-07-16Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-27/+53
Conflicts: libguile/numbers.c
2013-07-16gcd and lcm support inexact integer arguments.Mark H Weaver1-16/+45
Fixes <http://bugs.gnu.org/14870>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/numbers.c (scm_gcd, scm_lcm): Support inexact integers. * test-suite/tests/numbers.test (gcd, lcm): Add tests.
2013-07-16min and max: NaNs beat infinities, per R6RS errata.Mark H Weaver1-10/+8
Fixes <http://bugs.gnu.org/14865>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/numbers.c (scm_min, scm_max): NaNs beat infinities, as per the R6RS errata. * test-suite/tests/numbers.test (min, max): Update tests.
2013-07-16Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver11-65/+125
Conflicts: libguile/keywords.c libguile/vm.c
2013-07-16Avoid lossy conversion from inum to double in numerical comparisons.Mark H Weaver1-2/+38
* libguile/numbers.c (scm_less_p): Avoid converting inums to doubles. * test-suite/tests/numbers.test (<): Add tests.
2013-07-16Fix bugs in numerical equality predicate.Mark H Weaver1-27/+33
* libguile/numbers.c (scm_num_eq_p): Fix bug comparing fractions to infinities (reported by Göran Weinholt <goran@weinholt.se>). Fix erroneous comment describing the logic behind inum/flonum comparison. Use similar logic for inum/complex comparison to avoid rounding errors. Make minor indentation fixes and simplifications. * test-suite/tests/numbers.test (=): Add tests.
2013-07-16Fix rounding in scm_i_divide2double for negative arguments.Mark H Weaver1-4/+11
* libguile/numbers.c (INUM_LOSSLESSLY_CONVERTIBLE_TO_DOUBLE): New macro. (scm_i_divide2double): Use INUM_LOSSLESSLY_CONVERTIBLE_TO_DOUBLE to determine if our fast path is safe. Previously, negative arguments were not checked properly. * test-suite/tests/numbers.test (exact->inexact): Add tests.
2013-07-14Fix VM 'ash' for right shifts by large amounts.Mark H Weaver1-2/+6
Fixes <http://bugs.gnu.org/14864>. Reported by Göran Weinholt <goran@weinholt.se>. * libguile/vm-i-scheme.c (ash): Fallback to 'scm_ash' for right shifts with counts >= SCM_I_FIXNUM_BIT, since '>>' is not guaranteed to work correctly for large counts.
2013-06-28Simplify dynstack API to only wind one fluid at a timeAndy Wingo7-150/+85
* libguile/dynstack.h (SCM_DYNSTACK_TYPE_WITH_FLUID): Rename from with-fluids. * libguile/dynstack.c (scm_dynstack_push_fluid): (scm_dynstack_unwind_fluid): Change API to only wind/unwind one fluid binding. (WITH_FLUID_WORDS): New define, always 2 words (fluid and value box). (WITH_FLUID_FLUID, WITH_FLUID_VALUE_BOX): New macros to get offsets of fluid and value box. (scm_dynstack_push_rewinder, scm_dynstack_push_unwinder): Use WINDER_WORDS. (scm_dynstack_push_dynwind): Use DYNWIND_WORDS. (scm_dynstack_wind_1): Update for scm_swap_fluid API change. * libguile/fluids.h: * libguile/fluids.c (scm_prepare_fluids): Remove; no longer needed. (scm_swap_fluid): Update to just swap one fluid binding. (scm_c_with_fluids, scm_c_with_fluid): Update to use scm_dynstack_push_fluid. * libguile/memoize.c (do_push_fluid, do_pop_fluid): Adapt to API change. * libguile/vm-engine.c (rtl_vm_engine): Change wind-fluids / unwind-fluids to push-fluid / pop-fluid, and actually enable. Woo! * libguile/vm-i-system.c (push-fluid, pop-fluid): Update to new API.
2013-06-28Remove with-fluids; replaced by with-fluid* and inlined push-fluid primopsAndy Wingo7-104/+35
* libguile/vm-i-system.c (push-fluid, pop-fluid): * doc/ref/vm.texi (Dynamic Environment Instructions): Rename wind-fluids to push-fluid, and unwind-fluids to pop-fluid. They now only work on one fluid binding at a time. * module/ice-9/boot-9.scm (with-fluid*): Implement in Scheme in terms of primcalls to push-fluid and pop-fluid. (custom-throw-handler, catch, with-throw-handler): Use with-fluid* instead of with-fluids, as with-fluids is no longer available before psyntax is loaded. (with-fluids): Define in Scheme in terms of with-fluid*. * libguile/fluids.c (scm_with_fluid): Rename from scm_with_fluids, and don't expose to Scheme. * libguile/eval.c (eval): Remove SCM_M_WITH_FLUIDS case. * libguile/expand.c (expand_with_fluids): Remove with-fluids syntax. (DYNLET): Remove, no longer defining dynlet in the %expanded-vtables. * libguile/expand.h: Remove dynlet definitions. * module/ice-9/eval.scm (primitive-eval): Remove with-fluids case. * libguile/memoize.c (do_push_fluid, do_pop_fluid): New primitive helpers, like wind and unwind. (memoize): Memoize wind and unwind primcalls. Don't memoize dynlet to with-fluids. (scm_init_memoize): Initialize push_fluid and pop_fluid here. * libguile/memoize.h (SCM_M_WITH_FLUIDS): Remove definition. * module/ice-9/psyntax.scm (build-dynlet): Remove; this just supported with-fluids, which is now defined in boot-9. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/compiler.texi (Tree-IL): * module/language/tree-il.scm: * module/language/tree-il/analyze.scm: * module/language/tree-il/canonicalize.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/cse.scm: * module/language/tree-il/debug.scm: * module/language/tree-il/effects.scm: Remove <dynlet>. Add cases for primcalls to push-fluid and pop-fluid in compile-glil.scm and effects.scm. * module/language/tree-il/peval.scm (peval): Factor out with-temporaries; probably a bad idea, but works for now. Factor out make-begin0 (a better idea). Inline primcalls to with-fluid*, and remove dynlet cases. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add with-fluid*.
2013-06-27dynamic-wind in terms of wind and unwind; remove <dynwind>, @dynamic-windAndy Wingo4-70/+30
* doc/ref/compiler.texi: Remove mention of <dynwind>. * libguile/eval.c (eval): Remove SCM_M_DYNWIND case. * libguile/expand.c: Remove scm_sym_at_dynamic_wind. * libguile/memoize.c (do_wind, do_unwind): A couple of hacky subrs. If we see a wind or unwind primcall, we expand to a call of a quoted subr value. It works and removes a kind of memoized value from the interpreter. For the compiler,primcalls to wind and unwind are handled specially. (MAKMEMO_DYNWIND): Remove. (scm_tc16_memoizer): Remove. Yay! (memoize): Remove speculative lookup for toplevels to see if they are memoizers: there are no more memoizers. Memoize calls to the wind and unwind primitives. (m_dynamic_wind): Remove. (unmemoize): Remove dynwind case. (scm_init_memoize): Add wind and unwind local definitions. * module/ice-9/boot-9.scm (dynamic-wind): Reimplement in terms of "wind" and "unwind" primitives. These primitives are not exposed to other modules. * module/ice-9/eval.scm (primitive-eval): Remove dynwind case. * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): Remove dynwind cases. * module/language/tree-il.scm: Remove <dynwind>. Yaaay! * module/language/tree-il/analyze.scm (analyze-lexicals): Remove dynwind cases. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add wind and unwind. (flatten-lambda-case): Remove dynwind case. Yay! * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (singly-valued-expression?, peval): Remove <dywind> cases. Inline primcalls to dynamic-wind. Add constant folding for thunk?. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Remove @dynamic-wind, and add procedure? and thunk?. (*effect+exception-free-primitives*): Add procedure? and thunk?. (*multiply-valued-primitives*): Remove @dynamic-wind. Remove @dynamic-wind expander. * test-suite/tests/peval.test ("partial evaluation"): Update tests for dynwind desugaring.
2013-06-27remove @call-with-values memoizerAndy Wingo3-14/+5
* libguile/memoize.h: * libguile/expand.c (scm_sym_at_call_with_values): Remove. * libguile/memoize.c (memoize, m_call_values, unmemoize): Adapt to memoize call-with-values primcalls. * module/ice-9/boot-9.scm (call-with-values): Expand to a call-with-values primcall. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Expect call-with-values primcall, without the @, and fall back to a normal call. * module/language/tree-il/peval.scm (peval): Match bare call-with-values. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*multiply-valued-primitives*): Remove @call-with-values.
2013-06-27remove @call-with-current-continuation memoizerAndy Wingo3-13/+8
* module/ice-9/boot-9.scm (call-with-current-continuation): Change to primcall call-with-current-continuation. * libguile/memoize.h: * libguile/expand.c (scm_sym_atcall_cc): Remove. * libguile/memoize.c (memoize): Memoize call/cc primcalls to SCM_M_CONT. (m_call_cc): Remove. (unmemoize): Unmemoize to call-with-current-continuation. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Update to call-with-current-continuation without @ prefix, and fix fallback case. * module/language/tree-il/primitives.scm (*multiply-valued-primitives*): (*interesting-primitive-names*): Remove @call-with-current-continuation. (call/cc): Expand to call-with-current-continuation. * test-suite/tests/tree-il.test ("call/cc"): Update to use and expect call-with-current-continuation primcalls / toplevel refs.
2013-06-27remove apply:nconc2lastAndy Wingo1-41/+0
* libguile/eval.c (scm_nconc2last): Remove, now unused. * doc/ref/api-evaluation.texi (Fly Evaluation): Remove docs.
2013-06-27remove @apply memoizerAndy Wingo3-47/+6
* libguile/memoize.c (memoize): Recognize a primcall to 'apply as SCM_M_APPLY. (@apply): Remove @apply memoizer. (unmemoize): Unmemoize using "apply", not "@apply". * libguile/memoize.h: * libguile/expand.c (scm_sym_atapply): Remove. * module/ice-9/boot-9.scm (apply): Re-implement using apply primcall. Use case-lambda, so as to give an appropriate minimum arity. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Compile a primcall of "apply" specially, not "@apply". * module/language/tree-il/peval.scm (peval): Match primcalls to "apply", not "@apply". Residualize "apply" primcalls. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*multiply-valued-primitives*): Remove @apply, and apply primitive expander. * test-suite/tests/peval.test: * test-suite/tests/tree-il.test: Update tests to expect residualized "apply". * test-suite/tests/procprop.test ("procedure-arity"): Update test for better apply arity. * test-suite/tests/strings.test ("string"): Update expected error.
2013-06-27Remove @prompt memoizerAndy Wingo5-42/+49
* libguile/memoize.h: * libguile/memoize.c (MAKMEMO_CALL_WITH_PROMPT, memoize, unmemoize): Remove the @prompt memoizer in favor of recognizing call-with-prompt primcalls. Rename SCM_M_PROMPT to SCM_M_CALL_WITH_PROMPT, and pass a thunk instead of an expression so that it has normal applicative order. * libguile/expand.c (PRIMITIVE_REF, PRIMCALL, expand): Produce primcalls from forms whose car is a primitive. (expand_atat): Recognize (@@ primitive FOO) as being a primitive-ref. * module/ice-9/boot-9.scm (call-with-prompt): Instead of dispatching to the wonky @prompt memoizer, residualize a primcall to call-with-prompt. The memoizer will DTRT to allow call-with-prompt to be interpreted correctly without needing an additional binding. * module/ice-9/eval.scm (primitive-eval): Change the 'prompt clause to a call to call-with-prompt. * module/language/tree-il/primitives.scm: No more need to recognize @prompt. * libguile/eval.c (eval): Adapt to SCM_M_PROMPT renaming to SCM_M_CALL_WITH_PROMPT, and apply the thunk. * libguile/throw.c (pre_init_throw): Adapt to scm_abort_to_prompt_star rename.
2013-06-25abort-to-prompt* instead of @abortAndy Wingo2-6/+8
* libguile/control.h: * libguile/control.c (scm_abort_to_prompt_star): Rename from scm_at_abort. * module/ice-9/boot-9.scm (abort-to-prompt): Use abort-to-prompt*. * module/language/tree-il/primitives.scm: Handle abort-to-prompt* instead of @abort.
2013-06-17Fix bug in remqueue in threads.c when removing last element.Mark H Weaver1-1/+1
Reported and debugged by Andrew Gaylard <ag@computer.org>. * libguile/threads.c (remqueue): When removing the last element from a queue with more than one element, set (car q) to the previous element. * THANKS: Thank Andrew Gaylard.
2013-06-16Fix #ifdefery for `setegid'.Ludovic Courtès1-2/+2
* libguile/posix.c (scm_setegid): Change to #ifdef HAVE_SETEGID.
2013-06-16Define `AF_UNIX' only when Unix-domain sockets are supported.Ludovic Courtès1-1/+1
* libguile/socket.c (scm_init_socket): Defined `AF_UNIX' only when `HAVE_UNIX_DOMAIN_SOCKETS' is defined. Reported by Eli Zaretskii <eliz@gnu.org>.
2013-06-10Allow #f as timeout argument to unlock-mutex and SRFI-18 mutex-unlock!Mark H Weaver1-1/+1
Reported by Chaos Eternal <chaoseternal@shlug.org> Based on a patch by Nala Ginrut <nalaginrut@gmail.com> * libguile/threads.c (scm_unlock_mutex_timed): If 'timeout' argument is false, interpret that as no timeout. * doc/ref/api-scheduling.texi (Mutexes and Condition Variables): Update documentation.
2013-06-09procedure-properties for RTL functionsAndy Wingo3-0/+15
* module/system/vm/assembler.scm (link-procprops, link-objects): Arrange to write procedure property links out to a separate section. * libguile/procprop.c (scm_procedure_properties): * libguile/programs.h: * libguile/programs.c (scm_i_rtl_program_properties): * module/system/vm/debug.scm (find-program-properties): Wire up procedure-properties for RTL procedures. Yeah! Fistpumps! :) * module/system/vm/debug.scm (find-program-debug-info): Return #f if the string is "", as it is if we don't have a name. Perhaps elf-symbol-name should return #f in that case... * test-suite/tests/rtl.test: Add some tests.
2013-06-09procedure-documentation works on RTL proceduresAndy Wingo6-19/+50
* libguile/procprop.h: * libguile/procprop.c (scm_procedure_documentation): Move here from procs.c, and to make the logic more similar to that of procedure-name, which allows RTL programs to dispatch to rtl-program-documentation. * libguile/programs.c (scm_i_rtl_program_documentation): * libguile/programs.h: * module/system/vm/program.scm (rtl-program-documentation): New plumbing. * module/system/vm/debug.scm (find-program-docstring): New interface to grovel ELF for a docstring.
2013-06-09Wire up ability to print RTL program aritiesAndy Wingo2-12/+28
* libguile/procprop.c (scm_i_procedure_arity): Allow RTL programs to dispatch to scm_i_program_arity. * libguile/programs.c (scm_i_program_print): Refactor reference to write-program. (scm_i_rtl_program_minimum_arity): New procedure, dispatches to Scheme. (scm_i_program_arity): Dispatch to scm_i_rtl_program_minimum_arity if appropriate. * module/system/vm/debug.scm (program-minimum-arity): New export. * module/system/vm/program.scm (rtl-program-minimum-arity): New internal function. (program-arguments-alists): New helper, implemented also for RTL procedures. (write-program): Refactor a bit, and call program-arguments-alists. * test-suite/tests/rtl.test ("simply procedure arity"): Add tests that arities make it all the way to cold ELF and back to warm Guile.
2013-06-09RTL programs print with their nameAndy Wingo4-15/+40
* libguile/print.c (iprin1): Use scm_i_program_print for RTL programs too. * libguile/procprop.c (scm_procedure_name): For RTL programs, call scm_i_rtl_program_name if there is no override. * libguile/programs.h: * libguile/programs.c (scm_i_rtl_program_name): New helper, dispatches to (system vm program). (scm_i_program_print): For RTL programs, the fallback prints the code pointer too. * module/system/vm/program.scm (rtl-program-name): Use the debug info to get an RTL program name. (write-program): Work with RTL programs too. * test-suite/tests/rtl.test ("procedure name"): Add test.
2013-06-09move procedure-name and procedure-source to procprop.cAndy Wingo4-45/+49
* libguile/procprop.h: * libguile/procprop.c (scm_procedure_name, scm_procedure_source): Move these functions here, from debug.[ch].
2013-06-08const cleanups in instructions.cAndy Wingo1-11/+11
* libguile/instructions.c (fetch_rtl_instruction_table) (fetch_instruction_table): Make the returned table const. Adapt callers. (scm_rtl_instruction_list): Fix comment about format of return value.
2013-06-05Report the faulty keyword in errors raised by `scm_c_bind_keyword_arguments'.Ludovic Courtès1-8/+12
Reported by Mark H. Weaver. * libguile/keywords.c (scm_c_bind_keyword_arguments): Use `scm_error_scm' instead of `scm_error'. Pass the faulty keyword enclosed in a list as the last argument. * test-suite/tests/optargs.test ("scm_c_bind_keyword_arguments"): New test prefix.
2013-06-04Print the faulty object upon invalid-keyword errors.Ludovic Courtès4-15/+16
* libguile/vm.c (vm_error_kwargs_invalid_keyword, vm_error_kwargs_unrecognized_keyword): Add parameter. Pass it enclosed in a list as the last argument to `scm_error_scm'. * libguile/vm-i-system.c (bind_kwargs): Adjust accordingly. * libguile/eval.c (error_invalid_keyword, error_unrecognized_keyword): Add parameter. (prepare_boot_closure_env_for_apply): Adjust accordingly. * module/ice-9/eval.scm (primitive-eval): Likewise. * libguile/error.c (scm_error_scm): Mention `keyword-argument-error' in docstring. * module/ice-9/boot-9.scm (keyword-error-printer): New procedure; use it. * test-suite/tests/optargs.test (c&e, with-test-prefix/c&e): Remove. ("define*")["unrecognized keyword"]: Test the value passed along the `keyword-argument-error' exception. ["invalid keyword"]: New test. * doc/ref/api-control.texi (Error Reporting): Update `scm-error' description.
2013-05-31add new rtl vmAndy Wingo16-25/+3618
* libguile/vm-engine.c (rtl_vm_engine): Add new VM. (vm_engine): Add support for calling RTL programs. * libguile/tags.h (scm_tc7_rtl_program): New type for procedures that run on the new VM. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of): * libguile/print.c (iprin1): * libguile/procprop.c (scm_i_procedure_arity): * libguile/procs.c (scm_procedure_p): Add hooks for the new tc7. * libguile/programs.h: * libguile/programs.c (scm_make_rtl_program, scm_i_rtl_program_print) (scm_rtl_program_p, scm_rtl_program_code): * module/system/vm/program.scm: Add constructors and accessors for the new "RTL programs". * libguile/vm.c (rtl_boot_continuation): Define a boot program. (rtl_apply, rtl_values): New static RTL programs. * libguile/frames.c (scm_frame_num_locals): Adapt for frames of RTL programs. * libguile/frames.h: Add description of RTL frames. * libguile/Makefile.am: Add rules to generate vm-operations.h. * .gitignore: Ignore vm-operations.h. * module/system/vm/instruction.scm: * libguile/instructions.c: * libguile/instructions.h: Use vm-operations.h to define enumerated values for the new RTL opcodes. Define some helper macros to pack and unpack 32-bit instruction words. (rtl-instruction-list): New function, exported by (system vm instruction). * libguile/objcodes.c: Wire up the bits needed to detect the new RTL bytecode and load it, as appropriate.
2013-05-30Do not assume `pthread_t' is an integer type.Ludovic Courtès1-10/+15
Fixes <http://bugs.gnu.org/14469>. Reported by Panicz Maciej Godek <godek.maciek@gmail.com>. * libguile/finalizers.c (finalization_thread_is_running): New variable. (start_finalization_thread): Use it to determine whether FINALIZATION_THREAD is up and running. (stop_finalization_thread): Likewise.
2013-05-27refactor to resolve_variableAndy Wingo1-16/+13
* libguile/vm.c (resolve_variable): Slight refactor.
2013-05-27cpp hygiene in the vmAndy Wingo3-6/+47
* libguile/vm-engine.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: CPP hygiene: the code that #defines, #undefs. Makes things cleaner given the multiple inclusion dance we do.
2013-05-27pop-continuation abort-continuation hooks pass return vals directlyAndy Wingo3-52/+62
* doc/ref/api-debug.texi (VM Hooks): Update documentation. * libguile/vm.c (vm_dispatch_hook): * libguile/vm-engine.c: Rework the hook machinery so that they can receive an arbitrary number of arguments. The return and abort hooks will pass the values that they return to their continuations. (vm_engine): Adapt to ABORT_CONTINUATION_HOOK change. * libguile/vm-i-system.c (return, return/values): Adapt to POP_CONTINUATION_HOOK change. * module/system/vm/frame.scm (frame-return-values): Remove. The pop-continuation-hook will pass the values directly. * module/system/vm/trace.scm (print-return): (trace-calls-to-procedure): (trace-calls-in-procedure): Update to receive return values directly. * module/system/vm/traps.scm (trap-in-procedure) (trap-in-dynamic-extent): Ignore return values. (trap-frame-finish, trap-calls-in-dynamic-extent) (trap-calls-to-procedure): Pass return values to the handlers.
2013-05-27Allow vm_engine caller to pass arguments on the stack.Andy Wingo1-4/+13
* libguile/vm-engine.c (vm_engine): Allow the caller to pass arguments on the stack.
2013-05-27vm-engine: remove register assignmentsAndy Wingo1-61/+12
* libguile/vm-engine.c: Remove the register assignments inherited from the 1990s. GCC does seem to allocate reasonably on systems with enough registers (e.g. x86-64), and on system with too few (ia32) we disabled manual allocation. Anyway this code was never tested, so it's better to leave the compiler to do its own thing, until proven otherwise. Also in the RTL VM we don't need to allocate a register to the SP, because it isn't accessed as much.
2013-05-23remove some configurability in vm-engineAndy Wingo2-67/+3
* libguile/vm-engine.c: Remove the ability for the VM to check object access, free variable access, and the ip. They were off by default. Since they will be different in the RTL VM, their presence is just making things confusing. * libguile/vm.c: Remove corresponding error helpers.
2013-05-23minor vm-engine cleanupsAndy Wingo1-25/+18
* libguile/vm-engine.c: Some very minor cleanups: indenting, use of VM_ASSERT, commenting.
2013-05-23remove CONS macro in VM; use scm_cons insteadAndy Wingo3-42/+8
* libguile/vm-engine.c (CONS): Remove. Callers should use scm_cons instead, syncing registers beforehand. (POP_LIST): Adapt, only synchronizing once. (POP_LIST_MARK, POP_CONS_MARK): Remove unused macros. * libguile/vm-i-scheme.c (cons): * libguile/vm-i-system.c (push-rest, bind-rest): Adapt.
2013-05-23inline vm-engine.h into vm-engine.cAndy Wingo3-405/+377
* libguile/vm-engine.h: * libguile/vm-engine.c: Fold vm-engine.h into vm-engine.c. * libguile/Makefile.am: Adapt.
2013-05-23add (find-mapped-elf-image) procedure to (system vm objcode) moduleAndy Wingo1-0/+108
* libguile/objcodes.c (register_elf, scm_find_mapped_elf_image): New interfaces that keep a list of all ELF mappings. Exported from the (system vm objcode) module. * module/system/vm/objcode.scm: Export find-mapped-elf-image.
2013-05-23refactor and simplify ELF loader in objcodes.cAndy Wingo1-240/+196
* libguile/objcodes.c (sniff_elf_alignment, alloc_aligned) (copy_and_align_elf_data): New helpers for portably re-aligning ELF data from read(2) or from a bytevector. (load_thunk_from_memory): Simplify! Now there is only one procedure that loads ELF, and it does less: it simply receives the whole image in one array, hopefully from mmap. (scm_load_thunk_from_file): Use new map_file_contents helper, and go through load_thunk_from_memory. (scm_load_thunk_from_memory): Pass load_thunk_from_memory a piece of memory that it owns, and that is appropriately aligned.
2013-05-23add scm_{to,from}_{u,}intptr_tAndy Wingo2-13/+31
* libguile/numbers.h (scm_to_intptr_t, scm_from_intptr_t) (scm_to_uintptr_t, scm_from_uintptr_t): New defines. * libguile/foreign.c: Remove definitions here; adapt callers to use new names with _t suffixes.
2013-04-14Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver20-503/+1025
Conflicts: GUILE-VERSION libguile/array-map.c libguile/fports.h libguile/gc.h libguile/inline.h libguile/ports.c libguile/ports.h libguile/print.c libguile/r6rs-ports.c libguile/read.c test-suite/tests/00-socket.test
2013-04-10build: Tell `gen-scmconfig' whether the system has `struct timespec'.Ludovic Courtès1-1/+1
* configure.ac: Reinstate `struct timespec' check removed in commit 7e7c6f6a937005b08fffd5aeccdf992459b07137, but define `HAVE_SYSTEM_STRUCT_TIMESPEC' instead of `HAVE_STRUCT_TIMESPEC'. * libguile/gen-scmconfig.c (main): Change `HAVE_STRUCT_TIMESPEC' to `HAVE_SYSTEM_STRUCT_TIMESPEC'.
2013-04-10stime: Remove #ifdef HAVE_*_H for headers provided by Gnulib.Ludovic Courtès1-10/+2
* libguile/stime.c: Remove #ifdef HAVE_SYS_TIMES_H, HAVE_SYS_TYPES_H, and HAVE_STRING_H since those headers are always provided by Gnulib when the corresponding macro is undefined. Fixes a regression on MinGW introduced by commit 40e2a31.
2013-04-09fix stime patch for HAVE_TIMES removalAndy Wingo1-3/+14
* libguile/stime.c (scm_init_stime): Fix previous patch. At this point in the source, we definitely have a run-time function, but don't necessarily have a real-time function.
2013-04-09simplify configure checks for functionality provided by gnulibAndy Wingo1-21/+0
* configure.ac: Remove checks for pipe, stftime, times, and select, as our Gnulib modules already ensure they are provided. * libguile/stime.c: Rely on gnulib providing `times'.
2013-04-08Miscellaneous 'sendfile' fixes and improved tests.Mark H Weaver1-7/+13
* libguile/filesys.c (scm_sendfile): In Linux-style sendfile(2) code, if EINTR or EAGAIN occurs, set result to 1 (not 0) so that we actually keep going. In non-sendfile(2) code, deal gracefully with short reads due to EOF. * test-suite/tests/filesys.test ("sendfile"): Use 'let*' to guarantee the needed order of operations: write (test-file) and then read it. Add code to check the written data (not just the returned length) in all tests, including the cases that hit EOF prematurely.