summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2011-05-06Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo15-15398/+15106
2011-05-06avoid tls gets when handling interrupts in the vmAndy Wingo4-8/+8
* libguile/__scm.h (SCM_ASYNC_TICK_WITH_CODE): Redefine to take a scm_i_thread* as well. OK to do because it's within a BUILDING_LIBGUILE block. * libguile/vm-engine.c (vm_engine): Cache the scm_i_thread* instead of the dynstate, so we can use the thread for ticks. * libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): Tick with the scm_i_thread* local var, to avoid excessive tls calls. * libguile/vm-i-system.c: Fix dynstate users to use current_thread->dynamic_state.
2011-05-05map and for-each in schemeAndy Wingo7-425/+310
* module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead of C. There are boot versions before `cond' is defined. (map-in-order): Define this alias here instead of in evalext.h. * libguile/eval.c: Stub out the map and for-each definitions to just call into Scheme. * libguile/evalext.c: Remove map-in-order definition. * module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map. (map, for-each): Define implementations here, in Scheme, instead of in C. * test-suite/tests/eval.test (exception:wrong-length, "map"): Update the expected exception for mapping over lists of different lengths. * libguile/srfi-1.h: * libguile/srfi-1.c: Remove map and for-each definitions. Remove the bit that extended the core `map' primitive with another method: the right way to do that is with modules.
2011-05-05psyntax simplificationAndy Wingo2-14932/+14708
* module/ice-9/psyntax.scm (strip): Inline the and-map* definition to its one call site. * module/ice-9/psyntax-pp.scm: Regenerate.
2011-05-05scm_mem[qv] optimizationAndy Wingo1-8/+51
* libguile/list.c (scm_memq, scm_memv): Inline the tortoise/hare check that scm_ilength does, via SCM_VALIDATE_LIST, into the memq/memv bodies. Avoids traversing these lists twice.
2011-05-05Generate `escape' and `substitute' port decoding tests.Ludovic Courtès1-25/+29
2011-05-05Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo41-705/+1177
2011-05-05VM tweaksAndy Wingo5-48/+68
* libguile/vm-engine.c (VM_CHECK_OBJECT, VM_CHECK_FREE_VARIABLES): Set to 0 for both engines. These are really internal debugging variables, which don't affect user-visible features, provided that the compiler is correct of course. (VM_CHECK_UNDERFLOW): New var, also off by default: whether to check for stack underflow when popping values. (vm_engine): Don't declare object_count if we are not checking object table accesses. * libguile/vm-engine.h (CACHE_PROGRAM): Don't muck with object_count if we are not checking object table accesses. (CHECK_UNDERFLOW, PRE_CHECK_UNDERFLOW): Nop out if we are not checking underflow. (POP2, POP3): New macros which check for underflow before popping more than one value. * libguile/vm-i-loader.c (load_array): * libguile/vm-i-scheme.c (set_car, set_cdr, vector_set, slot_set) (BV_SET_WITH_ENDIANNESS, BV_FIXABLE_INT_SET, BV_INT_SET) (BV_FLOAT_SET): * libguile/vm-i-system.c (partial_cont_call, fix_closure, prompt) (fluid_set): Use POP2 / POP3. (local_set, long_local_set): Pop to locals instead of using values on the stack then dropping; allows for underflow to be checked before the value is accessed. (BR): Don't NULLSTACK or DROP after the operation. (br_if, br_if_not, br_if_eq, br_if_not_eq, br_if_null) (br_if_not_null): Pop to locals before doing the compare and jump.
2011-05-05srfi-1 `member' in scheme, inlines to memq / memv in some casesAndy Wingo3-62/+53
* libguile/srfi-1.c: * libguile/srfi-1.h (scm_srfi1_member): Move implementation to Scheme. * module/srfi/srfi-1.scm (member): Implement here, with the inlining cases for eq? and eqv?. Speeds up a compiled bootstrap of psyntax.scm, because lset-adjoin inlines to the memq case. (lset<=): Reindent. (lset-adjoin, lset-union): If the comparator is eq? or eqv?, just pass it through to `member', so we inline to memq / memv. Use something closer to the reference implementations.
2011-05-05speed up compile-bytecodeAndy Wingo2-110/+141
* module/language/assembly/compile-bytecode.scm (compile-bytecode): Rewrite to fill a bytevector directly, instead of using bytevector ports. `write-bytecode' itself is still present and almost the same as before; it's just that `write-byte' et al now inline the effect of writing a byte to a binary port. * test-suite/tests/asm-to-bytecode.test (comp-test): Refactor to use public interfaces.
2011-05-05silly "optimization" in (language assembly)Andy Wingo1-5/+5
* module/language/assembly.scm (byte-length): Silly, minor tweak: put the fixed-length instruction case first. Seems to shave some 10% off the time compiling psyntax.scm (when the whole rest of the system is compiled, of course).
2011-05-05add gcprofAndy Wingo1-2/+83
* module/statprof.scm (gcprof): New variant of statprof; instead of being driven by setitimer, this one is driven by the after-gc-hook.
2011-05-05minor statprof tweaksAndy Wingo1-4/+4
* module/statprof.scm (statprof-reset): Make full-stacks? into an optional arg instead of doing the rest arg dance. (statprof-display): Format gc-time-taken appropriately.
2011-05-04Automatically generate `peek-char' decoding error tests.Ludovic Courtès1-68/+66
* test-suite/tests/ports.test ("string ports")[make-peek+read-checks]: New macro. [test-decoding-error]: Change to take a list of expected characters or conditions. Use `make-peek+read-checks' to generate a `peek-char' test. [(#xc2 #x41 #x42), (#xe0 #xa0 #x41 #x42)]: New tests.
2011-05-04measure time spent in gcAndy Wingo1-1/+36
* libguile/gc.c (scm_gc_stats): Set the gc-time-taken entry to our recorded value. (start_gc_timer, accumulate_gc_timer, scm_init_gc): Arrange to record a conservative estimate of time spent in GC.
2011-05-04scm_c_get_internal_run_time is more preciseAndy Wingo2-104/+168
* libguile/stime.h (SCM_TIME_UNITS_PER_SECOND): Redefine to point to a C variable instead of being a pure preprocessor thing. This has the possibility to break existing compiled C extensions' interpretation of the internal-time-units-per-second, but hopefully there's no too much of that code out there, and in the worst case they can just recompile. Scheme code will get it right without the need to recompile. * libguile/stime.c (TIME_UNITS_PER_SECOND): New local define, and increase to nanosecond resolution if we are on a system in which this is useful and practical. (time_from_seconds_and_nanoseconds): New helper. (get_internal_real_time, get_internal_run_time): New global vars: function pointers. (get_internal_real_time_posix_timer): (get_internal_run_time_posix_timer): (get_internal_real_time_gettimeofday): (get_internal_run_time_times): (get_internal_real_time_fallback): Various implementations. (scm_get_internal_real_time): Return the get_internal_real_time() result. (scm_c_get_internal_run_time): Likewise. (scm_gettimeofday): No need for a critical section, and remove obsolete ftime block. (scm_init_stime): Init all of the new time bases, and decide on implementations of real time and run time accessors.
2011-05-04build support for detecting clock_gettime, with -lrt if neededAndy Wingo5-2/+38
* acinclude.m4 (gl_CLOCK_TIME): * configure.ac: Locally include gl_CLOCK_TIME. To be fixed properly when gnulib updates their license to reflect the actual BSD state of things. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Add -lrt for clock_gettime, if needed. * meta/guile-2.0-uninstalled.pc.in: * meta/guile-2.0.pc.in: Likewise, in Libs.private.
2011-05-02Fix call-with-input-file & relatives for multiple valuesDaniel Llorens1-27/+25
* module/ice-9/r4rs.scm (call-with-input-file, call-with-output-file): Rewrite with call-with-values. (with-input-from-file): use call-with-input-file. (with-output-to-file, with-error-to-file): use call-with-output-file. Update docstrings to make clear that multiple values may be yielded.
2011-05-01deprecate scm_struct_tableAndy Wingo6-60/+79
* libguile/goops.h: * libguile/goops.c (scm_i_define_class_for_vtable): New internal helper, defines a class for a vtable, relying on the name slot being set correctly. (scm_class_of, create_struct_classes): Use the local vtable-to-class map instead of scm_struct_table. * libguile/struct.h (SCM_STRUCT_TABLE_NAME, SCM_SET_STRUCT_TABLE_NAME) (SCM_STRUCT_TABLE_CLASS, SCM_SET_STRUCT_TABLE_CLASS, scm_struct_table) (scm_struct_create_handle): Deprecate these internals of the map between structs and classes. * libguile/deprecated.h: * libguile/deprecated.c (scm_struct_create_handle): Deprecated code over here now.
2011-05-01disallow get-handle / create-handle! of weak hash tablesAndy Wingo1-0/+29
* libguile/hashtab.c (scm_hashq_get_handle, scm_hashq_create_handle_x) (scm_hashv_get_handle, scm_hashv_create_handle_x) (scm_hash_get_handle, scm_hash_create_handle_x) (scm_hashx_get_handle, scm_hashx_create_handle_x): Don't allow these functions to be called on weak hash tables, as we have no idea when the GC will null out fields of the handle, and set-cdr! won't register disappearing links, and set-car! would never work of course.
2011-05-01(ice-9 poe) does not get handles from weak hash tablesAndy Wingo1-21/+15
* module/ice-9/poe.scm (pure-funcq, perfect-funcq): Reimplement to not use get-handle.
2011-05-01boot-9 fixme noteAndy Wingo1-0/+2
* module/ice-9/boot-9.scm (module-replace!): Add a fixme about using something other than object properties here.
2011-05-01fix scm_object_property_set_x for handles and weak tablesAndy Wingo1-12/+6
* libguile/objprop.c (scm_object_property_set_x): Use ref and set! instead of create-handle and set-cdr!, as it is a weak hash table. (scm_set_object_properties_x): Likewise.
2011-05-01deprecated primitive-properties don't get handles from weak hash tablesAndy Wingo1-19/+16
* libguile/deprecated.c (scm_primitive_property_ref) (scm_primitive_property_set_x): Avoid getting handles to elements in a weak hash table, as that's not going to work very well.
2011-05-01deprecate scm_whash APIAndy Wingo5-82/+132
* libguile/deprecated.h: * libguile/deprecated.c (scm_whash_get_handle, SCM_WHASHFOUNDP) (SCM_WHASHREF, SCM_WHASHSET, scm_whash_create_handle) (scm_whash_lookup, scm_whash_insert): Deprecate this API. * libguile/srcprop.c: * libguile/srcprop.h: * libguile/read.c (scm_read_sexp): Use the hashq API instead of the whash API.
2011-05-01fix hash-set! in weak-value table from non-immediate to immediateAndy Wingo1-7/+42
* libguile/hashtab.c (set_weak_cdr, scm_hash_fn_set_x): If we have a weak-value hash table with a previous non-immediate value for a given key, and we are setting an immediate as the new value, we were not unregistering the disappearing link. Fixed.
2011-04-29psyntax simplificationAndy Wingo1-1/+2
* module/ice-9/psyntax.scm (id-var-name): Just rely on multiple-values truncation.
2011-04-29MV truncation in the boot evaluatorAndy Wingo1-27/+58
* libguile/eval.c (truncate_values): New helper. (EVAL1): New macro, does an eval then truncates the values. (eval, prepare_boot_closure_env_for_apply) (prepare_boot_closure_env_for_eval): Use EVAL1 in appropriate places to get multiple-values truncation even here in the boot evaluator. eval.c fixen
2011-04-29latin1 strings in vm error messagesAndy Wingo1-17/+17
* libguile/vm-engine.c: Use latin1 strings here for the string literals.
2011-04-28check for iconveh values at configure-timeAndy Wingo4-12/+76
* configure.ac: Check for the iconveh values here, instead of relying on gen-scmconfig to know them. That doesn't work in general because gen-scmconfig runs on the build machine, not the target machine. * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Revert rule to the revision before 533d8212. * libguile/gen-scmconfig.h.in (SCM_I_GSC_ICONVEH_ERROR): (SCM_I_GSC_ICONVEH_QUESTION_MARK): (SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE): * libguile/gen-scmconfig.c: Use configure-time substitutions to set SCM_ICONVEH_ERROR_HANDLER et al.
2011-04-28-x error message fixAndy Wingo1-1/+1
* module/ice-9/command-line.scm (compile-shell-switches): Fix error message for -x switch.
2011-04-28fix double-loading of script in -ds caseAndy Wingo1-12/+14
* module/ice-9/command-line.scm (compile-shell-switches): In the -ds case, we were erroneously loading the script twice. Fix that.
2011-04-28fix break exampleAndy Wingo1-1/+1
* doc/ref/api-control.texi (while do): Fix a break example.
2011-04-28Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo117-2482/+3455
Conflicts: GUILE-VERSION
2011-04-28allow while as an expressionAndy Wingo3-17/+36
* module/ice-9/boot-9.scm (while): Specify the return value as #f under normal conditions, #t under (break), and arg... under (break arg...). * test-suite/tests/syntax.test ("while"): Test. * doc/ref/api-control.texi (while do): Document.
2011-04-28add reset and shiftAndy Wingo2-2/+66
* module/ice-9/control.scm (reset, shift): Add implementations of these operators from Wolfgang J Moeller, derived from implementations by Oleg Kiselyov. (reset*, shift*): Procedural variants. * test-suite/tests/control.test ("shift and reset"): Add tests, originally from Oleg Kiselyov.
2011-04-27Fix typo in `NEWS'.v2.0.1Ludovic Courtès1-1/+1
2011-04-27Bump version number for 2.0.1.Ludovic Courtès1-3/+3
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions such as `scm_c_public_ref' and `scm_from_latin1_keyword'. (LIBGUILE_INTERFACE_AGE): Increment.
2011-04-27Update `NEWS'.Ludovic Courtès1-3/+7
2011-04-27Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).Ludovic Courtès1-0/+31
Partially reverts 165b10ddfaaa8ecc72d45a9be7d29e7537dc2379 and 531c9f1dc51c4801c4d031ee80a31f15285a6b85. * module/srfi/srfi-9.scm (define-inlinable): New macro.
2011-04-27Document `(ice-9 binary-ports)'.Ludovic Courtès2-0/+5
* doc/ref/api-io.texi (R6RS I/O Ports): Mention `(ice-9 binary-ports)'. * NEWS: Update.
2011-04-27Add tests for UTF-8 ill-formed sequence handling.Ludovic Courtès1-0/+27
* test-suite/tests/ports.test ("string ports"): Add for `test-decoding-error' tests for ill-formed UTF-8 sequences. Thanks to Mark H Weaver <mhw@netris.org> for pointing this out.
2011-04-27Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'.Ludovic Courtès2-5/+23
* libguile/ports.c (get_codepoint): Return EILSEQ when OUTPUT_SIZE == 0. * test-suite/tests/ports.test ("string ports"): Add 2 tests for unterminated sequences.
2011-04-27Add a couple more Unicode I/O tests.Ludovic Courtès1-1/+11
* test-suite/tests/ports.test ("string ports")["%default-port-encoding is honored"]: Make sure `(port-encoding p)' is as expected. ["peek-char [utf-16]"]: New test.
2011-04-27Rewrite port decoding error tests using a mini DSL.Ludovic Courtès1-74/+77
* test-suite/tests/ports.test ("string ports")[test-decoding-error]: New macro. ["read-char, wrong encoding, error", "read-char, wrong encoding, escape", "read-char, wrong encoding, substitute", "peek-char, wrong encoding, error"]: Rewrite using `test-decoding-error'.
2011-04-27Gracefully handle `setlocale' errors at the REPL.Ludovic Courtès1-1/+8
* module/ice-9/top-repl.scm (top-repl): Catch exceptions from `setlocale'. Reported by CRLF0710 <crlf0710@gmail.com>.
2011-04-26Remove the `sizeof (mpz_t)' check.Ludovic Courtès1-3/+0
* libguile/numbers.c: Remove `sizeof (mpz_t)' check, which wasn't need anymore since `make_bignum' doesn't make any such assumption.
2011-04-25Use `scm_with_guile' in `test-pthread-create'.Ludovic Courtès1-5/+11
* test-suite/standalone/test-pthread-create.c (inner_main): New function. (main): Call it within `scm_with_guile', instead of using `scm_init_guile'. This improves portability--e.g., `GC_get_stack_base', used by `scm_init_guile', failed on Darwin up to BDW-GC 7.1alpha4 included (thanks, Mark, for the hint.)
2011-04-25Update Gnulib to v0.0-5158-g7d06b32; remove `strcase' and `version-etc-fsf'.Ludovic Courtès64-1251/+1361
* m4/gnulib-cache.m4: Remove `strcase' and `version-etc-fsf'. * configure.ac (POTENTIAL_GCC_CFLAGS): Remove `-Wundef'. * libguile/script.c: Don't include <version-etc.h>.
2011-04-25Fix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests.Ludovic Courtès6-6/+6
* test-suite/standalone/test-asmobs-lib.c, test-suite/standalone/test-extensions-lib.c, test-suite/standalone/test-ffi-lib.c, test-suite/standalone/test-list.c, test-suite/standalone/test-num2integral.c, test-suite/standalone/test-with-guile-module.c: Change `#ifndef HAVE_CONFIG_H' to `#ifdef HAVE_CONFIG_H' (!).