1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

15149 commits

Author SHA1 Message Date
Andy Wingo
8806b4c28a enable port locking
* libguile/ports.c (scm_c_make_port_with_encoding): Enable port
  locking.
2011-12-06 19:06:13 +01:00
Andy Wingo
f5b870d816 fix scm_adjust_port_revealed_x FUNC_NAME
* libguile/ports.c (scm_adjust_port_revealed_x): Fix FUNC_NAME.
2011-12-06 19:05:52 +01:00
Andy Wingo
c9caa6c88d fix asm-to-bytecode.test
* test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size)
  (test-target): The objcode version embedded in the cookie is not an
  effective version, so elide it from the test.
2011-12-06 18:09:02 +01:00
Andy Wingo
92c0ebac90 port locking refactor
* libguile/ports.h (struct scm_t_port): Make the lock into a pointer
  field instead of an inline field.  It should be possible to make
  unlocked ports by having a NULL lock field.
  (scm_c_lock_port, scm_c_try_lock_port): Return the mutex if the port
  was actually locked.
  (scm_c_unlock_port): Remove.

* libguile/ports.c (scm_c_make_port_with_encoding): For now, leave
  `lock' set to 0.
  Change scm_c_lock_port callers to pay attention to the new API.

* libguile/print.c (scm_write, scm_display): Fix call to
  dynwind-lock-port for ports-with-print-states.
2011-12-06 18:01:45 +01:00
Andy Wingo
679eea4f0e allow URIs of the form file:///etc/hosts
* module/web/uri.scm (parse-authority): Allow empty authorities, so that
  we accept URIs of the form, file:///etc/hosts.
* test-suite/tests/web-uri.test ("string->uri"): Add tests.
2011-12-06 11:47:41 +01:00
Andy Wingo
fe0c202c0e Update a comment in (web client)
* module/web/client.scm: Update a comment.
2011-12-06 11:46:58 +01:00
Andy Wingo
2c27dd57c7 warnings written to warning port
* libguile/deprecation.c (scm_c_issue_deprecation_warning):
* libguile/load.c (auto_compile_catch_handler):
  (scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path):
* module/ice-9/boot-9.scm (warn, %load-announce, duplicate-handlers)
  (load-in-vicinity):
* module/system/base/message.scm (warning): Write to the warning port.
  (*current-warning-port*): Alias the warning port.
2011-12-05 18:11:24 +01:00
Andy Wingo
3972de7675 add current-warning-port
* libguile/ports.h:
* libguile/ports.c (scm_current_warning_port)
  (scm_set_current_warning_port): New functions, wrapping the Scheme
  parameter.

* module/ice-9/boot-9.scm (current-warning-port): New parameter,
  defining a port for warnings.
2011-12-05 18:07:06 +01:00
Andy Wingo
13dd74c8ea setting a parameter returns the previous value
* module/ice-9/boot-9.scm (make-parameter): Setting a parameter by
  invoking it with an argument now returns the previous value.
2011-12-05 17:49:26 +01:00
Andy Wingo
90de5c4c2e add srfi-39 parameters to boot-9
* module/ice-9/boot-9.scm (<parameter>, make-parameter, parameter?)
  (parameter-fluid, parameter-converter, parameterize): New top-level
  bindings, implementing SRFI-39 parameters.  Currently,
  current-input-port and similar procedures are not yet parameters.

* test-suite/Makefile.am:
* test-suite/tests/parameters.test: Add tests, taken from srfi-39
  tests.
2011-12-05 14:25:25 +01:00
Andy Wingo
6d346bb61a ice-9/poll: verify sizeof(struct pollfd)
* libguile/poll.c (scm_init_poll): Define %sizeof-struct-pollfd.
* module/ice-9/poll.scm: Check %sizeof-struct-pollfd.
2011-12-04 22:45:03 +01:00
Andy Wingo
8500b18696 new print option escape-newlines, defaults to #t
* libguile/private-options.h (SCM_PRINT_ESCAPE_NEWLINES_P):
* libguile/print.c: Add new escape-newlines print option, defaulting to
  on.
  (write_character): For newlines, if SCM_PRINT_ESCAPE_NEWLINES_P, then
  print them as \n.
  (scm_init_print): Refactor print options initialization.
2011-12-04 22:37:27 +01:00
Andy Wingo
2aef6c2ba9 ,language at REPL sets current-language
* module/system/repl/command.scm (language): Set the
  *current-language*.
* module/system/repl/repl.scm (start-repl): Create a new dynamic scope
  for *current-language*.
2011-12-04 21:56:13 +01:00
Andy Wingo
d88f5323d1 fix `free' of mpz_to_str
* libguile/numbers.c (scm_number_to_string): Don't `free' the result of
  mpz_get_str; use the mp free function.
