summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-03-04Remove documentation of internal static string comparison functionsMark H Weaver1-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.
2012-03-04Comment out unused definitions of 'do' and 'case' in psyntax.scmMark H Weaver2-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.
2012-03-04Fix syntax wrap comments; remove old unused cruftMark H Weaver1-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.
2012-03-03Merge branch 'stable-2.0'Mark H Weaver6-25488/+4085
Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il.scm
2012-03-03Minimize size of embedded syntax objects in psyntax-pp.scmMark H Weaver3-8153/+220
* module/ice-9/compile-psyntax.scm: Minimize syntax object literals embedded in psyntax-pp.scm. * module/ice-9/psyntax.scm: Rename a few variables so that syntax objects embedded in macros have no lexical bindings, so that their minimized syntax objects will have no embedded labels. These labels were the last remaining gensym counters in psyntax-pp.scm. * module/ice-9/psyntax-pp.scm: Regenerate. It is now less than one quarter of its previous size! More importantly, this file no longer contains any gensym counters, which means that in the future, local changes to psyntax.scm will usually result in only local changes to psyntax-pp.scm.
2012-03-03tree-il->scheme improvementsMark H Weaver4-25085/+10102
* module/language/tree-il.scm (tree-il->scheme): New implementation that simply calls 'decompile-tree-il'. * module/language/scheme/decompile-tree-il.scm (choose-output-names, do-decompile): New internal procedures. (decompile-tree-il): New and improved implementation. Print source identifiers where possible, otherwise add minimal numeric suffixes. Previously we printed the gensyms. Avoid 'begin' in contexts that provide an implicit 'begin'. Produce 'cond', 'case', 'and', 'or', 'let*', named let, and internal defines where appropriate. Recognize keyword arguments in 'opts' to disable the production of these derived syntactic forms, and to optionally strip numeric suffixes from variable names. * module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec fixing, and primitive expansion when producing psyntax-pp.scm, in order to produce output as close to the original source as practical. Disable production of derived syntactic forms as needed during bootstrap. Strip numeric suffixes from variable names. Adjust pretty-printing parameters. * module/ice-9/psyntax-pp.scm: Regenerate. It is now less than half of the original size.
2012-03-03optimize dynamic-wind when we know winders are thunksAndy Wingo3-18/+28
* libguile/vm-i-system.c (wind): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Instead of making `wind' call `scm_thunk_p' on the winder and unwinder at runtime, make it the responsibility of the compiler to emit code to call thunk? and error, but only if the compiler cannot prove them to be thunks. * libguile/vm-engine.c (vm_engine): Remove a now-unused error block.
2012-03-03remove out-of-date commentAndy Wingo1-1/+0
* libguile/dynwind.c (scm_dynwind_end): Remove out-of-date comment.
2012-03-03the dynamic stack is really a stack now, instead of a listAndy Wingo22-534/+1079
* libguile/dynstack.h: * libguile/dynstack.c: New files, implementing the dynamic stack as a true stack instead of a linked list. This lowers the cost of dynwinds: frames, winders, prompts, with-fluids, and dynamic-wind. For the most part, we allocate these items directly on the stack. * libguile/dynwinds.h: * libguile/dynwinds.c: Adapt all manipulators of the wind stack to use interfaces from dynstack.c. Remove heap-allocated winder and frame object types. (scm_dowinds, scm_i_dowinds): Remove these. The first was exported, but it was not a public interface. * libguile/continuations.c: * libguile/continuations.h (scm_t_contregs): Continuation objects reference scm_t_dynstack* values now. Adapt to the new interfaces. * libguile/control.c: * libguile/control.h: There is no longer a scm_tc7_prompt kind of object that can be allocated on the heap. Instead, the prompt flags, key, and registers are pushed on the dynwind stack. (The registers are still on the heap.) Also, since the vm_cont will reference the dynwinds, make the partial continuation stub take just one extra arg, instead of storing the intwinds separately in the object table. * libguile/fluids.c: * libguile/fluids.h: No more with-fluids objects; instead, the fluids go on the dynstack. The values still have to be on the heap, though. (scm_prepare_fluids, scm_swap_fluids): New internal functions, replacing scm_i_make_with_fluids and scm_i_swap_with_fluids. * libguile/print.c: Remove prompt and with-fluids printers. * libguile/tags.h: Revert prompt and with-fluids tc7 values to what they were before they were allocated. * libguile/vm-i-system.c (partial_cont_call): Just pop the vmcont, the intwinds will not be passed as a second arg. Rewind the dynamic stack from within the VM, so that any rewinder sees valid prompt entries. (call_cc, tail_call_cc): Adapt to pass the dynstack to scm_i_vm_capture_stack. (prompt, wind, unwind, wind_fluids, unwind_fluids): Adapt to the new interfaces. * libguile/vm.h (scm_i_capture_current_stack): Rename from scm_i_vm_capture_continuation. (scm_i_vm_capture_stack): Take a dynstack as an argument. * libguile/vm.c (vm_reinstate_partial_continuation): Don't wind here, as that could result in winders seeing invalid prompts. * libguile/eval.c: * libguile/root.c: * libguile/stacks.c: * libguile/threads.c: * libguile/threads.h: * libguile/throw.c: Adapt other users of dynwinds to use the dynstack.
2012-03-02pretty-print: allow max-expr-width to be set; recognize more keywordsMark H Weaver1-7/+9
* module/ice-9/pretty-print.scm (pretty-print): Add new keyword argument '#:max-expr-width'. (generic-write): Add new argument 'max-expr-width'. Previously this was internally defined to the constant value 50.
2012-03-02Fix typos in psyntax.scmMark H Weaver2-8435/+8508
* module/ice-9/psyntax.scm (gen-syntax-case): #'pad --> #'pat (define*): #'x --> #'id * module/ice-9/psyntax-pp.scm: Regenerate
2012-03-02comment formatting in ports.cAndy Wingo1-3/+3
* libguile/ports.c: Fix comment.
2012-03-02hash-set! on weak tables returns the valueAndy Wingo4-26/+47
* libguile/weak-table.h: * libguile/weak-table.c (scm_weak_table_putq_x) (scm_weak_table_remq_x, scm_weak_table_clear_x) (scm_weak_table_for_each): Declare these as returning void instead of SCM. * libguile/hashtab.c (scm_hashq_set_x, scm_hashq_remove_x) (scm_hashv_set_x, scm_hashv_remove_x) (scm_hash_set_x, scm_hash_remove_x) (scm_hashx_set_x, scm_hashx_remove_x): (scm_hash_for_each): For weak tables, have the set! functions return the values, as they used to do. Have remove! functions return #f, indicating the lack of a handle. Shim around for-each to return unspecified, even though that wasn't yet a problem. * test-suite/tests/weaks.test: Add a test.
2012-03-02Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2-21/+18
2012-03-02tweaks to -Wformat's gettext detectionAndy Wingo2-21/+18
* module/language/tree-il/analyze.scm (proc-ref?): Change to use less false-if-exception and more variable-bound?. If a variable is present in the local module but not bound, assume that it is gettext if it has the right name. This is to allow for (define _ gettext). * test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example.
2012-03-02Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo11-506/+592
There are a some failures currently: FAIL: tree-il.test: warnings: format: non-literal format string with forward declaration ERROR: srfi-18.test: current-exception-handler: current handler returned at top level - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) ERROR: srfi-18.test: current-exception-handler: multiple levels of handler nesting - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) ERROR: srfi-18.test: current-exception-handler: exception handler installation is thread-safe - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) Conflicts: module/language/tree-il/peval.scm module/language/tree-il/primitives.scm test-suite/tests/tree-il.test
2012-03-02peval: inline applications of lambda to rest argsAndy Wingo2-16/+40
* module/language/tree-il/peval.scm (peval): Add optimization to hoist the inner procedure out of e.g. (lambda args (apply (lambda ...) args)) This commit restores the ability to detect escape-only prompts at compile-time. * test-suite/tests/tree-il.test: Update test for prompt with a lambda, and add a specific test for lambda application.
2012-03-02tree-il: fix `canonicalize!' for promptsAndy Wingo1-5/+5
* module/language/tree-il/canonicalize.scm (canonicalize!): Fix a bug in which the sense of `escape-only?' was reversed. We never saw this though, because for other reasons, no prompts were being identified as escape-only.
2012-03-02more general treatment of call-with-promptAndy Wingo2-16/+44
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Don't limit the call-with-prompt to <prompt> transition to lambda expressions. Instead we can lexically bind the handler, and rely on peval to propagate a lambda expression.
2012-03-01pmatch: always wrap with let, even if the expression appears atomicMark H Weaver1-8/+8
* module/system/base/pmatch.scm (pmatch): Always wrap with 'let', even if the expression appears atomic, because in the presence of 'identifier-syntax', we cannot know what an atomic expression will later expand to. Also use '#:export-syntax' instead of '#:export' to export 'pmatch'.
2012-03-01Fix <TAG>vector-length when applied to other uniform vector typesMark H Weaver3-4/+32
* module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm (define-bytevector-type): Fix definition of <TAG>vector-length when applied to uniform vectors of different element sizes. Thanks to Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug. * test-suite/tests/srfi-4.test: Add tests.
2012-02-27Avoid failure when `format-analysis' stumbles upon unbound variables.Ludovic Courtès2-1/+15
* module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref' in `false-if-exception'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string with forward declaration"): New test.
2012-02-24port i/o optimizations for iso-8859-1Andy Wingo3-6/+83
* libguile/ports.h (scm_t_port_encoding_mode): * libguile/ports.c (scm_c_make_port_with_encoding): (scm_i_set_port_encoding_x): Add special treatment for latin1 encoding. (get_latin1_codepoint, get_codepoint): Add latin1 fast-path. * libguile/print.c (display_string_as_latin1): Add latin1 fastpath.
2012-02-24fixes to threaded finalizersAndy Wingo1-12/+23
* libguile/finalizers.c (finalization_thread_proc): (run_finalization_thread): (start_finalization_thread): (stop_finalization_thread): Use pthreads + scm_with_guile instead of scm_spawn_thread, to avoid deadlocks.
2012-02-24srfi-18 test fixAndy Wingo1-433/+430
* test-suite/tests/srfi-18.test: Enclose the tests in a begin instead of an and. Before, they were not being run, for some reason I don't fully understand.
2012-02-24slight cleanup to run-testAndy Wingo1-28/+27
* test-suite/lib.scm (run-test): Slight cleanup.
2012-02-24srfi-18 cleanupAndy Wingo1-13/+13
* module/srfi/srfi-18.scm (with-exception-handler): (thread-join!, mutex-lock!, mutex-unlock!): Avoid useless invocations of `apply'.
2012-02-24statically initialize the pthread mutex in fat mutexenAndy Wingo1-10/+4
* libguile/threads.c (make_fat_mutex): Remove smob free function. Because we use normal mutexen, we can just blit the mutex to initialize it.
2012-02-24run finalizers asynchronously (in asyncs and/or pthreads)Andy Wingo5-1/+190
* libguile/finalizers.c: New excitement! We'll be running finalizers in threads, if that's available. If it's not available, during early boot, we can run finalizers in asyncs. This will make it safer to allocate while holding a mutex. * libguile/posix.c (scm_fork): Shut down the finalizer thread before forking. * libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism during boot and, if available, initialialize the finalizer thread at the very end. * libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing on demand. (scm_gc): Explicitly run finalizers here. If you're calling this function, you probably want synchronous GC.
2012-02-24signal an error on multithreaded forkAndy Wingo3-5/+20
* libguile/posix.c (scm_fork): Signal an error if a `fork' is attempted after threads have been spawned. * test-suite/tests/00-socket.test: Moved here, from socket.test, so as to run before any threads are created. * test-suite/Makefile.am: Adapt.
2012-02-23remove atfork on revealed mutex in fports.cAndy Wingo1-1/+0
* libguile/fports.c: Remove atfork call.
2012-02-23Revert "add pthread_atfork helpers to our threading shims"Andy Wingo3-18/+3
This reverts commit 2f745b64a1eb06e9e175a1b497d5270bebff9097.
2012-02-23Revert "with a threaded guile, lock weak sets and tables during a fork"Andy Wingo4-194/+28
This reverts commit f609480611cfd1585409fd6b1b90beb730b026cf.
2012-02-23Revert "install pthread_atfork handlers for guile's static mutexen"Andy Wingo9-16/+5
This reverts commit 6a97b1f93aace5c7c976aef51d36b3ae9cfd5630.
2012-02-23Revert "wrap iconv_open / iconv_close with a lock to help in thread/fork issues"Andy Wingo4-45/+1
This reverts commit 8dfb7bbfd908ca883d0fdd0d868e13e6b20803ae.
2012-02-23Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo10-172/+381
Conflicts: module/language/tree-il/analyze.scm
2012-02-23rewrite open-process in C, for robustnessAndy Wingo2-95/+214
* libguile/posix.c (scm_open_process): Rewrite in C, so as to avoid allocations and other calls that are not async-signal-safe. (scm_init_popen, scm_init_posix): Register popen extension. * module/ice-9/popen.scm: Load the popen extension, to get open-process.
2012-02-22microoptimizations in (web uri)Andy Wingo1-11/+10
* module/web/uri.scm (valid-host?): Micro-optimizations.
2012-02-22add test for recent quick fixAndy Wingo1-1/+5
* test-suite/tests/web-uri.test ("string->uri"): Add test for string->uri with hosts beginning in digits.
2012-02-21quick fix the quick fixAndy Wingo1-1/+1
2012-02-21quick fix to uri parserAndy Wingo1-3/+3
* module/web/uri.scm: Quick fix to not throw an error on e.g. http://2012.jsconf.us.
2012-02-20Optimize Equality PrimitivesNoah Lavine3-1/+31
* module/language/tree-il/primitives.scm: add equality-primitive?, which is true for eq?, eqv?, and equal? * module/language/tree-il/peval.scm: if an equality primitive is applied to the same variable twice, fold it to #t * test-suite/tests/tree-il.test: add tests for pevaling equality primitives
2012-02-19Have `-Wformat' recognize `ngettext' calls.Ludovic Courtès2-33/+67
* module/language/tree-il/analyze.scm (gettext?): Rename to... (proc-ref?): ... this. Add `proc' and `special-name' parameters. (gettext?): Define in terms of `proc-ref?'. (ngettext?): New procedure. (const-fmt): Recognize `ngettext' calls. (format-analysis)[<down>](check-format-args]: Check constant-but-non-string 2nd argument in the (not (const-fmt ...)) case. [check-simple-format-args]: Use `const-fmt'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using ngettext", "non-literal format string using ngettext as N_"): New tests. ("simple-format")["unsupported, ngettext"]: New test.
2012-02-19Have `-Wformat' better recognize the `gettext' procedure.Ludovic Courtès2-8/+41
Fixes <http://bugs.gnu.org/10846>. Reported by Bruno Haible <bruno@clisp.org>. * module/language/tree-il/analyze.scm (gettext?): New procedure. (const-fmt): Add `env' parameter; update callers. Use `gettext?'. (format-analysis)[check-simple-format-args]: Actually support gettextized format strings. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext"): Use `gettext' as the procedure name. ("non-literal format string using gettext as _"): New test. ["simple-format"]("unsupported, gettext"): New test.
2012-02-19use the new finalizer helpersAndy Wingo7-86/+21
* libguile/foreign.c (scm_set_pointer_finalizer_x) * libguile/ports.c (finalize_port, scm_c_make_port_with_encoding) (open_iconv_descriptors) * libguile/smob.c (scm_i_new_smob, scm_i_new_double_smob) * libguile/struct.c (scm_i_alloc_struct) * libguile/weak-set.c (weak_gc_finalizer) (scm_c_register_weak_gc_callback) * libguile/weak-table.c (scm_c_register_weak_gc_callback) (weak_gc_finalizer) * libguile/numbers.c (make_bignum): Use the new API.
2012-02-19add scm_i_set_finalizer, scm_i_add_finalizer, scm_i_add_resuscitatorAndy Wingo4-2/+170
* libguile/finalizers.h: * libguile/finalizers.c: New files. * libguile.h: * libguile/Makefile.am: Add to build.
2012-02-19better hysteresis in weak-set, weak-tableAndy Wingo2-2/+74
* libguile/weak-set.c: * libguile/weak-table.c: Attempt to avoid bouncing between sizes when growing the vector causes elements to be removed from the set/table.
2012-02-19tune default hash table sizesAndy Wingo3-8/+4
* libguile/modules.c: In my current image, there are 1790 bindings in the root module, which tips over to the next hash vector size, so declare that to prevent rehashing. * libguile/srcprop.c (scm_init_srcprop): Don't preallocate a big source_whash table, as we might not need it (if everything is compiled, for example). * module/ice-9/boot-9.scm (make-module): Don't preall-cate big hash tables for imported bindings. Instead trust that resizing works correctly.
2012-02-19move revealed-count mechanism to fports.cAndy Wingo5-105/+120
* libguile/fports.c (scm_revealed_count, scm_port_revealed) (scm_set_port_revealed_x, scm_adjust_port_revealed_x): Move these APIs here, and only operate on fports. To keep revealed ports alive, now we will just keep them in a data structure that the GC knows about -- a static list. * libguile/fports.h: Add revealed count to scm_t_fport, and move decls of revealed-count functions here. * libguile/ports.h: * libguile/ports.c: Adapt to change. Remove SCM_REVEALED and SCM_SETREVEALED; since they only apply to fports now, keeping them around would be inviting type errors. (finalize_port): We don't need to worry about resuscitating ports here. * libguile/init.c: Use the scm_set_port_revealed_x function to set the revealed counts on stream ports.
2012-02-19ice-9/poll optimizationAndy Wingo1-8/+2
* module/ice-9/poll.scm (poll-set-add!): Use fileno instead of port->fdes, to avoid manipulating revealed counts.