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

1855 commits

Author SHA1 Message Date
Mike Gran
f5b362586d Check for working profiling and virtual itimers
* configure.ac (HAVE_USABLE_GETITIMER_PROF, HAVE_USABLE_GETITIMER_VIRTUAL): new tests
* doc/ref/posix.texi (setitimer, getitimer): document provided? 'ITIMER_VIRTUAL and 'ITIMER_PROF
* doc/ref/statprof.texi (statprof): document ITIMER_PROF requirements
* libguile/scmsigs.c (scm_setitimer, scm_getitimer): document (provided? 'ITIMER_VIRTUAL) and (provided? 'ITIMER_READ)
  (scm_init_scmsigs): add features ITIMER_VIRTUAL and ITIMER_PROF
* test-suite/tests/asyncs.test ("prevention via sigprof"): throw when unsupported
* test-suite/tests/signals.test: throw when not supported
* test-suite/tests/statprof.test: throw when not supported
2017-03-06 23:08:25 -08:00
Mike Gran
4ce31fd387 Can't recursively search DLLs with FFI on Cygwin
* doc/ref/api-foreign.text (dynamic-link): document problems with recursive DLLs.
* test-suite/standalone/test-ffi (global): with Cygwin, dynamic-link C library explicitly
* test-suite/standalone/test-foreign-object-scm (libc-ptr): with Cygwin, link C library explicitly
* test-suite/tests/foreign.test (qsort): with Cygwin, link C library explicitly
2017-03-05 12:45:54 -08:00
Mike Gran
efd6e3f40c Disable Turkish locale tests on Cygwin
Cygwin's support of Turkish casing rules is broken.

* test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): modified
2017-03-04 16:42:32 -08:00
Ludovic Courtès
de5cf50aba i18n: 'number->locale-string' guesses the minimum number of decimals.
This feature was removed by 4aead68cdb.

