summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* http web server: allow concurrent write operationswip-threaded-http-serverAndy Wingo2012-03-121-21/+83
| | | | | | | | * module/web/server/http.scm (<http-server>, http-open) (read-request!, write-request!, enqueue-write!, http-write): As in the previous commit, add support for concurrent writes. (http-read): Pop off keepalive ports in this, the main loop. (http-close): Shut down writers appropriately.
* http web server: allow concurrent read operationsAndy Wingo2012-03-121-29/+104
| | | | | | | | | | | | | | | | | * module/web/server/http.scm (<http-server>): Add fields for a reader thread-pool, and some async queues that it operates on. Also, a flag, http-threaded?. (http-open): Add #:threaded? and #:read-workers kwargs. Create a thread pool for reading if threads are available. (read-request!): New function, factored out of http-read. (enqueue-read!, http-read): Instead of reading the client directly, enqueue a read. In the case where threads are not available, this will call read-request! directly. read-request! takes care of adding to the handle-queue. The read polling loop will pop items off the handle-queue. (seconds-from-now, async-queue-for-each): New helpers. (http-write): Shut down the queues and threads, hopefully in a nonblocking fashion.
* add ability to wake up the poll() in http.scmAndy Wingo2012-03-121-4/+31
| | | | | | | * module/web/server/http.scm (make-waker, flush-wake-port): New functions, to wake up a poll(). (http-open): Add a wakeup port to the poll set. (http-read): Handle the wakeup port specially.
* add ice-9 thread-poolAndy Wingo2012-03-122-0/+193
| | | | | | * module/ice-9/thread-pool.scm: New file. * module/Makefile.am: Add to build.
* add (ice-9 async-queue)Andy Wingo2012-03-122-0/+165
| | | | | * module/ice-9/async-queue.scm: New file. * module/Makefile.am: Add it to the make file.
* Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2012-03-121-1/+1
|\
| * web http: fix Ma -> MarAndy Wingo2012-03-121-2/+2
| | | | | | | | * module/web/http.scm (write-date): Fix serialization of Mar. Oops.
* | Merge branch 'master' of git.sv.gnu.org:/srv/git/guileAndy Wingo2012-03-121-5/+123
|\ \
| * | elisp rngBT Templeton2012-03-081-0/+15
| | | | | | | | | | | | * module/language/elisp/boot.el (random): New function.
| * | elisp i/oBT Templeton2012-03-081-0/+13
| | | | | | | | | | | | | | | * module/language/elisp/boot.el (send-string-to-terminal) (read-from-minibuffer, prin1-to-string): New functions.
| * | elisp: symbol-name, internBT Templeton2012-03-081-0/+2
| | | | | | | | | | | | * module/language/elisp/boot.el (symbol-name, intern): New functions.
| * | elisp: when, unlessBT Templeton2012-03-081-0/+8
| | | | | | | | | | | | * module/language/elisp/boot.el (when, unless): New macros.
| * | elisp sequence functionsBT Templeton2012-03-081-0/+82
| | | | | | | | | | | | | | | | | | | | | * module/language/elisp/boot.el (nreverse, assoc, assq, rplaca, rplacd) (caar, cadr, cdar, cddr, dolist, stringp, string-equal, string=) (substring, upcase, downcase, string-match, make-vector, mapc, aref) (aset, concat): New functions.
| * | integerp, wholenump return nil for non-numbersBT Templeton2012-03-081-5/+3
| | | | | | | | | | | | | | | | | | * module/language/elisp/boot.el (integerp, wholenump): Call `integer?' before `exact?' so that these predicates return nil for non-numbers instead of signalling an error.
* | | fix bad-request-printerAndy Wingo2012-03-111-1/+1
| | | | | | | | | | | | | | | * module/web/request.scm (bad-request-printer): Fix printer to expect args as a list.
* | | Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo2012-03-113-3/+23
|\ \ \ | | |/ | |/| | | | | | | Conflicts: configure.ac
| * | web server http: 400 Bad Request on bad requestsAndy Wingo2012-03-111-2/+14
| | | | | | | | | | | | | | | | | | * module/web/server/http.scm (bad-request, http-read): If an exception is raised while reading a response, write out a 400 Bad Request response before closing the port.
| * | more libgc 7.1 compatAndy Wingo2012-03-082-1/+9
| | | | | | | | | | | | | | | | | | * configure.ac: * libguile/gc.c (GC_set_finalize_on_demand): Check for this function, and shim if it isn't present.
* | | add bad-request printerAndy Wingo2012-03-111-1/+12
| | | | | | | | | | | | | | | * module/web/request.scm (bad-request-printer): Add printer for these exceptions.
* | | add exception printers for bad-header, bad-header-componentAndy Wingo2012-03-111-1/+16
| |/ |/| | | | | | | | | | | * module/web/http.scm (bad-header-component): Throw 'bad-header-component instead of 'bad-header. (bad-header-printer, bad-header-component-printer): Add exception printers.
* | Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo2012-03-0811-221/+86
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.ac libguile/finalizers.c libguile/finalizers.h libguile/gc.c libguile/gc.h libguile/inline.c libguile/inline.h libguile/ports.c libguile/smob.c libguile/smob.h module/ice-9/deprecated.scm module/ice-9/r4rs.scm
| * run finalizers asynchronously in asyncsAndy Wingo2012-03-085-2/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/finalizers.c: New excitement! We'll be running finalizers asynchronously, from asyncs. This will make it safer to allocate while holding a mutex. (GC_set_finalizer_notifier): Add back-compat shim. * libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism during boot. * libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing on demand. (scm_gc): Explicitly run finalizers here. * libguile/threads.c (guilify_self_2): Run finalizers here if queue_finalizer_async happened to run during guilify_self_1. * configure.ac: Add check for GC_set_finalizer_notifier.
| * use the new finalizer helpersAndy Wingo2012-03-085-60/+12
| | | | | | | | | | | | | | | | * libguile/foreign.c (scm_set_pointer_finalizer_x) * libguile/ports.c (finalize_port) * libguile/smob.c (scm_i_new_smob, scm_i_new_double_smob) * libguile/struct.c (scm_i_alloc_struct) * libguile/numbers.c (make_bignum): Use the new API.
| * add scm_i_set_finalizer, scm_i_add_finalizer, scm_i_add_resuscitatorAndy Wingo2012-03-084-2/+170
| | | | | | | | | | | | | | | | * libguile/finalizers.h: * libguile/finalizers.c: New files. * libguile.h: * libguile/Makefile.am: Add to build.
| * scm_new_smob, scm_new_double_smob inline functionsAndy Wingo2012-03-083-113/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors, which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline functions instead of macros. They also bail to scm_i_new_smob / scm_i_new_double_smob in either the mark or the free case, so that the inline definition doesn't reference other internal details like libgc stuff. (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see them as already being declared. (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2): (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new inline functions. Remove now-unneeded bdw-gc include. * libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and make static. (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators. (scm_i_finalize_smob, scm_i_new_smob_with_mark_proc): Add back-compatibility shims to preserve ABI. * libguile/inline.c: Include smob.h, so as to reify scm_new_smob and scm_new_double_smob.
| * scm_cell, scm_double_cell, scm_words back to gc.hAndy Wingo2012-03-083-97/+104
| | | | | | | | | | | | | | | | | | * libguile/inline.h: * libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move declarations and definitions back here, from inline.h. It's more natural. * libguile/inline.c: Include gc.h as well.
| * simplify inline function infrastructureAndy Wingo2012-03-084-108/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here, from inline.h. We'd like to support inline function definitions in more header files: not just inline.h. (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New definitions. * libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these wrappers, which redirect to the GC_MALLOC macros when building Guile, and the scm_gc_malloc functions otherwise. A step towards getting BDW-GC out of Guile's API. * libguile/inline.h: Simplify, using SCM_INLINE, SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES. Also use the new SCM_GC_MALLOC macros.
| * Fix flush on soft ports, so that it actually runs.Ian Price2012-03-071-14/+4
| | | | | | | | | | * libguile/vports.c (sf_flush): Remove conditional testing the position in the port's write_buf, as it is no longer used.
| * Improve port benchmark.Ludovic Courtès2012-03-071-40/+44
| | | | | | | | | | | | | | | | * benchmark-suite/benchmarks/ports.bm (sequence): New macro, formerly local to the "rdelim" benchmark prefix. (large-string): New procedure. (%latin1-port, %utf8/ascii-port, %utf8/wide-port): Use it. ("peek-char", "char-ready?", "read-char"): Use `sequence'.
| * Fix a segfault when /dev/urandom is not accessibleGiuseppe Scrivano2012-03-071-2/+2
| | | | | | | | | | * libguile/init.c (scm_i_init_guile): Call `scm_init_random' before `scm_init_macros'.
| * deprecate close-io-portAndy Wingo2012-03-052-3/+6
| | | | | | | | | | * module/ice-9/r4rs.scm: * module/ice-9/deprecated.scm (close-io-port): Deprecate.
| * Don't call SYMBOL_STRINGBUF on a stringMark H Weaver2012-03-041-1/+1
| | | | | | | | | | * libguile/strings.c (scm_i_make_symbol): Use STRING_STRINGBUF instead of SYMBOL_STRINGBUF to get the stringbuf of a string.
| * Remove documentation of internal static string comparison functionsMark H Weaver2012-03-041-10/+0
| | | | | | | | | | | | * doc/ref/api-data.texi (String Comparison): Remove documentation for scm_i_string{,_ci}_{equal,less,leq,gr,geq}_p, which are not only internal functions but static, and thus unusable by external code.
| * Comment out unused definitions of 'do' and 'case' in psyntax.scmMark H Weaver2012-03-042-137/+7
| | | | | | | | | | | | | | | | * module/ice-9/psyntax.scm (do, case): Comment out these definitions, which are never used and immediately replaced by definitions in boot-9.scm. * module/ice-9/psyntax-pp.scm: Regenerate.
| * Fix syntax wrap comments; remove old unused cruftMark H Weaver2012-03-041-11/+4
| | | | | | | | | | | | * module/ice-9/psyntax.scm (subst-rename?, rename-old, rename-new, rename-marks, make-rename): Remove these unused syntax rules. Fix description of syntax wraps to match current reality.
* | Change `scm_words' to accept a 32-bit word number.Ludovic Courtès2012-03-072-5/+6
| | | | | | | | | | | | | | | | Fixes <http://bugs.gnu.org/10914>. Reported by Tobias Brandt <tob.brandt@googlemail.com>. * libguile/gc.h (scm_words): Change `n_words' to be `scm_t_uint32'. * libguile/inline.h: Update extraneous declaration.
* | faster (make-prompt-tag); default-prompt-tag is a parameterAndy Wingo2012-03-072-5/+18
| | | | | | | | | | | | | | | | | | * module/ice-9/boot-9.scm (default-prompt-tag): Once parameters have booted, redefine as a parameter. (make-prompt-tag): Change from a gensym to a list. Thanks to Mark Weaver for the suggestion. * doc/ref/api-control.texi (Prompt Primitives): Update docs.
* | call-with-{input,output}-string implemented in schemeAndy Wingo2012-03-072-22/+28
| | | | | | | | | | | | | | | | * module/ice-9/boot-9.scm (call-with-input-string) (call-with-output-string): Implement in Scheme. * libguile/strports.c (scm_call_with_output_string): (scm_call_with_input_string): Dispatch to Scheme.
* | micro-optimizations to string-trim-both, and to (web http)Andy Wingo2012-03-072-29/+28
| | | | | | | | | | | | | | | | | | | | | | * libguile/srfi-13.c (scm_string_trim, scm_string_trim_right) (scm_string_trim_both): Take the whitespace fast-path if the char_pred is scm_char_set_whitespace. * module/web/http.scm (read-header, split-and-trim, parse-quality-list): (parse-param-component, parse-credentials, "Content-Type"): (read-request-line, read-response-line): Use char-set:whitespace instead of char-whitespace?. It avoids recursing into the VM.
* | names of encodings are asciiAndy Wingo2012-03-071-6/+25
| | | | | | | | | | | | | | * libguile/ports.c (scm_mode_bits): Parse the mode bits as latin1. (scm_i_set_default_port_encoding, open_iconv_descriptors) (scm_port_encoding, scm_set_port_encoding_x): Restrict the names of encodings to ASCII.
* | dynstack: pushing a prompt no longer allocates memoryAndy Wingo2012-03-0711-182/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/control.h: Remove scm_t_prompt_registers and scm_c_make_prompt_registers. (scm_c_abort): Take a pointer to a jmpbuf instead of a cookie. It will serve the same purpose. * libguile/control.c (reify_partial_continuation, scm_at_abort): Adapt to new prompt representation. * libguile/dynstack.h: * libguile/dynstack.c (scm_dynstack_push_prompt): Prompts now have 5 words instead of 2, as they now push the fp, sp, ip, and jmpbuf on the stack separately. This avoids allocation. (scm_dynstack_find_prompt): Likewise, add return values for fp, sp, etc. (scm_dynstack_wind_prompt): Replaces scm_dynstack_relocate_prompt. * libguile/eval.c (eval): * libguile/stacks.c (find_prompt): * libguile/throw.c (pre_init_catch): Adapt to the new prompt mechanism. * libguile/vm-engine.c (vm_engine): Setjmp an on-stack jmpbuf every time the VM enters. We can then re-use that jmpbuf for all prompts in that invocation. * libguile/vm-i-system.c (partial_cont_call): Adapt to change in prompt representation. We don't need to wind here any more, since we pass in the prompt's jmpbuf. (prompt): Adapt to scm_dynstack_push_prompt change. (abort): Adapt to vm_abort change. * libguile/vm.h (struct scm_vm): No more cookie. * libguile/vm.c (vm_abort): Adapt to scm_c_abort change. (vm_reinstate_partial_continuation): Rewind the dynamic stack here, now that we do have a valid jmpbuf. (make_vm): No need to initialize a cookie.
* | micro-optimization in (web server)Andy Wingo2012-03-061-2/+4
| | | | | | | | | | * module/web/server.scm (extend-response): Micro-optimize to not mutate data, and to copy as little as possible.
* | ports.c: inline get_codepointAndy Wingo2012-03-061-1/+1
| | | | | | | | | | | | * libguile/ports.c (get_codepoint): Add inline keyword. It showed up high in benchmarks, and it's static, so it's probably important to inline.
* | optimize symbol printingAndy Wingo2012-03-062-22/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/print.h: Remove internal declaration of scm_i_print_symbol_name. * libguile/print.c (symbol_has_extended_read_syntax): Optimize to avoid calling symbol_to_string if we know the symbol cannot be mistaken for a number. (print_normal_symbol): Optimize to call display_string directly, instead of jumping through scm_display. (print_symbol): Rename from scm_i_print_symbol_name. (scm_print_symbol_name, iprin1): Adapt to print_symbol name change.
* | shuffle r4rs procedures into boot-9Andy Wingo2012-03-061-126/+119
| | | | | | | | | | | | | | | | * module/ice-9/boot-9.scm: Refine a comment about low-level port functions. Move call-with-foo-port, with-input-from-foo, etc later in the file, and define using `parameterize' instead of `dynamic-wind'. Somewhat cleaner, and avoids thunk? checks for "swaports" in the old implementation.
* | load parameters earlier in boot-9Andy Wingo2012-03-061-92/+90
| | | | | | | | | | * module/ice-9/boot-9.scm: Move parameters earlier in the boot process. The new with-output-to-port code will use it.
* | slight tweak to file-exists?, file-is-directory?Andy Wingo2012-03-061-3/+3
| | | | | | | | | | | | * module/ice-9/boot-9.scm (file-exists?, file-is-directory?): For the fallback cases, use open-input-file instead of open-file with OPEN_READ.
* | bootstrapping shenanigans in `warn'Andy Wingo2012-03-061-7/+5
| | | | | | | | | | * module/ice-9/boot-9.scm (warn): Don't use with-output-to-port, as we'll move that definition after the psyntax boot.
* | more clear comments in boot-9.scmAndy Wingo2012-03-061-11/+10
| | | | | | | | | | * module/ice-9/boot-9.scm: Update comment header for language primitives.
* | remove deprecated close-io-portAndy Wingo2012-03-061-2/+0
| | | | | | | | | | * module/ice-9/boot-9.scm (close-io-port): Remove proc that was deprecated in 2.0.