1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00
Commit graph

8144 commits

Author SHA1 Message Date
Mark H Weaver
b6203a189b Increment SCM_N_READ_OPTIONS for 'curly-infix' option.
* libguile/private-options.h (SCM_N_READ_OPTIONS): Increment to 8.
  This should have been done when the 'curly-infix' was added.
2014-01-08 20:56:56 -05:00
Ludovic Courtès
032a16fced Hide EINTR returns from 'accept'.
* libguile/socket.c (scm_accept): Wrap 'accept' call in 'SCM_SYSCALL'.
2013-12-15 22:48:41 +01:00
Mark H Weaver
61989c7053 Merge branch 'stable-2.0'
Conflicts:
	libguile/pairs.c
	libguile/vm.c
	test-suite/tests/control.test
2013-12-12 23:44:46 -05:00
Tom Tromey
e0096e4798 Remove unused function scm_i_tag_name.
* libguile/gc.c (scm_i_tag_name): Remove.
2013-12-12 23:39:31 -05:00
Tom Tromey
97dd74c00e Add missing FUNC_NAME defines for pair accessors.
* libguile/pairs.c (scm_car, scm_cdr, scm_caar, scm_cadr, scm_cdar,
  scm_cddr, scm_caaar, scm_caadr, scm_cadar, scm_caddr, scm_cdaar,
  scm_cdadr, scm_cddar, scm_cdddr, scm_caaaar, scm_caaadr, scm_caadar,
  scm_caaddr, scm_cadaar, scm_cadadr, scm_caddar, scm_cadddr,
  scm_cdaaar, scm_cdaadr, scm_cdadar, scm_cdaddr, scm_cddaar,
  scm_cddadr, scm_cdddar, scm_cddddr): Add missing FUNC_NAME defines.
2013-12-12 21:53:01 -05:00
Ludovic Courtès
70057f3408 vm: Gracefully handle stack overflows.
Fixes <http://lists.gnu.org/archive/html/guile-user/2013-12/msg00017.html>.
Reported by rvclayton@verizon.net (R. Clayton).

* libguile/vm.c (reinstate_stack_reserve): New function.
  (vm_error_stack_overflow): Install it as an unwind handler.
* test-suite/tests/control.test ("the-vm")["stack overflow reinstates
  stack reserve"]: New test.
2013-12-05 22:19:01 +01:00
Mark H Weaver
79657fd3ec Thread safe port properties.
* libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x):
  Lock the port mutex while accessing the port alist.

* libguile/read.c (set_port_read_option): Lock the port mutex
  while modifying port read options.
2013-12-01 18:34:30 -05:00
Andy Wingo
ddf0d7bb2e Fix more vm-engine comments
* libguile/vm-engine.c: Fix more comments.
2013-11-30 18:46:14 +01:00
Andy Wingo
2b6659e438 Remove slot-ref and slot-set! ops
* libguile/vm-engine.c: Remove slot-ref and slot-set! ops.
2013-11-30 18:46:14 +01:00
Andy Wingo
02f9d49614 Fix vm-engine.c comments
* libguile/vm-engine.c: Fix some comments.
2013-11-30 18:46:14 +01:00
Andy Wingo
d511a2e160 Merge remote-tracking branch 'origin/stable-2.0' 2013-11-28 16:24:38 +01:00
Andy Wingo
8f0ecae98c Critical sections in guardians do not need to block asyncs
* libguile/guardians.c: Critical sections here cannot cause an
  async_tick, so they do not need to block asyncs.
2013-11-28 16:20:42 +01:00
Andy Wingo
fcd953f699 Merge commit 'd364a89718'
Conflicts:
	libguile/deprecated.h
	libguile/gc.c
2013-11-28 16:16:48 +01:00
Andy Wingo
9b95f3ced4 Merge commit 'a38024baaa'
Conflicts:
	libguile/ports.h
2013-11-28 16:15:38 +01:00
Andy Wingo
6683f204ba Merge commit '2437c7b2e8'
Conflicts:
	libguile/guardians.c
2013-11-28 16:03:58 +01:00
Andy Wingo
f76cf73a49 Merge commit '8571dbde63'
Conflicts:
	libguile/procprop.c
