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