* eval.c (scm_trampoline_0, scm_trampoline_1, scm_trampoline_2):
[bpt/guile.git] / libguile / ChangeLog
CommitLineData
4b612c5b
MD
12003-02-10 Mikael Djurfeldt <djurfeldt@nada.kth.se>
2
3 * eval.c (scm_trampoline_0, scm_trampoline_1, scm_trampoline_2):
4 Fixed formals tests for closures. (Thanks to Kevin Ryde.)
5
b3d7f6df
MD
62003-02-05 Mikael Djurfeldt <djurfeldt@nada.kth.se>
7
8 * debug.c (scm_procedure_source): Handle all objects for which
9 procedure? is #t. (Thanks to Bill Schottstaedt.)
10
756414cf
MD
112003-01-23 Mikael Djurfeldt <djurfeldt@nada.kth.se>
12
361d631f
MD
13 * futures.c (mark_futures): Don't need to mark data of recycled
14 futures.
15 (scan_futures, cleanup_undead): Be smarter about marking
16 futures---avoid unnecessary passes through future lists.
17
756414cf
MD
18 * futures.h, futures.c: New files; Introduced recycling of
19 futures. For fine-grained threading this lifts performance to
20 another level. We can now use parallelization in inner loops of
21 Guile programs without impossible overhead.
22
23 * threads.h, threads.c: Moved futures to their own file.
24
25 * Makefile.am (libguile_la_SOURCES): Added futures.c.
26 (DOT_X_FILES): Added futures.x.
27 (DOT_DOC_FILES): Added futures.doc.
28 (modinclude_HEADERS): Added futures.h.
29
30 * threads.c, threads.h (scm_i_create_thread): Renamed from
31 create_thread and made global.
32
33 * futures.c (scm_make_future): New procedure.
34
35 * eval.c: #include "libguile/futures.h".
36
37 * init.c: #include "futures.h"
38 (scm_init_guile_1): Call scm_init_futures.
39
40 * stime.c (SCM_TIME_UNITS_PER_SECOND): Renamed from CLKTCK.
41
42 * stime.h (SCM_TIME_UNITS_PER_SECOND): Definition moved here.
43
44 * eval.c, eval.h (scm_trampoline_0, scm_i_call_closure_0): New
45 functions.
46
47 * eval.c (scm_trampoline_1): Fixed arguments test for closures.
48
b4debead
MD
492003-01-22 Mikael Djurfeldt <djurfeldt@nada.kth.se>
50
51 * threads.c (create_thread): Don't unwind dynwind chain of parent
52 thread before creation. Just start the new thread with an empty
53 dynwind chain.
54
93f26b7b
MD
552003-01-20 Mikael Djurfeldt <djurfeldt@nada.kth.se>
56
57 * evalext.c, evalext.h (scm_self_evaluating_p): New function.
58
38d8927c
MD
592003-01-10 Mikael Djurfeldt <djurfeldt@nada.kth.se>
60
41c96c32
MD
61 * threads.c (scm_timed_wait_condition_variable): Support timed
62 waiting also for simple condition variables.
63
38d8927c
MD
64 * goops.c (TEST_CHANGE_CLASS): Use scm_change_object_class instead
65 of calling the procedure change-object-class.
66
9cf5d9b7
MD
672003-01-09 Mikael Djurfeldt <djurfeldt@nada.kth.se>
68
69 * ramap.c (scm_ramapc): Typo in error message.
70
bbf8d523
MD
712003-01-08 Mikael Djurfeldt <djurfeldt@nada.kth.se>
72
b46fae00
MD
73 * goops.c (scm_sys_prep_layout_x): Bugfix: Only create layout for
74 slots with instance allocation.
75
bbf8d523
MD
76 * goops.c, goops.h (scm_class_extended_generic_with_setter): New
77 class.
78 (scm_compute_applicable_methods): Use scm_generic_function_methods.
79
80 * goops.c (scm_generic_function_methods): Support extended
81 generic functions.
82
ebf9b47c
MD
832002-12-29 Mikael Djurfeldt <djurfeldt@nada.kth.se>
84
85 * eval.c (unmemocopy): Bugfix: scm_sym_delay --> scm_sym_future.
2e37d6a2 86 Thanks to Neil for pointing this out!
ebf9b47c 87
14a9ba3f
NJ
882002-12-29 Neil Jerram <neil@ossau.uklinux.net>
89
90 * lang.h: Remove declarations matching definitions removed from
91 lang.c (just below).
92
c6a040a8
NJ
932002-12-28 Neil Jerram <neil@ossau.uklinux.net>
94
6054d805
NJ
95 * lang.c (scm_nil_cons, scm_nil_car, scm_nil_cdr, scm_null,
96 scm_m_while, scm_nil_eq): Remove definitions that were superfluous
97 and already commented out.
98
c6a040a8
NJ
99 * read.h (scm_lreadparen), read.c (scm_lreadr, scm_read_token,
100 scm_lreadparen): Support reading vectors with Elisp syntax if
101 SCM_ELISP_READ_EXTENSIONS is defined. (SCM_ELISP_READ_EXTENSIONS
102 is not currently defined, and there isn't even a configure switch
103 to enable it yet.)
104
3742c12f
MV
1052002-12-26 Marius Vollmer <mvo@zagadka.ping.de>
106
107 * Makefile.am (c-tokenize.o): Refer to source via $< so that vpath
108 builds work.
109 (EXTRA_DIST): Added version.h.in.
110
fb50ef08
MD
1112002-12-21 Mikael Djurfeldt <djurfeldt@nada.kth.se>
112
113 This change makes it possible for one thread to do lazy sweeping
114 while other threads are running. Now only the mark phase need to
115 have all threads asleep. We should look further into this issue.
116 Presently, I've put the locking of scm_i_sweep_mutex at
117 "conservative" places due to my current lack of knowledge about
118 the garbage collector. Please feel free to restrict these regions
119 further to allow for maximal parallelism!
120
121 * gc.c, gc.h (scm_i_sweep_mutex): New mutex.
122
123 * gc.c (scm_gc_for_newcell), gc-malloc.c (scm_realloc,
124 scm_gc_register_collectable_memory): Substitute locking of
125 scm_i_sweep_mutex for calls to scm_i_thread_put_to_sleep.
126 (scm_igc): Lock sweep mutex here instead of in callers; Calls to
127 scm_i_thread_put_to_sleep/scm_i_thread_wake_up used to demarkate
128 the single-thread section (which now only contains the mark
129 phase).
130 (scm_gc): Don't lock sweeo mutex here since scm_igc locks it;
131 Removed SCM_DEFER/ALLOW_INTS. Simply call scm_igc directly.
132
133 * threads.c (gc_section_mutex): Removed.
134
9ed24633
MD
1352002-12-19 Mikael Djurfeldt <mdj@kvast.blakulla.net>
136
0d48aca5
MD
137 * threads.c (create_thread): Clear parent field in root state in
138 order not to unnecessarily remember dead threads.
139
9ed24633
MD
140 * eval.c (call_subr2o_1, call_lsubr2_2): New functions.
141 (scm_trampoline_1, scm_trampoline_2): Use them.
142
29717c89
MD
1432002-12-18 Mikael Djurfeldt <mdj@kvast.blakulla.net>
144
145 Partial introduction of real plugin interface.
146
147 * Makefile.am (modinclude_HEADERS): Added threads-plugin.h.
148 (EXTRA_DIST): Added threads-plugin.c.
149
150 * threads-plugin.h, threads-plugin.c: New files.
151
152 * threads.h: #include "libguile/threads-plugin.h".
153
154 * threads.c: #include "libguile/threads-plugin.c".
155
156 * pthread-threads.c: Temporarily remove debugging functions.
157
158 * threads.c, threads.h (scm_yield): Added back.
159
e29e0b09
MD
1602002-12-18 Mikael Djurfeldt <mdj@kvast.blakulla.net>
161
162 * threads.c (really_launch): Detach before unlocking
163 thread_admin_mutex in order not to risk being joined.
164 (scm_i_thread_put_to_sleep, scm_i_thread_wake_up): Keep
165 thread_admin_mutex locked during GC.
166
167 * pthread-threads.c, pthread-threads.h: Improvements to debugging
168 functions.
169
0b6843b1 1702002-12-16 Mikael Djurfeldt <mdj@kvast.blakulla.net>
93cd4dcd 171
6da2dfc4
MD
172 * pthread-threads.c, pthread-threads.h (SCM_DEBUG_THREADS): Added
173 support for debugging mutex operations.
174
1b92fb6b
MD
175 * threads.c (scm_thread): Removed filed joining_threads.
176 (thread_print): Print thread number as well as address of thread
177 structure.
0b6843b1
MD
178 (scm_join_thread): Bugfix.
179 (scm_lock_mutex, scm_try_mutex, scm_unlock_mutex,
180 scm_timed_wait_condition_variable, scm_signal_condition_variable,
181 scm_broadcast_condition_variable): Use the low-level API.
182 (scm_all_threads): Return copy of thread list (to prevent
183 unintended destruction).
184 (scm_threads_prehistory): Initialize heap_mutex of fake thread.
1b92fb6b 185
93cd4dcd
MD
186 * pthread-threads.c, pthread-threads.h, threads.c: Fixes to
187 pthread "native" recursive mutex support.
188
2ff4f181
MD
1892002-12-15 Mikael Djurfeldt <djurfeldt@nada.kth.se>
190
28d52ebb
MD
191 * __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): New definitions.
192 Simply lock a thread C API recursive mutex.
193 (SCM_NONREC_CRITICAL_SECTION_START,
194 SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
195 SCM_REC_CRITICAL_SECTION_END): Removed.
196
197 * eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
198 direct calls to scm_rec_mutex_lock / unlock around the three calls
199 to scm_m_expand_body.
200
201 * eval.c, eval.h (promise_free): New function.
202 (scm_force): Rewritten; Now thread-safe; Removed
203 SCM_DEFER/ALLOW_INTS.
204
205 * pthread-threads.h: Added partially implemented plugin interface
206 for recursive mutexes. These are, for now, only intended to be
207 used internally within the Guile implementation.
208
209 * pthread-threads.c: New file.
210
211 * threads.c: Conditionally #include "pthread-threads.c".
212
213 * eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
214 thread-safe;
215
216 * snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
217 SCM_GLOBAL_REC_MUTEX): New macros.
218
219 * eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
220 macros---use mutexes instead.
221
222 * tags.h (SCM_IM_FUTURE): New tag.
223
224 * eval.c (scm_m_future): New primitive macro.
225 (SCM_CEVAL): Support futures.
226 (unmemocopy): Support unmemoization of futures.
227
228 * print.c (scm_isymnames): Name of future isym.
229
2ff4f181
MD
230 * version.c: Unmade some changes to my private copy that got
231 committed by mistake.
232
392d2833
MD
2332002-12-11 Mikael Djurfeldt <mdj@kvast.blakulla.net>
234
e200ddee
MD
235 * gc-malloc.c, gc.h, init.c: Reverted gc-malloc change of
236 2002-12-10.
237
392d2833
MD
238 * gc.c (scm_igc): Don't call scm_i_thread_invalidate_freelists.
239
240 * gc.c (scm_gc_sweep): Call it here instead, which is a more
241 logical place.
242
243 * threads.c (create_thread): Remember root object until the handle
244 of the new thread is on all_threads list.
245
246 * root.c (scm_make_root): Moved copying of fluids until after
247 creation of root handle so that the fluids are GC protected. Also
248 removed the critical section.
249
c4c52ebe
MD
2502002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net>
251
960c408c
MD
252 * gc-malloc.c, gc.h (scm_gc_malloc_prehistory): New function.
253
3cdde9d6 254 * gc-malloc.c (malloc_mutex): New mutex.
960c408c 255 (scm_gc_malloc_prehistory): Initialize it.
3cdde9d6
MD
256 (scm_realloc): Serialize call to realloc
257 (scm_calloc): Same for calloc.
258 Thanks to Wolfgang Jaehrling!
259 (Now we have to make sure all calls to malloc/realloc are made
260 through scm_malloc.)
261
960c408c
MD
262 * init.c (scm_init_guile_1): Call scm_gc_malloc_prehistory.
263
c4c52ebe
MD
264 * threads.c (really_launch): Release heap (to prevent deadlock).
265 (create_thread): Release heap before locking thread admin mutex.
266
b0dc3d71
MD
2672002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net>
268
269 * threads.c (scm_i_thread_invalidate_freelists): New
270 function.
271
272 * gc.c (scm_igc): Call scm_i_thread_invalidate_freelists.
273
274 * modules.c (scm_export): Inserted a return statement.
275
06e80f59
HWN
2762002-12-10 Han-Wen Nienhuys <hanwen@cs.uu.nl>
277
278 * modules.c (scm_export): new function
279
280 * gc-card.c: add a note about malloc()/free() overhead.
281
a12611c3
MD
2822002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net>
283
284 * Makefile.am (c-tokenize.$(OBJEXT)): Don't look for c-tokenize.c
285 in srcdir.
286
c7fabadf
MD
2872002-12-10 Mikael Djurfeldt <djurfeldt@nada.kth.se>
288
289 These changes remove scm_ints_disabled (which hasn't has any
290 effect in Guile for quite some time).
291
292 * async.c, error.h (scm_ints_disabled): Removed.
293
294 * gc.c (scm_gc_for_newcell), init.c (scm_init_guile_1),
295 root.c (scm_internal_cwdr), gdbint.c (SCM_BEGIN_FOREIGN_BLOCK,
296 SCM_END_FOREIGN_BLOCK): Don't touch scm_ints_disabled.
297 (old_ints): Removed.
298
299 * __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): Define as a recursive
300 critical section.
301 (SCM_REDEFER_INTS, SCM_ALLOW_INTS): Define as SCM_DEFER_INTS and
302 SCM_ALLOW_INTS.
303
9bc4701c
MD
3042002-12-09 Mikael Djurfeldt <djurfeldt@nada.kth.se>
305
52340b65
MD
306 * threads.c (scm_mutex_lock, scm_cond_wait, scm_cond_timedwait):
307 Removed accidental #if 0 around these functions.
308
9bc4701c
MD
309 These changes are the start of support for preemptive
310 multithreading. Marius and I have agreed that I commit this code
311 into the repository although it isn't thoroughly tested and surely
312 introduces many bugs. The bugs should only be exposed when using
313 threads, though. Signalling and error handling for threads is
314 very likely broken. Work on making the implementation cleaner and
315 more efficient is needed.
316
317 * __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
318 (SCM_NONREC_CRITICAL_SECTION_START,
319 SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
320 SCM_REC_CRITICAL_SECTION_END): New macros.
321 (SCM_CRITICAL_SECTION_START/END): Defined here.
322
323 * eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
324 the three calls to scm_m_expand_body.
325
326 * gc.h: #include "libguile/pthread-threads.h";
327 (SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.
328
329 * gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
330 scm_t_key;
331
332 * gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
333 access.
334
335 * gc-freelist.c (scm_gc_init_freelist): Create freelist keys.
336
337 * gc-freelist.c, threads.c (really_launch): Use
338 SCM_FREELIST_CREATE.
339
340 * gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):
341
342 * gc.c (scm_i_expensive_validation_check, scm_gc,
343 scm_gc_for_newcell): Put threads to sleep before doing GC-related
344 heap administration so that those pieces of code are executed
345 single-threaded. We might consider rewriting these code sections
346 in terms of a "call_gc_code_singly_threaded" construct instead of
347 calling the pair of scm_i_thread_put_to_sleep () and
348 scm_i_thread_wake_up (). Also, we would want to have as many of
349 these sections eleminated.
350
351 * init.c (scm_init_guile_1): Call scm_threads_prehistory.
352
353 * inline.h: #include "libguile/threads.h"
354
355 * pthread-threads.h: Macros now conform more closely to the
356 pthreads interface. Some of them now take a second argument.
357
358 * threads.c, threads.h: Many changes.
359
3602002-12-09 Mikael Djurfeldt <djurfeldt@nada.kth.se>
361
362 * Makefile.am (version.h): Changed $^ --> $< in rule for
363 version.h.
364
b2cbe8d8
RB
3652002-12-08 Rob Browning <rlb@defaultvalue.org>
366
367 * version.h.in (SCM_MICRO_VERSION): use @--@ substitution now.
368 (SCM_MINOR_VERSION): use @--@ substitution now.
369 (SCM_MICRO_VERSION): use @--@ substitution now.
370 (scm_effective_version): new function prototype.
371
372 * version.c (scm_effective_version): new function, also add
373 effective-version.
374
375 * Makefile.am (schemelibdir): VERSION -> GUILE_EFFECTIVE_VERSION.
376 (libpath.h): use GUILE_EFFECTIVE_VERSION to compute
377 SCM_LIBRARY_DIR.
378 (version.h): generate this here rather than configure.in. This
379 approach tracks source edits better (i.e. more immediately).
380 Might be worth considering for other .in files too.
381
5441c65c
MV
3822002-12-02 Marius Vollmer <mvo@zagadka.ping.de>
383
384 Reorganized thread package selection. A thread package now only
385 implements a small set of pthread like functions and Guile
386 implements the rest on top of that. Guile's implementation is
387 what the "coop-pthreads" package has been previously. Support for
388 "coop" threads has been removed until I get time to add it again.
389
390 * Makefile.am (libguile_la_SOURCES): Removed iselect.c.
391 (noinst_HEADERS): Removed coop-threads.c, coop-threads.h, coop.c,
392 null-threads.c, coop-pthreads.c.
393 (modinclude_HEADERS): Removed coop-defs.h, coop-pthreads.h. Added
394 pthread-threads.h.
395
396 * validate.h (SCM_VALIDATE_THREAD): Moved to threads.h.
397
398 * threads.h: Do not include "libguile/coop-defs.h". Include
399 "libguile/pthread-threads.h" for USE_COPT_THREADS. Removed
400 (previously deprecated) C level thread API prototypes. They are
401 now in the thread package specific headers, "null-threads.h" and
402 "pthread-threads.h".
403 (SCM_VALIDATE_THREAD, SCM_VALIDATE_MUTEX, SCM_VALIDATE_CONDVAR):
404 New.
405 (scm_threads_init): Removed.
406 (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END,
407 SCM_THREAD_SWITCHING_CODE, scm_i_switch_counter,
408 SCM_I_THREAD_SWITCH_COUNT): Define here.
409 (scm_single_thread_p): Removed.
410 (scm_call_with_new_thread): Take two args directly instead of list
411 of two args.
412 (scm_i_thread_data, scm_i_set_thread_data, SCM_THREAD_LOCAL_DATA,
413 SCM_SET_THREAD_LOCAL_DATA): Define here.
414
415 * threads.c: Merged with "coop-pthreads.c".
416
417 * null-threads.h: Implement pthread-like API as a set of macros.
418
419 * pthread-threads.h: New, implement pthread-like API by deferring
420 to pthread itself.
421
422 * init.c (scm_init_guile_1): Do not call scm_init_iselect, which
423 has been lost in the reorganization.
424
504d99c5
MD
4252002-12-01 Mikael Djurfeldt <mdj@linnaeus>
426
427 The following change makes it possible to move procedure
428 application dispatch outside inner loops. The motivation was
429 clean implementation of efficient replacements of R5RS primitives
430 in SRFI-1.
431
432 The semantics is clear: scm_trampoline_N returns an optimized
433 version of scm_call_N (or NULL if the procedure isn't applicable
434 on N args).
435
436 Applying the optimization to map and for-each increases efficiency
437 noticeably. For example, (map abs ls) is 8 times faster than
438 before.
439
440 * eval.h (scm_t_trampoline_1, scm_t_trampoline_2): New types.
441
442 * eval.c, eval.h (scm_trampoline_1, scm_trampoline_2): New functions.
443
444 * eval.c (call_subr2_2, call_lsubr_2, call_closure_2): New functions;
445 (map, for-each): Handle also application on two args as a special
446 case; Use trampolines.
447
448 Other changes:
449
450 * sort.c (scm_cmp_function): Choose subr2less for scm_tc7_subr_2o;
451 (subr2oless): Removed.
452 (scm_restricted_vector_sort_x): Use scm_return_first to keep the
453 vector GC protected.
454
455 * eval.c (check_map_args): Use scm_out_of_range_pos instead of
456 scm_out_of_range.
457
63dd3413
DH
4582002-11-24 Dirk Herrmann <D.Herrmann@tu-bs.de>
459
460 * evalext.[ch] (scm_m_undefine, undefine): Deprecated.
461
4ba5f279
MD
4622002-11-17 Mikael Djurfeldt <mdj@linnaeus>
463
464 * debug.c (scm_make_iloc): Added missing "return".
465
56ae231f
MV
4662002-11-17 Marius Vollmer <mvo@zagadka.ping.de>
467
468 * strports.c (scm_eval_string_in_module): Validate second arg to
469 be a module. Thanks to Arno Peters!
470
80b28865
DH
4712002-11-16 Dirk Herrmann <D.Herrmann@tu-bs.de>
472
473 * .cvsignore: remove goops.c
474
c88b1456
DH
4752002-11-16 Dirk Herrmann <D.Herrmann@tu-bs.de>
476
477 * modules.c (scm_env_top_level, scm_lookup_closure_module,
478 module_variable, scm_module_lookup_closure,
479 scm_module_transformer, scm_sym2var, scm_module_reverse_lookup,
480 scm_system_module_env_p): Don't compare SCM values with C
481 operators == or !=. Avoid SCM_IMP predicates. Prefer !SCM_FALSEP
482 over SCM_NFALSEP.
483
a8a19efc
DH
4842002-11-16 Dirk Herrmann <D.Herrmann@tu-bs.de>
485
486 * eval.h (SCM_MAKE_ILOC): New macro.
487
488 * debug.c (scm_make_iloc): Use SCM_MAKE_ILOC instead of computing
489 the iloc bitpattern here.
490
76734914
MD
4912002-11-14 Mikael Djurfeldt <mdj@linnaeus>
492
493 * coop-pthreads.c, coop-pthreads.h: scm_internal_select should be
494 part of the API, otherwise it's difficult to write Guile
495 extensions using non-blocking I/O => moved #include
496 "libguile/iselect.h" from coop-pthreads.c --> coop-pthreads.h.
497
498 * coop-pthreads.c (scm_unlock_mutex): Changed s_lock_mutex -->
499 s_unlock_mutex.
500
8b5b4a75
MV
5012002-11-10 Marius Vollmer <mvo@zagadka.ping.de>
502
503 * __scm.h (USE_THREADS, GUILE_ISELECT): Do not define here. They
504 are defined in configure.in.
505
506 * threads.c: Removed SCM_API from function definitions. SCM_API
507 is only for declarations.
508
e5a83084
MD
5092002-11-07 Mikael Djurfeldt <mdj@linnaeus>
510
9be8bb45
MD
511 * coop-pthreads.h: Added support for thread specific data to the
512 generic C API for the coop-pthreads case.
513
e5a83084
MD
514 * threads.c, threads.h (scm_cond_init): Undo unintentional API
515 change.
6c214b62 516 (scm_cond_broadcast): Added missing function.
e5a83084 517
7edf178e
MV
5182002-11-04 Marius Vollmer <marius.vollmer@uni-dortmund.de>
519
520 * coop.c (coop_next_runnable_thread): Removed, wich should have
521 happened when GUILE_ISELECT was hard-wired.
522
7f5b1b77
MV
5232002-11-03 Marius Vollmer <mvo@zagadka.ping.de>
524
7caa1b07
MV
525 * Makefile.am (libguile_la_SOURCES): Added threads.c
526 (DOT_DOC_FILES): Added threads.doc.
527 (DOT_X_FILES): Added threads.x.
528 (EXTRA_libguile_la_SOURCES): Removed threads.c.
529 (noinst_HEADERS): Added coop-pthreads.c.
530 (modinclude_HEADERS): Added coop-pthreads.h.
531
532 * __scm.h (USE_THREADS, GUILE_ISELECT): Define when
533 SCM_DEBUG_DEPRECATED. Removed their use thru-out Guile.
534
bb11cbf4
MV
535 * iselect.c: Include "_scm.h" before testing HAVE_UNISTD_H.
536 Thanks to Bill Schottstaedt!
537
1d4cbbed
MV
538 * numbers.c (scm_integer_expt): Make 0^z == 0 for z != 0.
539
7f5b1b77
MV
540 * _scm.h (HAVE_RESTARTABLE_SYSCALLS): Do define even when
541 SCM_COPT_THREADS is defined.
542 (SCM_SYSCALL): Use EINTR-expection version when SCM_COPT_THREADS
543 is defined.
544
545 * coop-pthreads.c: Some harmless renamings of internal stuff.
546 (create_thread): New, generalized version of
547 scm_call_with_new_thread.
548 (scm_call_with_new_thread): Use it.
549 (scm_spawn_thread): New, use create_thread.
550
d52f53b1
MV
5512002-11-02 Marius Vollmer <mvo@zagadka.ping.de>
552
553 * coop-pthreads.c, coop-pthreads.h: Redone completely, you might
554 start testing it now.
555
556 * _scm.h: Include <errno.h< so that SCM_SYSCALL is correctly
557 defined when HAVE_RESTARTABLE_SYSCALLS is not defined.
558 (HAVE_RESTARTABLE_SYSCALLS): Do not define when USE_COPT_THREADS
559 is defined.
560
30f920c3
MV
5612002-10-27 Marius Vollmer <mvo@zagadka.ping.de>
562
563 * scmsigs.c (signal_cell_handlers, install_handler_data,
564 scm_delq_spine_x, really_install_handler, install_handler): New
565 scheme for triggering signal handlers, to simplify take_signal.
566 (take_signal): Simplified, to avoid race conditions.
567 (scm_sigaction_for_thread): Use new Scheme. Validate that thread
568 hasn't exited yet.
569
570 * async.c (scm_async_click): Reset pending_asyncs, handle
571 signal_asyncs. Don't set cdr of a non-signal async to #f.
572 (scm_i_queue_async_cell): Do not check cdr of cell for #f, queue
573 always. Set pending_asyncs.
574 (scm_system_async_mark_for_thread): Check that thread has not
575 exited.
576 (scm_unmask_signals, decrease_block): Call scm_async_click after
577 block_asyncs becomes zero.
578
579 * __scm.h (SCM_ASYNC_CLICK): Check pending_asyncs instead of
580 active_asyncs.
581
582 * root.h (scm_root_state): Added pending_asyncs and signal_asyncs
583 fields.
584 * root.c (root_mark): Mark them.
585 (make_root): Initialize them.
586
587 * iselect.c, iselect.h: Replaced GUILE_ISELECT with
588 USE_COOP_THREADS.
589 (scm_internal_select): Define one version for USE_COOP_THREADS and
590 one for USE_NULL_THREADS.
591 (scm_init_iselect): Likewise.
592
593 * inline.h (scm_cell, scm_double_cell): Also allow
594 USE_COPT_THREADS to not protect the slot initializers.
595
596 * init.c (scm_init_guile_1): Call scm_init_thread_procs. This is
597 because threads need to be initialized before the stack, but
598 gsubrs such as scm_timed_condition_variable_wait can only be
599 created later.
600
601 * threads.h: Include "coop-pthreads.h" when requested.
602 (scm_threads_make_mutex, scm_threads_lock_mutex,
603 scm_threads_unlock_mutex, scm_threads_monitor): Removed, they were
604 not implemented anyway.
605 (scm_init_thread_procs, scm_try_mutex,
606 scm_timed_condition_variable_wait,
607 scm_broadcast_condition_variable, scm_c_thread_exited_p,
608 scm_thread_exited_p): New prototypes.
609 (struct timespec): Define if not already defined.
610 (scm_t_mutex, scm_mutex_init, scm_mutex_lock, scm_mutex_trylock,
611 scm_mutex_unlock, scm_mutex_destroy, scm_t_cond, scm_cond_init,
612 scm_cond_wait, scm_cond_timedwait, scm_cond_signal,
613 scm_cond_broadcast, scm_cond_destroy): Declarations moved here and
614 deprecated.
615
616 * threads.c: Include <errno.h>. Include "coop-pthreads.c" when
617 requested.
618 (scm_thread_exited_p): New.
619 (scm_try_mutex, scm_broadcast_condition_variable): Newly
620 registered procedures.
621 (scm_wait_condition_variable, scm_timed_wait_condition_variable):
622 Use the latter as the procedure for "wait-condition-variable",
623 thus offering a optional timeout parameter to Scheme.
624 (scm_wait_condition_variable): Implement in terms of
625 scm_timed_wait_condition_variable.
626 (scm_mutex_init, scm_mutex_lock, scm_mutex_trylock,
627 scm_mutex_unlock, scm_mutex_destroy, scm_cond_init,
628 scm_cond_wait, scm_cond_timedwait, scm_cond_signal,
629 scm_cond_broadcast, scm_cond_destroy): Implement in terms of
630 scm_make_mutex, etc, and deprecate.
631 (scm_init_threads): Do not create smobs, leave this to
632 scm_threads_init. Do not include "threads.x" file.
633 (scm_init_thread_procs): New, include "threads.x" here.
634
635 * null-threads.h (scm_null_mutex, scm_null_mutex_init,
636 scm_null_mutex_lock, scm_null_mutex_unlock,
637 scm_null_mutex_destroy, scm_null_condvar, scm_null_condvar_init,
638 scm_null_condvar_wait, scm_null_condvar_signal,
639 scm_null_condvar_destroy): Removed.
640 (scm_mutex_init, scm_mutex_lock, scm_mutex_unlock, scm_cond_init,
641 scm_cond_wait, scm_cond_signal, scm_cond_broadcast,
642 scm_cond_destory): Do not define, they are now deprecated and
643 handled by threads.{h,c}.
644
645 * null-threads.c (scm_null_mutex, scm_null_cond): Define here.
646 (scm_threads_init): Create smobs here, using the appropriate
647 sizes.
648 (block): Removed, now unused.
649 (scm_c_thread_exited_p): New.
650 (scm_null_mutex_init, scm_null_mutex_lock, scm_null_mutex_unlock,
651 scm_null_mutex_destroy, scm_null_condvar_init,
652 scm_null_condvar_wait, scm_null_condvar_signal,
653 scm_null_condvar_destroy): Removed and updated users to do their
654 task directly.
655 (scm_try_mutex, timeval_subtract,
656 scm_timed_wait_condition_variable,
657 scm_broadcast_condition_variable): New.
658 (scm_wait_condition_variable): Removed.
659
660 * coop-defs.h (coop_m): Added 'level' field.
661 (scm_t_mutex, scm_mutex_init, scm_mutex_lock, scm_mutex_trylock,
662 scm_mutex_unlock, scm_mutex_destroy, scm_t_cond, scm_cond_init,
663 scm_cond_wait, scm_cond_timedwait, scm_cond_signal,
664 scm_cond_broadcast, scm_cond_destroy, struct timespec): Do not
665 define.
666 (coop_condition_variable_broadcast): New.
667
668 * coop-threads.c (scm_threads_init): Create smobs here, using the
669 appropriate sizes.
670 (scm_c_thread_exited_p, scm_try_mutex,
671 scm_timed_wait_condition_variable,
672 scm_broadcast_condition_variable): New.
673 (scm_wait_condition_variable): Removed.
674
675 * coop.c (coop_new_mutex_init): Initialize level.
676 (coop_mutex_trylock, coop_mutex_lock, coop_mutex_unlock): maintain
677 level.
678 (coop_condition_variable_signal): Renamed to
679 coop_condition_variable_broadcast and reimplemented in terms of
680 that. Thus...
681 (coop_condition_variable_broadcast): New.
682
683 * goops.c (hell_mutex): Reimplemented using scm_make_mutex, etc.
684
685 * coop-pthreads.h, coop-pthreads.c: New, but unfinished.
686
087ed40d
MV
6872002-10-21 Marius Vollmer <mvo@zagadka.ping.de>
688
65a23095
MV
689 * null-threads.c: Include <time.h>. Also, use <...> for inclusion
690 of system headers.
691
087ed40d
MV
692 * async.c, goops.h, modules.h, validate.h (SCM_MAKE_VALIDATE_MSG):
693 New. Use it instead of SCM_MAKE_VALIDATE in lots of places to
30f920c3 694 give better error messages. Thanks to Bill Schottstaedt!
087ed40d 695
5ec1d2c8
DH
6962002-10-19 Dirk Herrmann <D.Herrmann@tu-bs.de>
697
698 * evalext.h, evalext.c (scm_definedp, scm_defined_p): Renamed
699 scm_definedp to scm_defined_p and deprecated scm_definedp.
700
100ae50d
DH
7012002-10-19 Dirk Herrmann <D.Herrmann@tu-bs.de>
702
703 * async.h, async.c (scm_system_async): Fixed deprecation to work
704 correctly when deprecated features are excluded.
705
2794cb50
MV
7062002-10-16 Marius Vollmer <marius.vollmer@uni-dortmund.de>
707
708 * async.c (scm_system_async_mark_for_thread): Validate thread
709 argument.
710
711 * coop-threads.c (scm_i_thread_root): Do not validate argument.
712
713 * feature.c (scm_init_feature): Don't add 'threads' for
714 USE_NULL_THREADS.
715
716 * inline.h (scm_cell, scm_double_cell): Also allow
717 USE_NULL_THREADS to not protect the slot initializers.
718
719 * scmsigs.c (scm_sigaction_for_thread): It's "USE_THREADS" not
720 "USE_THREAD".
721
722 * Makefile.am (noinst_HEADERS): Added null-threads.c.
723 (modinclude_HEADERS): Added null-threads.h.
724
725 * threads.h: Include null-threads.h when !USE_COOP_THREADS.
726 * threads.c: Include null-threads.c when !USE_COOP_THREADS.
727 (scm_init_threads): Use generic type names scm_t_mutex and
728 scm_t_cond instead of coop_m and coop_c.
729
730 * null-threads.c, null-threads.h: New files.
731
ff810d7a
MV
7322002-10-15 Marius Vollmer <mvo@zagadka.ping.de>
733
734 * Makefile.am: Replaced "$<" in non-pattern rules with its value.
735 This is to support makes that know about "$<" only in pattern
736 rules, like Sun's make.
737
a90bdb73
MV
7382002-10-13 Marius Vollmer <mvo@zagadka.ping.de>
739
740 * Makefile.am (libpath.h): Fixed typo in top_srcdir_absolute
741 substitution. Thanks to David Allouche!
742
e71a8bf2
DH
7432002-10-13 Dirk Herrmann <D.Herrmann@tu-bs.de>
744
745 * evalext.h: Replaced SCM_DEBUG_DEPRECATED with
746 !SCM_ENABLE_DEPRECATED.
747
41f77ff5
MV
7482002-10-11 Marius Vollmer <marius.vollmer@uni-dortmund.de>
749
504d99c5 750 * async.c (scm_system_async_mark_for_thread): Only call
41f77ff5
MV
751 scm_i_thread_root when USE_THREADS is defined. Use scm_root
752 otherwise.
753
754 * scmsigs.c (take_signal): Only call scm_i_thread_root when
755 USE_THREADS is defined. Use scm_root otherwise.
756 (scm_sigaction_for_thread): Ignore THREAD argument when
757 USE_THREADS is not defined. Also, move THREAD argument defaulting
758 out of HAVE_SIGACTION section, which was a bug.
759
6d16b125
MV
7602002-10-10 Marius Vollmer <marius.vollmer@uni-dortmund.de>
761
762 * scmsigs.c (scm_sigaction_for_thread): Store original handler in
763 signal_handlers, not the closure that is used as the async.
764 The closure is stored in signal_handler_cells, as previously.
765
acfa1f52
MV
7662002-10-10 Marius Vollmer <mvo@zagadka.ping.de>
767
768 * root.h (scm_root_state): Added 'block_async' slot.
769 (scm_active_asyncs): Removed abbrev.
770 * root.c (scm_make_root): Initialize 'block_asyncs' slot.
771
772 * __scm.h (SCM_ASYNC_TICK): Do without the scm_active_asyncs
773 abbrev.
774
775 * async.h (scm_call_with_blocked_asyncs,
776 scm_call_with_unblocked_asyncs, scm_c_call_with_blocked_asyncs,
777 scm_c_call_with_unblocked_asyncs): New prototypes.
778 (scm_mask_signals, scm_unmask_signals): Deprecated.
779 (scm_mask_ints): Turned into a macro.
780 * async.c (scm_mask_ints): Removed.
781 (scm_run_asyncs): Do not set scm_mask_ints while running an async.
782 this should not be necessary.
783 (scm_async_click): Test block_asyncs instead of scm_mask_ints.
784 (scm_mask_signals, scm_unmask_signals): Deprecated. Emit
785 deprecation warning and check for errornous use. Set block_asyncs
786 instead of scm_mask_ints.
787 (increase_block, decrease_block, scm_call_with_blocked_asyncs,
788 scm_call_with_unblocked_asyncs, scm_c_call_with_blocked_asyncs,
789 scm_c_call_with_unblocked_asyncs): New.
790
791 * script.c (scm_compile_shell_switches): Do not set scm_mask_ints.
792 Asyncs are enabled by default.
793
34010f56
NJ
7942002-10-09 Neil Jerram <neil@ossau.uklinux.net>
795
796 * vports.c (scm_make_soft_port): Allow vector argument to carry a
797 6th element: an input waiting thunk.
798 (sf_input_waiting): New.
799
9310d6f2
MV
8002002-10-05 Marius Vollmer <mvo@zagadka.ping.de>
801
802 * root.c (root_mark): Mark active_asyncs slot.
803
804 * async.c (scm_async_click): Set the cdr of a executed handler
805 cell to SCM_BOOL_F, not SCM_EOL.
806 (scm_i_queue_async_cell): Queue the cell at the end of the list,
807 and only if the handler procedure is not already present.
808 (scm_system_async_mark_for_thread): Initialize cdr of handler cell
809 with SCM_BOOL_F.
810 * scmsigs.c (scm_sigaction_for_thread): Likewise.
811
ac48c719
RB
8122002-10-04 Rob Browning <rlb@defaultvalue.org>
813
1360a142
RB
814 * guile.c (main): switch to scm_lt_dlset_preloaded_symbols;
815
816 * dynl.c (sysdep_dynl_link): switch to scm_lt_dlhandle,
817 scm_lt_dlopenext, and scm_lt_dlerror.
818 (sysdep_dynl_unlink): switch to scm_lt_dlhandle, scm_lt_dlclose,
819 and scm_lt_dlerror.
820 (sysdep_dynl_func): switch to scm_lt_dlhandle, scm_lt_dlsym,
821 and scm_lt_dlerror.
822 (sysdep_dynl_init): switch to scm_lt_dlinit();
823
824 * Makefile.am (libguile_la_LIBADD): switch to use
825 libguile-ltdl.la.
826
504d99c5 827 * numbers.c (scm_integer_expt): (expt 0 1) should be 1.
ac48c719 828
497092c9
MV
8292002-10-04 Marius Vollmer <mvo@zagadka.ping.de>
830
831 * scmsigs.h (scm_sigaction_for_thread): New prototype.
832 * scmsigs.c (got_signal): Removed.
833 (signal_handler_cells, signal_handler_threads): New.
834 (take_signal): Queue the cell of the signal for the specified
835 thread. Reset the signal handler on systems that don't have
836 sigaction.
837 (sys_deliver_signals): Removed.
838 (close_1): New.
839 (scm_sigaction_for_thread): Renamed from scm_sigaction and
840 extended to also set the thread of a signal and allocate a cell
841 for it. Keep the Scheme name "sigaction". Check that signum is
842 within range. Also, use SCM_VECTOR_REF instead of SCM_VELTS.
843 (scm_sigaction): Implement in terms of scm_sigaction_for_thread.
844 (scm_init_scmsigs): Allocate signal_handler_cells and
845 signal_handler_threads vectors.
846
847 * async.c: Removed GUILE_OLD_ASYNC_CLICK code. Reorganized so
848 that system asnycs and user asyncs are separated. Reimplemented
849 system asyncs to work per-thread.
850
851 * gc.c (scm_init_gc): Do not use scm_system_async.
852
853 * async.h (scm_asyncs_pending, scm_set_tick_rate,
854 scm_set_switch_rate, scm_system_async_mark_from_signal_handler):
855 Removed prototypes.
856 (scm_i_queue_async_cell): New.
857
858 * __scm.h (scm_asyncs_pending_p): Removed.
859 (SCM_ASYNC_CLICK): Check scm_active_asyncs instead of
860 scm_asyncs_pending_p.
861
862 * async.h (scm_system_async_mark_for_thread): New prototype.
863
864 * __scm.h: Removed GUILE_OLD_ASYNC_CLICK code.
865
866 * root.h (scm_root_state): Added new "active_asyncs" slot.
867 * root.c (scm_make_root): Initialize it to SCM_EOL.
868
869 * coop-defs.h (coop_t): Added new "handle" slot.
870 * coop-threads.c (all_threads, scm_current_thread,
871 scm_all_threads, scm_i_thread_root): New.
872 (scm_threads_init): Add main thread to all_threads.
873 (scheme_launch_thread): Remove thread from all_threads when it
874 terminates.
875 (scm_call_with_new_thread): Initialize handle slot of coop_t
876 structure and add new thread to all_threads.
877 (scm_spawn_thread): Likewise.
878
879 * threads.h (scm_current_thread, scm_all_threads): New prototypes.
880 * threads.c (scm_current_thread, scm_all_threads): Register as
881 primitives.
882
883 * dynl.c: Use scm_lt_ prefix for libltdl functions.
884
480fa28d
NJ
8852002-09-29 Neil Jerram <neil@ossau.uklinux.net>
886
887 * script.c (scm_compile_shell_switches): Fix bad spelling of
888 `explicitly' in comment.
889
8902002-09-28 Neil Jerram <neil@ossau.uklinux.net>
891
892 * posix.c (scm_geteuid, scm_getegid, scm_seteuid, scm_setegid):
893 Refer to provided? in doc string rather than deprecated feature?.
894
3553e1d1
GH
8952002-09-24 Gary Houston <ghouston@arglist.com>
896
897 * inline.h (scm_double_cell): prevent reordering of statements
898 with any following code (for GCC 3 strict-aliasing).
899 * numbers.c (scm_make_real), num2float.i.c (FLOAT2NUM): removed
900 the earlier version of the reordering prevention.
901
4ad0814a
HWN
9022002-09-19 Han-Wen Nienhuys <hanwen@cs.uu.nl>
903
904 * inline.h (scm_double_cell): move SET_GCMARK set out of if body.
905
e88e4f2e
HWN
9062002-09-09 Han-Wen Nienhuys <hanwen@cs.uu.nl>
907
908 * gc-malloc.c (scm_gc_register_collectable_memory): more overflow
909 protection.
910
1e71eafb
HWN
9112002-09-08 Han-Wen Nienhuys <hanwen@cs.uu.nl>
912
913 * inline.h: include stdio.h
914
915 * smob.c (free_print): abort if scm_debug_cell_accesses_p is set
916
61ef9c1f
HWN
9172002-09-05 Han-Wen Nienhuys <hanwen@cs.uu.nl>
918
dac04e9f
HWN
919 * gc-segment.c (scm_i_make_initial_segment): check user settings
920 for sanity.
921
922 * gc-malloc.c (scm_gc_init_malloc): check user settings for
923 sanity.
dac04e9f
HWN
924
925 * gc-freelist.c (scm_init_freelist): check user settings for sanity.
926
ffd72400
HWN
927 * struct.h: change scm_structs_to_free to scm_i_structs_to_free
928
929 * gc-malloc.c (scm_gc_register_collectable_memory): use floats;
1e71eafb
HWN
930 these won't ever wrap around with high memory usage. Thanks to
931 Sven Hartrumpf for finding this.
ffd72400 932
5bd4a949
HWN
933 * gc-freelist.c: include <stdio.h>
934
61ef9c1f
HWN
935 * gc-malloc.c: add DEBUGINFO for mtrigger GCs.
936
ffd0ef3b
MV
9372002-09-01 Marius Vollmer <mvo@zagadka.ping.de>
938
a27e3d14
MV
939 * vectors.h (SCM_VECTOR_REF): New.
940
ffd0ef3b
MV
941 * snarf.h (SCM_DEFINE_PUBLIC): New.
942
f8a1712b
MV
9432002-08-30 Marius Vollmer <mvo@zagadka.ping.de>
944
945 * socket.c (scm_addr_vector): Added size of address to arguments.
946 Use it to avoid accessing a non-existent path in a sockaddr_un.
947 Changed all callers.
948
7200a36b
HWN
9492002-08-29 Han-Wen Nienhuys <hanwen@cs.uu.nl>
950
1383773b
HWN
951 * gc.h: remove DOUBLECELL card flags.
952
953 * gc-malloc.c (scm_calloc): try to use calloc() before calling
954 scm_realloc().
955
956 * gc-segment.c (scm_i_initialize_heap_segment_data): remove card
957 init loop; handle this from scm_init_card_freelist()
958
959 * gc-card.c (scm_init_card_freelist): init bit vector here.
960
7200a36b 961 * numbers.c (scm_make_real): prevent reordering of statements
8fa5786d 962 num2float.i.c (FLOAT2NUM): idem
7200a36b 963
9981de3a
HWN
9642002-08-27 Han-Wen Nienhuys <hanwen@cs.uu.nl>
965
966 * eval.h: prepend libguile/ to include path
967
19647556
MV
9682002-08-26 Marius Vollmer <mvo@zagadka.ping.de>
969
970 * script.c (scm_compile_shell_switches): Added "2002" to Copyright
971