2013-11-28 15:00:17 +01:00
Andy Wingo
6dd9810902 Merge commit '750ac8c592'
Conflicts:
	.gitignore
	libguile/deprecated.c
2013-11-28 14:53:03 +01:00
Andy Wingo
091dd0cc58 Merge commit 'd360671c1c' 2013-11-28 14:46:24 +01:00
Andy Wingo
d364a89718 Deprecate gc-live-object-stats
* libguile/gc.h:
* libguile/gc.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_gc_live_object_stats): Deprecate; it hasn't
  worked in the whole 2.0 series.
2013-11-28 14:40:58 +01:00
Andy Wingo
553294d958 Avoid needless GC on startup due to scm_gc_register_allocation
* libguile/gc.c (bytes_until_gc): Initialize to
  DEFAULT_INITIAL_HEAP_SIZE, to avoid forced GC on the first
  mallocation.
2013-11-28 12:10:50 +01:00
Andy Wingo
87fc4596e5 Remove private-gc.h
* libguile/simpos.c (scm_getenv_int): Move here, from gc.c.

* libguile/private-gc.h: Remove, unused.

* libguile/simpos.h: Move scm_getenv_int declaration here.

* libguile/vm.c:
* libguile/gc.c: Adapt scm_getenv_int users.

* libguile/gc-malloc.c:
* libguile/load.c:
* libguile/script.c: Remove private-gc includes from non-users of
  scm_getenv_int.

* libguile/Makefile.am: Adapt.
2013-11-28 11:53:57 +01:00
Andy Wingo
35164d84e0 scm_i_tag_name internal to gc.c
* libguile/gc.c (scm_i_tag_name): Make internal to gc.c.

* libguile/private-gc.h: Remove from here.
2013-11-28 11:46:13 +01:00
Andy Wingo
5a706f0342 More private-gc excisions
* libguile/private-gc.h (SCM_DOUBLECELL_ALIGNED_P): Remove; unused.
* libguile/filesys.c (MAX, MIN): Move definitions here, from
  private-gc.h.
  (scm_sendfile, scm_readdir): Adapt uses of SCM_MAX and SCM_MIN to use
  MAX or MIN.
2013-11-28 11:43:51 +01:00
Andy Wingo
8d78304e4d Remove unused enum policy_on_error
* libguile/private-gc.h (enum policy_on_error): Remove unused enum.
2013-11-28 11:37:29 +01:00
Andy Wingo
064d24093b Tune initial heap size
* libguile/fluids.c (new_fluid): Don't run an explicit GC for the first
  fluid.

* libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE, scm_storage_prehistory):
  Enlarge from 32 kB to 512 or 1024 kB, depending on word size.  Reduces
  startup time by 10 or 15% by avoiding excessive
  GC.

* libguile/private-gc.h: Remove SCM_DEFAULT_INIT_HEAP_SIZE_2 definition
  here.
2013-11-28 11:32:08 +01:00
Andy Wingo
a0a4d859c4 Remove another GC 6.8 hack
* libguile/gc.c (scm_storage_prehistory): Remove hack for BDW-GC 6.8.
2013-11-28 11:05:38 +01:00
Andy Wingo
a5d0c135c0 Remove nonfunctional gdb interface
* libguile/gdb_interface.h:
* libguile/gdbint.c:
* libguile/gdbint.h: Remove.  These were last modified significantly in
  1997 and I think they are unused.

* libguile/guile.c: Remove use.
* libguile.h: Remove inclusion.
* libguile/Makefile.am: Remove reference.
* libguile/init.c: Remove use.
2013-11-27 22:31:00 +01:00
Andy Wingo
f689dd6982 Remove the restore-continuation-hook.
* libguile/vm.h:
* libguile/vm.c:
* libguile/vm-engine.c:
* module/system/vm/traps.scm:
* module/system/vm/vm.scm: Remove the unused and redundant
  restore-continuation-hook.
2013-11-27 22:03:58 +01:00
Andy Wingo
36cc0b901c Declare r6rs-ports functions
* libguile/r6rs-ports.h:
* libguile/r6rs-ports.c: Declare scm_unget_bytevector and
  scm_i_make_transcoded_port.