2011-12-02 19:18:05 +01:00
Andy Wingo
76f3ee77b0 scm_gc_register_collectable_memory calls scm_gc_register_allocation
* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Call
  scm_gc_register_allocation.
2011-12-02 19:07:21 +01:00
Andy Wingo
ea0582c283 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/guile.c
	libguile/numbers.c
2011-12-02 12:00:33 +01:00
Andy Wingo
b57bf2724a install gmp memory functions that let libgc know about allocations
* libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc,
  custom_gmp_free): New static functions used by GMP for allocation.
  These are just wrappers for scm_malloc, scm_realloc, and free.

  (scm_init_numbers): If scm_install_gmp_memory_functions is nonzero,
  use mp_set_memory_functions to configure GMP to use
  custom_gmp_{malloc,realloc,free} for memory allocation.

  (scm_bigprint): Ask gmp for the function used to deallocate the string
  returned by mpz_get_str.

* libguile/numbers.h: Declare scm_install_gmp_memory_functions.

* libguile/guile.c: When running the Guile binary, install the
  gmp_memory_functions.

Based on a patch by Mark H Weaver <mhw@netris.org>.
2011-12-02 11:57:25 +01:00
Andy Wingo
b2208d2e98 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	configure.ac
	libguile/fluids.c
	libguile/gc.c
	libguile/gc.h
	libguile/objcodes.c
	libguile/procprop.c
	libguile/vm.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
2011-12-01 23:31:50 +01:00
Andy Wingo
738c899e4c fix deadlock in before-gc-hook on certain 7.2alpha gc versions
* libguile/gc.c (scm_init_gc): Only adjust gc frequency in the gc start
  hook if we know that it won't take a lock.
2011-12-01 12:57:49 +01:00
Andy Wingo
fd51e66190 attempt to handle steady-state mallocations better
* libguile/gc-malloc.c (scm_realloc): Call the new
  scm_gc_register_allocation() here.  If we have to collect, do a
  GC_gcollect_and_unmap.

* libguile/gc.c (scm_gc_register_allocation): Add a routine to track
  steady-state mallocation, and cause gc to run if there is a high
  mallocation rate.
  (adjust_gc_frequency): Reset the bytes-until-GC countdown timer.
2011-11-29 21:36:31 +01:00
Andy Wingo
9f7537dcab collect a little in call-with-new-thread
* libguile/threads.c (scm_call_with_new_thread): Collect a little before
  making a new thread.  Our adjust_gc_frequency hack doesn't work well
  if the main allocation load is thread creation, as in
  https://savannah.gnu.org/bugs/?34140.  This does not appreciably
  affect the speed of the test in that bug, but does effectively limit
  the image size.
2011-11-29 20:26:40 +01:00
Andy Wingo
7a4eb5e5ec adjust_gc_frequency before gc, for more precision
* libguile/gc.c (scm_init_gc): Run the adjust_gc_frequency from the
  before-gc-hook, not the after-gc-hook.  More precise, this way.
2011-11-29 20:24:23 +01:00
Andy Wingo
8ac704338d fix uninitialized variable in gc.c
* libguile/gc.c (get_image_size): Fix use of uninitialized variable.
2011-11-29 13:43:52 +01:00
Andy Wingo
d1c036248c switch off debugging flag that was mistakenly left on
* libguile/gc.c (HEURISTICS_DEBUG): Whoops, switch this off.
2011-11-29 10:17:07 +01:00
Andy Wingo
6360beb28a increase garbage collection rate if the process is growing
* configure.ac: Check for GC_get_free_space_divisor.
* libguile/gc.c (GC_get_free_space_divisor): Define an implementation,
  if needed.
  (accumulate_gc_timer): Fix indentation.
  (get_image_size): New terrible hack.  Needs implementations on other
  platforms.
  (adjust_gc_frequency): Attempt to adjust the GC frequency based on
  process image growth.  Needs more comments.
  (scm_init_gc): Add the adjust_gc_frequency to the after_gc_c_hook.