* module/ice-9/i18n.scm (number-decimal-string): Rewrite the case where
DIGIT-COUNT is not an integer.
(number->locale-string): Always pass FRACTION-DIGITS to
'number-decimal-string'.
* test-suite/tests/format.test ("~h localized number")["1234.5"]
["padding", "padchar"]: Remove decimal specifier.
* test-suite/tests/i18n.test ("number->locale-string")
["fraction",
* test-suite/tests/i18n.test ("format ~h")["12 345,678"]: Remove decimal
specifier.  Remove one decimal.
* doc/ref/api-i18n.texi (Number Input and Output): Update
'number->locale-string' doc to mention the number of decimals.
2017-03-01 21:16:49 +01:00
Ludovic Courtès
4c7d1a64fa i18n: Fix corner cases for monetary and number string conversions.
Fixes <http://bugs.gnu.org/24990>.
Reported by Martin Michel <dev@famic.de>.

* module/ice-9/i18n.scm (integer->string, number-decimal-string): New
procedures.
(monetary-amount->locale-string): Use them instead of 'number->string'
followed by 'string-split'.
(number->locale-string): Likewise.
* test-suite/tests/i18n.test ("number->locale-string")["fraction"]: Add
second argument to 'number->locale-string'.
["fraction, 1 digit"]: Round up.
["fraction, 10 digits", "trailing zeros", "negative integer"]: New
tests.
* test-suite/tests/i18n.test ("format ~h"): Pass the number of decimals
for ~h.
("monetary-amount->locale-string")["French"]: Always expect two decimals
after the comma.
["one cent", "very little money"]: New tests.
* test-suite/tests/format.test ("~h localized number")["1234.5"]:
Specify the number of decimals explicitly.
["padding"]: Expect zero decimals.
["padchar"]: Ask for one decimal.
["decimals", "locale"]: Adjust rounding.
2017-03-01 21:16:25 +01:00
Ludovic Courtès
585bf83871 tests: Choose a more plausible US English locale name.
* test-suite/tests/i18n.test (%american-english-locale-name): Change to
en_US.utf8".
2017-03-01 21:05:01 +01:00
Ludovic Courtès
47236c2476 tests: Use 'pass-if-equal' for (ice-9 i18n) tests.
* test-suite/tests/i18n.test ("number->locale-string")
("format ~h", "monetary-amount->locale-string"): Use 'pass-if-equal'
instead of 'pass-if'.
2017-03-01 21:04:50 +01:00
Ludovic Courtès
19d274c680 i18n: Do not represent zero as "-0".
Partly fixes <http://bugs.gnu.org/24990>.
Reported by Martin Michel <dev@famic.de>.

* module/ice-9/i18n.scm (monetary-amount->locale-string): Don't negate
AMOUNT when it's zero.
(number->locale-string): Likewise.
* test-suite/tests/i18n.test ("number->locale-string")["positive inexact
zero, 1 digit"]: New test.
("monetary-amount->locale-string")["positive inexact zero"]: New test.
2017-03-01 21:04:42 +01:00
Ludovic Courtès
109d221650 tests: Avoid statprof test failure on systems without 'setitimer'.
Partly fixes <http://bugs.gnu.org/25463>.
Reported by rennes@openmailbox.org.

* test-suite/tests/statprof.test ("return values"): Wrap in
'when-implemented'.
2017-03-01 20:59:55 +01:00
Andy Wingo
33944f6607 Disable REPL server tests if no threads
* test-suite/tests/00-repl-server.test (call-with-repl-server): The REPL
  server needs threads so don't bother testing if we have no threads.
  Also, prevent SIGPIPE from killing the parent process.
2017-03-01 20:18:03 +01:00
Ludovic Courtès
c1581fb2a1 tests: Avoid race condition in REPL server test.
Fixes <http://bugs.gnu.org/24769>.
Reported by Rob Browning <rlb@defaultvalue.org>.

* test-suite/tests/00-repl-server.test ("simple expression"): Add call
to 'select' before 'display'.
2017-03-01 20:17:01 +01:00
Ludovic Courtès
bf58d7bb98 tests: Throw 'unresolved when the REPL server is too slow.
* test-suite/tests/00-repl-server.test (call-with-repl-server):
Use (usleep 100) instead of (sleep 1).  Throw 'unresolved when TRIES is
too high.
2017-03-01 20:16:53 +01:00
Ludovic Courtès
2cecf3b15a tests: Add REPL server test for CVE-2016-8606.
This is a followup to 08c021916d.

* test-suite/tests/00-repl-server.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add it.
2017-03-01 20:16:28 +01:00
Ludovic Courtès
b473598f26 tests: Use the "normalized codeset" in locale names.
* test-suite/tests/i18n.test (%french-locale-name)
(%french-utf8-locale-name, %turkish-utf8-locale-name)
(%german-utf8-locale-name, %greek-utf8-locale-name): Use the normalized
codeset for ISO-8859-1 and UTF-8.
2017-03-01 19:58:49 +01:00
Andy Wingo
77cfd7e4bf Fix class slot allocation since GOOPS rewrite
* module/oop/goops.scm (%compute-layout): Fix class slot layout.
  Before, a #:class that was an argument to #:allocation was getting
  interpreted as a keyword with a value.
* test-suite/tests/goops.test ("#:class slot allocation"): Add test.
2017-03-01 15:37:05 +01:00
Andy Wingo
e13cd5c77c Flush when getting string from r6rs string output port
* module/rnrs/io/ports.scm (open-string-output-port): Calling the
  get-string proc should flush the buffer and reset the file position.
* test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Add tests.
  Thanks to Freja Nordsiek for the report.
2017-03-01 14:26:11 +01:00
Andy Wingo
1da66a6ab1 String ports can be truncated
* libguile/strports.c (string_port_truncate):
  (scm_make_string_port_type): Support truncate-file on string ports.
* test-suite/tests/ports.test ("string ports"): Add tests.
2017-03-01 14:24:36 +01:00
Andy Wingo
68f13adaaf Better errors for odd-length keyword args
* libguile/vm-engine.c (bind-kwargs):
* libguile/vm.c (vm_error_kwargs_missing_value):
* libguile/eval.c (error_missing_value)
  (prepare_boot_closure_env_for_apply): Adapt to mirror VM behavior.
* libguile/keywords.c (scm_c_bind_keyword_arguments): Likewise.
* module/ice-9/eval.scm (primitive-eval): Update to error on (foo #:kw)
  with a "Keyword argument has no value" instead of the horrible "odd
  argument list length".  Also adapts to the expected args format for
  the keyword-argument-error exception printer in all cases.  Matches
  1.8 optargs behavior also.
* test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_missing_value):
  (missing_value_error_handler): Update test.
* test-suite/tests/optargs.test: Add tests.
2017-02-28 22:01:20 +01:00
Andy Wingo
631e9901d8 Declare module exports before loading imports
* module/ice-9/boot-9.scm (define-module*): Process module imports after
  module exports.  Allows for an additional kind of circular module
  imports (see https://bugs.gnu.org/15540).
* test-suite/tests/modules.test ("circular imports"): Add test.
2017-02-28 11:49:15 +01:00
Andy Wingo
c7fb87cd6e Fix multi-arity dispatch in GOOPS
* module/oop/goops.scm (multiple-arity-dispatcher): Fix dispatch for
  max-arity+1 when a generic is already in multiple-arity dispatch.
  Fixes #24454.
* test-suite/tests/goops.test ("dispatch"): Add test.
2017-02-22 23:10:46 +01:00
Andy Wingo
d0811644f6 Fix flonum/complex type inference.
* module/language/cps/types.scm (define-binary-result!): Arithmetic
  where one argument is a flonum may produce a complex.
* test-suite/tests/compiler.test: Add test.
2017-02-19 12:11:07 +01:00
Andy Wingo
d0934df1f2 Stringbufs immutable by default
* libguile/snarf.h (SCM_IMMUTABLE_STRINGBUF): Remove shared flag.
  Stringbufs are immutable by default.
* libguile/strings.c: Rewrite blurb.  Change to have stringbufs be
  immutable by default and mutable only when marked as such.  Going
  mutable means making a private copy.
  (STRINGBUF_MUTABLE, STRINGBUF_F_MUTABLE): New definitions.
  (SET_STRINGBUF_SHARED): Remove.
  (scm_i_print_stringbuf): Simplify to just alias the stringbuf as-is.
  (substring_with_immutable_stringbuf): New helper.
  (scm_i_substring, scm_i_substring_read_only, scm_i_substring_copy):
  use new helper.
  (scm_i_string_ensure_mutable_x): New helper.
  (scm_i_substring_shared): Use scm_i_string_ensure_mutable_x.
  (stringbuf_write_mutex): Remove; yaaaaaaaay.
  (scm_i_string_start_writing): Use scm_i_string_ensure_mutable_x.  No
  more mutex.
  (scm_i_string_stop_writing): Now a no-op.
  (scm_i_make_symbol): Use substring/copy.
  (scm_sys_string_dump, scm_sys_symbol_dump): Update.
* libguile/strings.h (SCM_I_STRINGBUF_F_SHARED): Remove.
  (SCM_I_STRINGBUF_F_MUTABLE): Add.
* module/system/vm/assembler.scm (link-data): Don't add shared flag any
  more.  Existing compiled flags are harmless tho.
* test-suite/tests/strings.test ("string internals"): Update.
2017-02-16 13:11:29 +01:00
Andy Wingo
8c50060ae9 Modernize (web http) a bit
* module/web/http.scm: Modernize the Guile Scheme by using more match,
  when, unless, and non-tail conversion.  No functional change, with the
  exception of fixing a bug in write-key-value-list for symbols like
  100-continue that shouldn't print as #{100-continue}#.
* test-suite/tests/web-http.test (pass-if-only-parse):
  (pass-if-reparse, pass-if-parse): Arrange to also serialize and
  reparse values from pass-if-parse.  Apply to all existing tests except
  fragments where we don't expect fragments to be written out.
2017-02-08 15:09:14 +01:00
Daniel Llorens
93cbaef134 Fix rank 0 arrays and nested arrays in truncated-print
* module/ice-9/pretty-print.scm (print): In the array case, pass
  #:inner? along to (print-sequence), unless we're at the last dimension
  of the array.
  Special case for 0-rank arrays, which cannot be empty and have no
  length.
* test-suite/tests/print.test: Test some of the cases fixed by this
  patch.
2017-02-07 15:56:40 +01:00
Daniel Llorens
ee2125c639 Support arrays in truncated-print
* module/ice-9/pretty-print.scm (print): Handle general arrays.
* test-suite/tests/print.test: Test truncated-print with general arrays.
2017-02-07 12:19:04 +01:00
Andy Wingo
498f3f9568 Avoid stacks in dynamically-bound values
* libguile/dynstack.h:
* libguile/dynstack.c (scm_dynstack_find_old_fluid_value): New
  function.
* libguile/fluids.c (saved_dynamic_state_ref): New helper.
  (scm_fluid_ref): Fix docstring.
  (scm_fluid_ref_star): New function allowing access to previous values
  for a fluid.
  (scm_dynamic_state_ref): New internal function.
* libguile/fluids.h: Add scm_fluid_ref_star and scm_dynamic_state_ref.
* libguile/stacks.c (scm_stack_id): Adapt to %stacks not being a chain.
* libguile/throw.c (catch, throw_without_pre_unwind): Adapt to
  %exception-handlers not being a chain.
* module/ice-9/boot-9.scm (catch, dispatch-exception): Instead of having
  %exception-handlers be a chain, use fluid-ref* to access the chain
  that is in place at the time the exception is thrown.  Prevents
  unintended undelimited capture of the current exception handler stack
  by a delimited "catch".
  (%start-stack): Similarly, don't be a chain.
* module/system/repl/debug.scm (frame->stack-vector):
* module/system/repl/error-handling.scm (call-with-error-handling):
* module/ice-9/save-stack.scm (save-stack): Adapt to %stacks not being a
  chain.
* test-suite/tests/exceptions.test ("delimited exception handlers"): Add
  tests.
* doc/ref/api-control.texi (Fluids and Dynamic States): Add docs.
2017-02-07 09:57:55 +01:00
Daniel Llorens
7e93950552 Final names for new array functions
Globally rename (array-from* -> array-slice), (array-from ->
array-cell-ref), (array-amend! -> array-cell-set!), (array-for-each-cell
-> array-slice-for-each).
2017-01-09 09:02:04 +01:00
Daniel Llorens
546eb479b1 Test format ~f with width parameters
* test-suite/tests/format.test: Additional tests for ~f.
2016-12-15 12:47:08 +01:00
Andy Wingo
6dd87f4d8c Add suspendable-continuation?
* doc/ref/api-control.texi (Prompt Primitives): Document
  suspendable-continuation?.
* libguile/control.c (scm_suspendable_continuation_p): New procedure.
  (scm_init_ice_9_control): New extension procedure, defines
  suspendable-continuation?.
  (scm_init_control): Register scm_init_ice_9_control.
* libguile/eval.c (eval):
* libguile/throw.c (catch):
* libguile/continuations.c (scm_i_make_continuation): Restore resumable
  prompt cookie after continuation invocation.
* libguile/vm.c (scm_call_n): Arrange to set resumable_prompt_cookie
  during invocation of VM.
* libguile/vm.h (struct scm_vm): Add resumable_prompt_cookie member.
* module/ice-9/control.scm: Export suspendable-continuation?.
* test-suite/tests/control.test ("suspendable-continuation?"): New
  test.
2016-12-12 21:13:00 +01:00
Andy Wingo
7184c176b4 with-dynamic-state compiler and VM support
* libguile/dynstack.h (SCM_DYNSTACK_TYPE_DYNAMIC_STATE):
* libguile/dynstack.c (DYNAMIC_STATE_WORDS, DYNAMIC_STATE_STATE_BOX):
  (scm_dynstack_push_dynamic_state):
  (scm_dynstack_unwind_dynamic_state): New definitions.
  (scm_dynstack_unwind_1, scm_dynstack_wind_1): Add with-dynamic-state
  cases.
* libguile/memoize.c (push_dynamic_state, pop_dynamic_state)
  (do_push_dynamic_state, do_pop_dynamic_state): New definitions.
  (memoize, scm_init_memoize): Handle push-dynamic-state and
  pop-dynamic-state.
* libguile/vm-engine.c (push-dynamic-state, pop-dynamic-state): New
  opcodes.
* module/ice-9/boot-9.scm (with-dynamic-state): New definition in Scheme
  so that the push-dynamic-state and pop-dynamic-state always run in the
  VM.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/effects-analysis.scm:
* module/language/cps/types.scm:
* module/language/tree-il/effects.scm (make-effects-analyzer):
* module/language/tree-il/peval.scm (peval):
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
* module/system/vm/assembler.scm: Add support for with-dynamic-state to
  the compiler.
* test-suite/tests/fluids.test ("dynamic states"): Add basic tests.
* doc/ref/vm.texi (Dynamic Environment Instructions): Update.
2016-12-05 22:57:29 +01:00
Andy Wingo
0dcca77754 Remove special support for fluids in GDB interface
* module/system/base/types.scm (inferior-fluid?, inferior-fluid-number)
  (<inferior-fluid>): Remove.  Fluids won't have numbers in the future.
  (cell->object): Adapt.
* test-suite/tests/types.test ("opaque objects"): Update.
2016-11-26 15:43:33 +01:00
Daniel Llorens
fa4a22971a Deprecate scm_from_contiguous_array
scm_from_contiguous_array() was undocumented, unused within Guile, and
can be replaced by make-array + array-copy! without requiring contiguity
and without loss of performance.

* libguile/arrays.c (scm_array_contents): Do not rely on
  SCM_I_ARRAY_CONTP.
* test-suite/tests/arrays.test: Test array-contents with 0-rank array.
* libguile/arrays.h: Declare scm_i_shap2ra(),
  SCM_SET_ARRAY_CONTIGUOUS_FLAG, SCM_CLR_ARRAY_CONTIGUOUS_FLAG so that
  scm_from_contiguous_array() can keep using them.
* libguile/deprecated.c (scm_from_contiguous_array): Move here from
  arrays.c.
* libguile/deprecated.h (scm_from_contiguous_array): Deprecate.
* NEWS: Add deprecation notice.
2016-11-23 13:05:49 +01:00
Daniel Llorens
7ef9d0ac2b New functions (array-for-each-cell, array-for-each-cell-in-order)
* libguile/array-map.c (scm_i_array_rebase, scm_array_for_each_cell):
  New functions. Export scm_array_for_each_cell() as
  (array-for-each-cell).

  (array-for-each-cell-in-order): Define additional export.

* libguile/array-map.h (scm_i_array_rebase, scm_array_for_each_cell):
  Add prototypes.

* test-suite/tests/array-map.test: Renamed from
  test-suite/tests/ramap.test, fix module name. Add tests for
  (array-for-each-cell).

* test-suite/Makefile.am: Apply rename array-map.test -> ramap.test.
2016-11-23 13:04:49 +01:00
Daniel Llorens
d1435ea6bd New functions array-from, array-from*, array-amend!
* libguile/arrays.h (scm_array_from, scm_array_from_s,
  scm_array_amend_x): New declarations.

* libguile/arrays.c (scm_array_from, scm_array_from_s,
  scm_array_amend_x): New functions, export as array-from, array-from*,
  array-amend!.

* test-suite/tests/arrays.test: Tests for array-from, array-from*,
  array-amend!. Replace with-test-prefix/c&e with with-test-prefix where
  the array read syntax isn't used.
2016-11-23 13:04:26 +01:00
Daniel Llorens
31e9f8b974 Speed up for multi-arg cases of scm_ramap functions
This patch results in a 20%-40% speedup in the > 1 argument cases of
the following microbenchmarks:

(define A (make-shared-array #0(1) (const '()) #e1e7))
; 1, 2, 3 arguments.
(define a 0) ,time (array-for-each (lambda (b) (set! a (+ a b))) A)
(define a 0) ,time (array-for-each (lambda (b c) (set! a (+ a b c))) A A)
(define a 0) ,time (array-for-each (lambda (b c d) (set! a (+ a b c d))) A A A)

(define A (make-shared-array (make-array 1) (const '()) #e1e7))
(define B (make-shared-array #0(1) (const '()) #e1e7))
; 1, 2, 3 arguments.
,time (array-map! A + B)
,time (array-map! A + B B)
,time (array-map! A + B B B)

* libguile/array-map.c (scm_ramap): Note on cproc arguments.

  (rafill): Assume that dst's lbnd is 0.

  (racp): Assume that src's lbnd is 0.

  (ramap): Assume that ra0's lbnd is 0. When there're more than two
  arguments, compute the array handles before the loop. Allocate the arg
  list once and reuse it in the loop.

  (rafe): Do as in ramap(), when there's more than one argument.

  (AREF, ASET): Remove.
2016-11-23 11:49:35 +01:00
Daniel Llorens
fa40c288ca Support typed arrays in some sort functions
* libguile/sort.c (sort!, sort, restricted-vector-sort!, sorted?):
  Support arrays of rank 1, whatever the type.

* libguile/quicksort.i.c: Fix accessors to handle typed arrays.

* test-suite/tests/sort.test: Test also with typed arrays.
2016-11-23 11:49:35 +01:00
Daniel Llorens
4e766795b2 Avoid unneeded internal use of array handles
* libguile/arrays.c (scm_shared_array_root): Adopt uniform check order.

  (scm_shared_array_offset, scm_shared_array_increments): Use the array
  fields directly just as scm_shared_array_root does.

  (scm_c_array_rank): Moved from libguile/generalized-arrays.c. Don't
  use array handles, but follow the same type check sequence as the
  other array functions (shared-array-root, etc).

  (scm_array_rank): Moved from libguile/generalized-arrays.h.

* libguile/arrays.h: Move prototypes here.

* test-suite/tests/arrays.test: Tests for shared-array-offset,
  shared-array-increments.
2016-11-23 11:49:35 +01:00
Daniel Llorens
d236d4d33f Fix compilation of rank 0 typed array literals
* module/system/vm/assembler.scm (simple-uniform-vector?): array-length
  fails for rank 0 arrays; fix the shape condition.

* test-suite/tests/arrays.test: Test reading of #0f64(x) in compilation
  context.
2016-11-23 11:49:35 +01:00
Andy Wingo
1e92511996 Add asyncs test
* test-suite/tests/asyncs.test: New file.
2016-11-19 14:54:44 +01:00
Andy Wingo
56dd476af7 Back to simple unlock-mutex
* libguile/threads.c (scm_unlock_mutex): Bind to unlock-mutex.
* libguile/threads.h: Remove scm_unlock_mutex_timed.
* libguile/deprecated.h: Add scm_unlock_mutex_timed.
* libguile/deprecated.c (scm_unlock_mutex_timed): Deprecate.
* test-suite/tests/threads.test: Update unlock-mutex tests to use
  wait-condition-variable if they would wait on a cond.
2016-11-05 11:50:31 +01:00
Andy Wingo
c0916134ac Remove unchecked-unlock facility from Guile mutexes
* libguile/threads.c (fat_mutex): Remove unchecked_unlock member.
  (make_fat_mutex): Adapt.
  (scm_make_mutex_with_flags): Remove unchecked-unlock flag.
  (scm_make_recursive_mutex): Likewise.
  (fat_mutex_unlock): Remove unchecked-unlock case.
* test-suite/tests/threads.test: Remove unchecked-unlock test.
2016-11-05 10:30:54 +01:00
Andy Wingo
f1f68fffb1 Recursively locking a SRFI-18 mutex blocks
* libguile/threads.c (fat_mutex_lock): allow-external-unlock mutexes
  can't be recursive, but a recursive lock attempt can be unblocked by
  an external thread, so these mutexes shouldn't throw an error on
  recursive lock attempts.
* test-suite/tests/srfi-18.test: Add tests.
2016-11-05 10:30:54 +01:00
Andy Wingo
f1b7eaaa1a Remove fat mutex abandoned mutex error
* libguile/threads.c (fat_mutex_lock): Remove abandoned mutex error, as
  SRFI-18 is responsible for this.
* test-suite/tests/threads.test: Update test.
2016-11-05 10:30:49 +01:00
Andy Wingo
ecfa0b50ce Remove lock-mutex owner facility
* libguile/threads.c (scm_lock_mutex_timed): Deprecate "owner"
  argument.
  (fat_mutex_lock): Remove owner argument.
  (fat_mutex_unlock): Don't pass owner to scm_lock_mutex_timed.
* test-suite/tests/threads.test: Remove tests of mutex-owner.
2016-11-04 23:32:26 +01:00
Andy Wingo
2559631869 SRFI-18 mutexes disjoint from Guile mutexes
* module/srfi/srfi-18.scm (<mutex>): Define as a wrapper type around
  Guile mutexes.
  (thread-mutexes): New variable.
  (with-thread-mutex-cleanup): New facility to abandon mutexes on
  SRFI-18 thread exit.  Not yet used.
  (make-thread): Use SRFI-18 interfaces.
  (make-mutex): Reimplement for our boxed mutexes.
  (mutex-state): Adapt.
  (mutex-lock!): Adapt.
  (mutex-unlock!): Adapt.
* test-suite/tests/srfi-18.test: Don't assume that SRFI-18 mutexes are
  the same as Guile mutexes.
2016-11-04 20:17:58 +01:00
Andy Wingo
eeeee3297b Remove thread cleanup facility
* NEWS: Add entry.
* doc/ref/api-scheduling.texi (Threads): Remove thread-cleanup docs.
* libguile/threads.c (guilify_self_1, do_thread_exit):
  (scm_set_thread_cleanup_x, scm_thread_cleanup): Remove these.
* libguile/threads.h (scm_i_thread): Remove cleanup_handler.
* module/ice-9/threads.scm:
* module/ice-9/deprecated.scm (thread-cleanup, set-thread-cleanup!):
  Remove.
* test-suite/tests/threads.test: Adapt to test cancel-thread return
  values and not test thread-cleanup procs.
2016-10-31 22:37:46 +01:00
Andy Wingo
177a058a40 srfi-18: Use srfi-35 conditions.
* module/srfi/srfi-18.scm: Use srfi-35 conditions instead of our
  home-grown equivalent system.
  (thread-exception-handlers): Remove unused table.
  (srfi-18-exception-handler): Always capture key consed to args; no
  special case for bare key.
* test-suite/tests/srfi-18.test (provided?): Adapt to reason always
  being key+args.
2016-10-30 22:30:21 +01:00
Julian Graham
9807d2dced Fix tree-il code generation for ECMAscript `new' expression.
The compiler was producing `((toplevel foo))' instead of `(toplevel foo)'.
Changed to use `call' form with target type and spliced constructor
arguments.

* module/language/ecmascript/compile-tree-il.scm (comp): Replace `@impl'
  shorthand with `call' + `@implv' for better control over resulting
  tree-il.
* test-suite/tests/ecmascript.test (compiler): Add test for "new Object();"

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-10-25 23:39:30 +02:00
Andy Wingo
d74e0fed0d Move thread bindings to (ice-9 threads)
* libguile/init.c (scm_i_init_guile): Don't call scm_init_thread_procs.
* libguile/threads.c (scm_init_ice_9_threads): Rename from
  scm_init_thread_procs, make static.
  (scm_init_threads): Register scm_init_thread_procs extension.
* libguile/threads.h (scm_init_thread_procs): Remove decl.
* module/ice-9/boot-9.scm: Load (ice-9 threads), so that related side
  effects occur early.
* module/ice-9/deprecated.scm (define-deprecated): Fix to allow
  deprecated bindings to appear in operator position.  Export deprecated
  bindings.
  (define-deprecated/threads, define-deprecated/threads*): Trampoline
  thread bindings to (ice-9 threads).
* module/ice-9/futures.scm: Use ice-9 threads.
* module/ice-9/threads.scm: Load scm_init_ice_9_threads extension.
  Reorder definitions and imports so that the module circularity
  with (ice-9 futures) continues to work.
* module/language/cps/intmap.scm:
* module/language/cps/intset.scm:
* module/language/tree-il/primitives.scm: Use (ice-9 threads).
* module/language/cps/reify-primitives.scm: Reify current-thread
  in (ice-9 threads) module.
* module/srfi/srfi-18.scm: Use ice-9 threads with a module prefix, and
  adapt all users.  Use proper keywords in module definition form.
* test-suite/tests/filesys.test (test-suite):
* test-suite/tests/fluids.test (test-suite):
* test-suite/tests/srfi-18.test: Use ice-9 threads.
* NEWS: Add entry.
* doc/ref/api-scheduling.texi (Threads): Update.
* doc/ref/posix.texi (Processes): Move current-processor-count and
  total-processor-count docs to Threads.
2016-10-23 22:29:44 +02:00
Andy Wingo
56d8d9a257 Deprecate arbiters
* libguile/arbiters.c:
* libguile/arbiters.h:
* test-suite/tests/arbiters.test: Delete files.
* libguile/deprecated.c:
* libguile/deprecated.h: Move arbiters code here.
* doc/ref/api-scheduling.texi: Remove section on arbiters.
* libguile.h:
* libguile/Makefile.am:
* libguile/init.c:
* module/oop/goops.scm:
* test-suite/Makefile.am: Remove mention of arbiters.
* NEWS: Update.
2016-10-17 21:29:05 +02:00