2013-11-27 21:13:20 +01:00
Andy Wingo
fe8935d432 Fix uninitialized variable error in some peek-char error cases
* libguile/ports.c (scm_peek_char): Don't require error cases to
  set *len.  Fixes a bug caught by GCC whereby an EOF while reading a
  multibyte character with iconv would leave len uninitialized.
2013-11-27 19:50:13 +01:00
Andy Wingo
6a9d9e3a62 Declare scm_i_open_file to silence a warning
* libguile/fports.c (scm_i_open_file): Declare.
2013-11-27 19:36:46 +01:00
Andy Wingo
05326efbb1 Remove generalized vector interface; deprecated in 2.0 already.
* libguile/deprecated.c: Remove the generalized-vector interface,
  deprecated since 2.0.8.
2013-11-27 19:31:09 +01:00
Andy Wingo
84800dffc2 Declare scm_nil_p
* libguile/boolean.h: Declare scm_nil_p.
2013-11-27 19:30:18 +01:00
Mark H Weaver
a38024baaa Make port properties accessible from Scheme.
* libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
  (scm_i_port_property, scm_i_set_port_property_x): New procedures,
  available from Scheme as '%port-property' and '%set-port-property!'.

* libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
  (scm_i_port_property, scm_i_set_port_property_x): New prototypes.

* libguile/read.c (set_port_read_option, init_read_options): Adapt to
  use scm_i_port_property and scm_i_set_port_property_x.
2013-11-23 15:47:31 -05:00
Mark H Weaver
2437c7b2e8 Make guardians thread-safe.
* libguile/guardians.c (t_guardian): Add mutex.
  (finalize_guarded, scm_i_guard, scm_i_get_one_zombie): Lock mutex and
  block system asyncs during critical sections.
  (scm_make_guardian): Initialize mutex.
2013-11-23 14:48:12 -05:00
Mark H Weaver
8571dbde63 Block system asyncs while 'overrides_lock' is held.
* libguile/procprop.c (scm_set_procedure_property_x): Block system
  asyncs while overrides_lock is held.  Use dynwind block in case
  an exception is thrown.
2013-11-23 14:48:00 -05:00
Mark H Weaver
e676a4c342 Add mutex locking functions that also block asyncs.
* libguile/async.h (scm_i_pthread_mutex_lock_block_asyncs,
  scm_i_pthread_mutex_unlock_unblock_asyncs): New macros.

* libguile/threads.c (do_unlock_with_asyncs): New static helper.
  (scm_i_dynwind_pthread_mutex_lock_block_asyncs): New function.

* libguile/threads.h (scm_i_dynwind_pthread_mutex_lock_block_asyncs):
  Add prototype.
2013-11-23 14:39:51 -05:00
Andy Wingo
22d425ec55 Expandable stacks.
* libguile/vm-engine.c (CHECK_OVERFLOW): Call vm_expand_stack, not
  vm_error_stack_overflow.
* libguile/vm.c (hard_max_stack_size, default_max_stack_size): Recast
  #defines as locals.  Have both hard and soft stack limits.
  (initialize_default_stack_size): Set soft stack limit from
  GUILE_STACK_SIZE.
  (expand_stack, vm_expand_stack): Support for expanding stacks as
  needed.  Whee!
  (make_vm): Adapt limits.
  (scm_call_n): Expand stack if needed.

* libguile/vm.h (struct scm_vm): Add max_stack_size member.
2013-11-22 18:45:01 +01:00
Andy Wingo
4a1ce0169d VM copes with moving FP
* libguile/_scm.h (SCM_ASYNC_TICK_WITH_GUARD_CODE): New macro.
* libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Restore FP after
  ticking.
  (CACHE_FP): New macro.
  (CHECK_OVERFLOW): Use CACHE_FP.
  (BR_ARITHMETIC, RETURN_EXP, RETURN_ONE_VALUE, BINARY_INTEGER_OP):
  (call, return-values, subr-call, foreign-call)
  (resolve, define!, toplevel-box, module-box): Restore the FP from the
  vp where needed.
2013-11-22 18:44:33 +01:00
Andy Wingo
56280be983 Simplify state sync in VM before potential bailout.
* libguile/vm-engine.c (SYNC_IP): Remove calls to SYNC_BEFORE_GC, a
  no-op.  Replace SYNC_REGISTER / SYNC_ALL calls with just SYNC_IP.