2011-11-29 10:12:22 +01:00
Andy Wingo
14294ce0df get heap stats with GC_get_heap_usage_safe, if available.
* configure.ac: Check for GC_get_heap_usage_safe.
* libguile/gc.c (SCM_DEFINE): Use GC_get_heap_usage_safe.
2011-11-28 19:58:53 +01:00
Ludovic Courtès
59a0273338 FFI: Hold a weak reference to the procedure passed to `procedure->pointer'.
* libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference
  to PROC.

* test-suite/tests/foreign.test ("procedure->pointer")["procedure is
  retained"]: New test.
2011-11-26 22:27:32 +01:00
Andy Wingo
3dc9f41900 support for new GC_move_disappearing_link
* configure.ac: Check for GC_move_disappearing_link.
* libguile/weak-set.c (move_weak_entry):
* libguile/weak-table.c (move_disappearing_links):
  (move_weak_entry): Use GC_move_disappearing_link if available.
2011-11-24 11:47:36 +01:00
Andy Wingo
686022e84e remove scm_si_name_access
* libguile/goops.h (scm_si_name_access): Remove alias for
  scm_si_getters_n_setters.
2011-11-24 11:47:36 +01:00
Andy Wingo
2575157e54 remove unused <class> slot: keyword-access
* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_keyword_access):
* libguile/goops.c (build_class_class_slots): Remove unused
  keyword-access slot from classes.
2011-11-24 11:47:36 +01:00
Andy Wingo
0818837f65 deprecate make-vtable-vtable
* libguile/struct.h:
* libguile/struct.c (scm_make_vtable_vtable): Deprecate, as you can
  handle most of the use cases with make-vtable, and we don't want to
  promote the creation of new roots to the type hierarchy.
  (scm_i_make_vtable_vtable): The internal replacement.
2011-11-24 11:47:36 +01:00
Andy Wingo
5139b7b928 simplify %condition-type-vtable
* module/srfi/srfi-35.scm (%condition-type-vtable): Use make-vtable
  instead of make-vtable-vtable.
2011-11-24 11:47:36 +01:00
Andy Wingo
f7bbc75d04 record-type-vtable is not a new root of the vtable hierarchy
* module/ice-9/boot-9.scm (record-type-vtable): Simplify to use
  make-vtable instead of make-vtable-vtable.
2011-11-24 11:47:36 +01:00
Andy Wingo
fb5f79a8b0 Scheme standard-vtable-fields binding
* libguile/struct.c (scm_init_struct): Export standard-vtable-fields to
  Scheme.
2011-11-24 11:47:36 +01:00
Andy Wingo
72d4db5d04 add Scheme binding for scm_standard_vtable_vtable
* libguile/struct.c (scm_init_struct): Export <standard-vtable> to
  Scheme.
2011-11-24 11:47:36 +01:00
Andy Wingo
fbe1cb7f64 remove public scm_protects export
* libguile/gc.h:
* libguile/gc.c: Remove scm_protects from the API.  It is deprecated on
  stable-2.0.
2011-11-24 11:47:36 +01:00
Andy Wingo
2ec8da2e45 no gc_register_root in scm_init_print
* libguile/print.c (scm_init_print): No need to gc_register_root here.
2011-11-24 11:47:36 +01:00
Andy Wingo
086063aa32 remove object protection from options.c
* libguile/options.c (change_option_setting, scm_init_options): Rely on
  the options being allocated in GC-able memory, as in static memory.
  Therefore there is no need for the gc-protect dance.
2011-11-24 11:47:35 +01:00
Andy Wingo
231dd35616 simplify scm_init_print
* libguile/print.c (scm_init_print): Simplify creation of print-state
  vtable.
2011-11-24 11:47:35 +01:00
Daniel Hartwig
4855c63441 web-http.test validates headers
* test-suite/tests/web-http.test (pass-if-parse): Validate header values
  as well.
2011-11-23 23:35:20 +01:00
Daniel Hartwig
69b8c5df14 fix validators for various list-style headers
* module/web/http.scm (default-val-validator): Valid with no value.
  (key-value-list?): Keys are always symbols, do not accept strings.
  (validate-param-list): Apply `valid?' to list elements.
  (validate-credentials): Validate param for Basic scheme, which
  is parsed as a string.
  (declare-symbol-list-header!): `list-of?' args were in wrong order.
  ("Cache-Control"): Replace `default-val-validator' with more
  specific procedure.
  ("Accept"): Validate on first param which has no value.
