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

7877 commits

Author SHA1 Message Date
Daniel Llorens
aaeb4e5bfb Don't use scm_is_generalized_vector in shared-array-root
* libguile/arrays.c: (scm_shared_array_root): replace check for
  scm_is_generalized_vector.
2014-01-27 21:45:17 +01:00
Daniel Llorens
951ce0f413 Remove unnecessary conditions in array constructors
* libguile/arrays.c: (scm_make_type_array, scm_from_contigous_typed_array,
  scm_from_contigous_array): Remove conditions known to be true.
2014-01-27 21:45:17 +01:00
Daniel Llorens
0362859c28 Remove generalized-vectors.h includes
* libguile/srfi-4.c, libguile/uniform.h: ditto.
2014-01-27 21:45:17 +01:00
Daniel Llorens
000d4fb3a5 Replace scm_c_generalized_vector_length in arrays.c
* libguile/arrays.c: (scm_array_contents, scm_make_shared_array):
  arrays are known of rank 1 so replace by scm_c_array_length.
2014-01-27 21:45:17 +01:00
Daniel Llorens
5a4f40f903 Replace scm_c_generalized_vector_length in random.c
* libguile/random.c: (random:solid-sphere!): array is of known
  rank 1, so use scm_c_array_length() instead.
2014-01-27 21:45:17 +01:00
Daniel Llorens
b370eedc5e Don't use generalized-vector in array-map.c (II)
* libguile/array-map.c
  - replace scm_is_generalized_vector by scm_is_array && !SCM_I_ARRAY_P.
  - replace scm_c_generalized_vector_length by scm_c_array_length.
  - remove header.
2014-01-27 21:45:17 +01:00
Daniel Llorens
ad93aa0195 Don't use generalized-vector in array-map.c (I)
* array-map.c: (AREF, ASET): new internal functions replace
  scm_c_generalized_vector_ref/set. These remove a redundant check for
  rank in the generalized_vector set.
2014-01-27 21:45:17 +01:00
Daniel Llorens
4569bbf7f6 Don't use generalized-vector functions in uniform.c
* libguile/uniform.c
  - (scm_is_uniform_vector): replace scm_is_generalized_vector and
    scm_generalized_vector_get_handle by scm_is_array and manual rank check.
  - (scm_c_uniform_vector_length): inline length computation. This
    removes a redundant rank check.
  - (scm_c_uniform_vector_ref): inline impl->vref use. This removes
    a redundant rank check.
  - (scm_c_uniform_vector_set): inline impl->vset use. This removes
    a redundant rank check.
  - (scm_uniform_vector_writable_elements): replace
    scm_generalized_vector_get_handle by scm_array_get_handle.

* test-suite/test/arrays.test
  - rename uniform-vector-ref block to uniform-vector.
  - exercise uniform-vector-length and shared arrays remaining uniform.
2014-01-27 21:45:17 +01:00
Daniel Llorens
07f4a9151e Inline generalized-vector calls in array_handle_ref/set
* libguile/arrays.c: (array-handle-ref, array-handle-set): Ditto.
2014-01-27 21:45:17 +01:00
Andy Wingo
02c624fc09 More precise stack marking via .guile.frame-maps section
* module/language/cps/slot-allocation.scm (lookup-dead-slot-map)
  (allocate-slots): For each non-tail call in a function, compute the
  set of slots that are dead after the function has begun the call.

* module/language/cps/compile-bytecode.scm (compile-fun): Emit the
  `dead-slot-map' macro instruction for non-tail calls.

* module/system/vm/assembler.scm (<asm>): Add `dead-slot-maps' member.
  (dead-slot-map): New macro-instruction.
  (link-frame-maps, link-dynamic-section, link-objects): Write dead
  slots information into .guile.frame-maps sections of ELF files.
* module/system/vm/elf.scm (DT_GUILE_FRAME_MAPS): New definition.

* libguile/loader.h:
* libguile/loader.c (DT_GUILE_FRAME_MAPS, process_dynamic_segment):
  (load_thunk_from_memory, register_elf): Arrange to parse
  DT_GUILE_FRAME_MAPS out of the dynamic section.
  (find_mapped_elf_image_unlocked, find_mapped_elf_image): New helpers.
  (scm_find_mapped_elf_image): Refactor.
  (scm_find_dead_slot_map_unlocked): New interface.