2013-11-22 18:44:31 +01:00
Andy Wingo
1cdf9b788e More precise stack marking.
* libguile/vm.c (scm_i_vm_mark_stack): Mark the stack more precisely.
2013-11-22 15:02:17 +01:00
Andy Wingo
5f18bc8450 Allocate stacks using mmap, and mark them via the thread marker
* libguile/threads.c (thread_mark): Mark the VM stack, if we have one.
  (on_thread_exit): Free the VM stack here.

* libguile/vm.c (make_vm): Allocate the VM stack using mmap, and arrange
  for it to be marked by the thread marker.
  (scm_i_vm_mark_stack, scm_i_vm_free_stack): New internal interfaces.
  (allocate_stack, free_stack): New helpers.
2013-11-22 14:41:19 +01:00
Andy Wingo
7af0c3b395 Add thread mark procedure
* libguile/threads.c (thread_mark): A mark procedure for threads.
  Eventually will mark the stack.
  (guilify_self_1): Move initialization of VP earlier.  Allocate thread
  using thread_gc_kind.
  (scm_threads_prehistory): Initialize thread_gc_kind.
2013-11-22 13:01:53 +01:00
Andy Wingo
9ebf794607 Remove unused scm_i_thread fields
* libguile/threads.h (scm_i_thread):
* libguile/threads.c (guilify_self_1): Remove unused mark stack fields.
2013-11-22 10:59:14 +01:00
Andy Wingo
03d1294977 Remove tests and shims for pre-7.2 bdw-gc.
* configure.ac: Remove checks for symbols present in bdw-gc 7.2.

* libguile/finalizers.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/guardians.c:
* libguile/scmsigs.c:
* libguile/threads.c: Remove shims.
2013-11-22 10:51:56 +01:00
Andy Wingo
d86682ba2c Add explicit nopcodes
* libguile/vm-engine.c (VM_NAME): Add explicit nopcodes, later to be
  interspersed with others.  This will allow us some extensibility
  without always shuffling around opcodes.  Also avoid lazy
  initialization; have the linker do it for us.

* libguile/instructions.c (parse_instruction):
  (scm_instruction_list): Rework instruction parsing to avoid using
  malloc.  It would seem that this would fix some GC issue -- but who
  knows!
2013-11-21 22:51:38 +01:00
Andy Wingo
dd1c7deccc Setjmp before calling into the VM
* libguile/vm-engine.c (CACHE_REGISTER): Remove an unneeded cast.
  (VM_NAME):
* libguile/vm.c (scm_call_n): Setjmp out here.  This leaves the VM
  without any initialization work to do.  It also makes it possible to
  restart the VM in another mode (with hooks, for example).
2013-11-21 21:15:58 +01:00
Andy Wingo
bd63e5b2c3 scm_call_n sets up boot continuation frame for VM
* libguile/vm-engine.c:
* libguile/vm.c (scm_call_n): Move boot continuation setup to
  scm_call_n, so that vm-engine takes all of its state from the vp.
2013-11-21 19:05:43 +01:00
Andy Wingo
b85cd20f80 scm_call_n avoids double TLS lookup
* libguile/vm-engine.c (VM_NAME): Take the current thread as an
  argument.
* libguile/vm.c (scm_i_capture_current_stack): Call thread_vm.
  (thread_vm): New helper.
  (scm_the_vm): Call thread_vm.
  (scm_call_n): Call thread_vm.  Avoids a double TLS lookup.
2013-11-21 18:50:12 +01:00
Andy Wingo
350930756c Remove scm_tc7_vm
* libguile/tags.h (scm_tc7_vm): Return to pool.

* libguile/goops.c:
* libguile/gc.c (scm_i_tag_name):
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/print.c (iprin1): Remove tc7_vm things.

* libguile/vm.h (scm_the_vm_fluid): Remove stray declaration.  Remove
  SCM_VM_P.  Remove SCM_VM_DATA.  Remove SCM_VALIDATE_VM.
* libguile/vm.c (scm_i_vm_print): Remove.
2013-11-21 18:39:21 +01:00