2011-11-23 23:35:20 +01:00
Ludovic Courtès
2db1dbfe27 Update cross-compilation instructions.
* README (Cross building Guile): Update.
2011-11-23 22:19:40 +01:00
Ludovic Courtès
1c1f7a3223 configure: Make sure $GUILE_FOR_BUILD is suitable.
* acinclude.m4 (GUILE_CHECK_VERSION, GUILE_CHECK_GUILE_FOR_BUILD): New
  macros.

* configure.ac: Remove $GUILE_FOR_BUILD tests.  Use
  `GUILE_CHECK_GUILE_FOR_BUILD'.
2011-11-23 22:05:53 +01:00
Ludovic Courtès
f701287497 Allow $GUILE_FOR_BUILD to use its own environment when cross-compiling.
* am/guilec (.scm.go): Use `-L' to specify the search path.
* module/Makefile.am (ice-9/psyntax-pp.go): Likewise.

* meta/uninstalled-env.in (top_builddir): Leave $GUILE_LOAD_PATH,
  $GUILE_SYSTEM_PATH, and $GUILE_SYSTEM_EXTENSIONS_PATH unchanged when
  cross-compiling.
2011-11-23 15:29:18 +01:00
Andy Wingo
9447207f0c Use default value for make-fluid in Scheme files
* module/ice-9/boot-9.scm (%exception-handler)
  (%running-exception-handlers, read-eval?, *repl-stack*)
  (make-mutable-parameter):
* module/ice-9/getopt-long.scm (%program-name):
* module/language/elisp/runtime.scm (built-in-macro, defspecial):
* module/srfi/srfi-39.scm (make-parameter/helper):
* module/system/base/language.scm (*current-language*):
* module/system/base/message.scm (*current-warning-port*):
  (*current-warning-prefix*):
* module/system/base/target.scm (%target-type, %target-endianness)
  (%target-word-size):
* module/texinfo/plain-text.scm (*indent*, *itemizer*):
* benchmark-suite/lib.scm (prefix-fluid):
* test-suite/lib.scm (prefix-fluid): Give fluids a useful default
  value.
2011-11-23 12:54:09 +01:00
Andy Wingo
c81c2ad3a5 use new scm_make_fluid_with_default
* libguile/load.c (scm_init_load):
* libguile/ports.c (scm_init_ports):
* libguile/read.c (scm_init_read): Use scm_make_fluid_with_default.
2011-11-23 12:54:09 +01:00
Andy Wingo
aafb4ed724 optional default-value arg to make-fluid
* libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the
  default value in the dynamic-state vector to be SCM_UNDEFINED instead
  of SCM_BOOL_F.  If the value in the dynamic-state is #f, default to a
  value attached to the fluid instead.  This allows useful default
  values.
  (scm_make_fluid_with_default): New function, allows the user to
  specify a default value for the fluid.  Defaults to #f.  Bound to
  `make-fluid' on the Scheme side.
  (scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all
  threads.
  (scm_fluid_unset_x): Also unset the default value.  Not sure if this
  is the right thing.
  (fluid_ref): Update to the new default-value strategy.

* libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED.
* libguile/threads.h: Remove extra arg to scm_i_reset_fluid.
* libguile/vm-i-system.c (fluid-ref): Update to new default-value
  strategy.

* module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all
  threads.  Fixes http://debbugs.gnu.org/10093.
2011-11-23 12:53:38 +01:00
BT Templeton
6937c7aa8b load boot.el
* am/guilec: Add support for compiling Elisp files.
* module/Makefile.am: New variable ELISP_SOURCES.
* module/language/elisp/boot.el: New file.
* module/language/elisp/spec.scm: Load boot.el.
2011-11-22 15:06:12 -05:00
BT Templeton
5d351f0b9b remove void-checking cruft
* module/language/elisp/compile-tree-il.scm: Don't export
  `compile-without-void-checks', which was removed. Remove unused
  `disable-void-check' variable. Update comments.
2011-11-22 15:04:12 -05:00
Ludovic Courtès
bb9b357e2b Install the current locale when Guile is invoked directly.
* libguile/guile.c (main): Add `setlocale' call.
2011-11-22 12:11:48 +01:00