* libguile/vm.c (scm_i_vm_mark_stack): Mark the hottest frame
  conservatively, as before.  Otherwise use the dead slots map, if
  available, to avoid marking data that isn't live.
2014-01-26 20:55:04 +01:00
Mark H Weaver
ba578eb044 Merge branch 'stable-2.0'
Conflicts:
	libguile/read.c
	test-suite/tests/web-response.test
2014-01-21 03:57:04 -05:00
Mark H Weaver
a9eca8f5d1 Fix (port-conversion-strategy #f).
Reported by Doug Evans <xdje42@gmail.com>.

* libguile/ports.c (scm_port_conversion_strategy): Don't validate
  that 'port' is an open port until after the (port == #f) case
  has been handled.
2014-01-20 17:15:53 -05:00
Ludovic Courtès
3ff8a9d6ff Arrange so that 'file-encoding' does not truncate the encoding name.
Fixes <http://bugs.gnu.org/16463>.
Reported by Sree Harsha Totakura <sreeharsha@totakura.in>.

* libguile/read.c (ENCODING_NAME_MAX_SIZE): New macro.
  (SCM_ENCODING_SEARCH_SIZE): Change to 500 + ENCODING_NAME_MAX_SIZE.
  (scm_i_scan_for_encoding): Return NULL if there's less than
  ENCODING_NAME_MAX_SIZE bytes once "coding: *" has been read.
* test-suite/tests/coding.test ("line
  comment")["http://bugs.gnu.org/16463"]: New test.
2014-01-17 18:18:41 +01:00
Ludovic Courtès
6df0322212 Custom binary input ports sanity-check the return value of 'read!'.
* libguile/r6rs-ports.c (cbip_fill_input): Throw an exception when
  C_OCTETS is greater than what was requested.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port 'read!' returns too much"]: New test.
2014-01-15 23:41:49 +01:00
Mark H Weaver
fb484fefeb Merge branch 'stable-2.0' 2014-01-14 23:53:08 -05:00
Mark H Weaver
1fc651e3a5 print: In R7RS |...| symbols, print most graphic characters unescaped.
* libguile/print.c (print_r7rs_extended_symbol): Print any unicode
  graphic character other than '|' or '\' unescaped.  Escape any spacing
  character other than ASCII space.
2014-01-14 23:46:45 -05:00
Mark H Weaver
c92ee2b38c Merge branch 'stable-2.0'
Conflicts:
	libguile/print.c
	libguile/read.c
	test-suite/tests/print.test
2014-01-14 22:23:39 -05:00
Mark H Weaver
6e504a7b44 print: Support R7RS |...| symbol notation.
* libguile/print.c (scm_print_opts): Add 'r7rs-symbols' print option.
  (symbol_has_extended_read_syntax): If the 'r7rs-symbols' option is
  enabled, then disallow '|' and '\' from bare symbols.
  (print_extended_symbol): Use 'scm_lfwrite' and 'scm_putc' instead of
  'display_string' and 'display_character' when printing ASCII literals.
  (print_r7rs_extended_symbol): New static function.
  (scm_i_print_symbol_name): If the 'r7rs-symbols' option is enabled,
  use 'print_r7rs_extended_symbol' instead of 'print_extended_symbol'.

* libguile/private-options.h (SCM_PRINT_R7RS_SYMBOLS_P): New macro.
  (SCM_N_PRINT_OPTIONS): Increment.

* doc/ref/api-evaluation.texi (Scheme Write): Mention 'r7rs-symbols'
  print option.

* test-suite/tests/print.test ("write"): Add tests.
2014-01-14 20:30:24 -05:00
Mark H Weaver
dc59631d30 read: Support R7RS |...| symbol notation.
* libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro.
  (SCM_N_READ_OPTIONS): Increment.

* libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'.
  (t_read_opts): Add field for 'r7rs_symbols_p'.
  (scm_read_string_like_syntax): New function based on earlier
  'scm_read_string' that handles either string literals or R7RS quoted
  symbols (delimited by vertical bars), depending on the value of 'chr'.
  (scm_read_string): Reimplement based on 'scm_read_string_like_syntax'.
  (scm_read_r7rs_symbol): New static function.

* doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS
  symbol syntax, mention the 'r7rs-symbols' read option, and give some
  examples.

* doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols'
  read option.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 20:23:21 -05:00
Mark H Weaver
cb8aaef4d0 Merge branch 'stable-2.0'
Conflicts:
	libguile/chars.c
	libguile/read.c
	test-suite/tests/reader.test
2014-01-14 03:18:34 -05:00
Mark H Weaver
0fc548287e read: use 'c_tolower' instead of 'tolower' in 'try_read_ci_chars'.
* libguile/read.c: Include <c-ctype.h>.
  (try_read_ci_chars): Use 'c_tolower' instead of 'tolower'.
2014-01-14 03:13:58 -05:00
Mark H Weaver
394449d5d3 Recognize 'escape' character name, per R7RS.
* libguile/chars.c (scm_r7rs_charnames, scm_r7rs_charnums):
  New static constants.
  (SCM_N_R7RS_CHARNAMES): New macro.
  (scm_i_charname, scm_i_charname_to_char): Adapt to new R7RS
  char names.

* doc/ref/api-data.texi (Characters): Document #\escape.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 02:24:44 -05:00
Mark H Weaver
6579c3308d read: Accept "\|" in string literals.
* libguile/read.c (scm_read_string): Accept "\|" in string literals.

* doc/ref/api-data.texi (String Syntax): Add "\|" to the list of
  supported backslash escapes.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 02:24:37 -05:00
Mark H Weaver
7a329029cf read: Support R7RS '#true' and '#false' syntax for booleans.
* libguile/read.c (try_read_ci_chars): New static function.
  (scm_read_boolean, scm_read_array): Use 'try_read_ci_chars'.

* doc/ref/api-data.texi (Booleans): Update docs.

* test-suite/tests/reader.test ("reading"): Add tests.
2014-01-14 02:24:24 -05:00
Mark H Weaver
b958141cdb Merge branch 'stable-2.0'
Conflicts:
	libguile/hash.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	test-suite/tests/r6rs-ports.test
2014-01-14 01:30:56 -05:00
Ludovic Courtès
c9d55a7e4e 'port-position' works on CBIPs that do not support 'set-port-position!'.
* libguile/r6rs-ports.c (cbp_seek)[WHENCE == SEEK_CUR]: Break out of the
  switch statement when OFFSET is zero.
  Pass 'scm_wrong_type_arg_msg' a phrase suitable for use after
  "expecting".
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port supports `port-position', not `set-port-position!'"]: New
  test.
2014-01-13 23:16:13 +01:00
Mark H Weaver
63d869e74c Fix hashing of empty vectors.
Fixes a bug introduced in cc1cd04f81
"Fix hashing of vectors to run in bounded time."

* libguile/hash.c (scm_hasher): Avoid division by zero.

* test-suite/tests/hash.test ("hash"): Add tests.
2014-01-12 07:38:04 -05:00
Mark H Weaver
cc1cd04f81 Fix hashing of vectors to run in bounded time.
* libguile/hash.c (SCM_MIN): New macro.
  (scm_hasher): In vector case, do nothing if d is 0.  Make sure to
  recurse with a reduced d.  Move the loop out of the 'if'.
2014-01-12 02:57:41 -05:00
Mark H Weaver
1df515a077 Merge branch 'stable-2.0'
Conflicts:
	module/system/vm/traps.scm
	test-suite/tests/peval.test
2014-01-09 02:52:34 -05:00
Mark H Weaver
793e8a9317 Fix 'string-copy!' to work properly with overlapping src/dest.
* libguile/srfi-13.c (scm_string_copy_x): Fix to work properly with
  overlapping src/dest.

* test-suite/tests/srfi-13.test ("string-copy!"): Add tests.
2014-01-08 21:42:24 -05:00
Mark H Weaver
900a897cd3 Implement 'exact-integer?' and 'scm_is_exact_integer'.
* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer):
  New procedures.
  (scm_integer_p): Improve docstring.

* libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer):
  New prototypes.

* doc/ref/api-data.texi (Integers): Add docs.

* test-suite/tests/numbers.test ("exact-integer?"): Add tests.
2014-01-08 21:42:16 -05:00
Mark H Weaver
4101d14f2e scm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.
* libguile/load.c (scm_primitive_load): Use
  'scm_open_file_with_encoding'.
2014-01-08 20:57:21 -05:00
Mark H Weaver
a662686a25 read: Avoid signed integer overflow in 'read_decimal_integer'.
* libguile/read.c (read_decimal_integer): Avoid overflow.
2014-01-08 20:57:04 -05:00
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