* gc.c (scm_gc_mark): Mark struct setter slot.
* gc.c (scm_gc_sweep): Bugfix: Look for SCM_STRUCT_F_LIGHT flag at
scm_struct_i_flags instead of scm_vtable_index_layout!
* gc.c (scm_gc_mark, scm_gc_sweep): Added case labels for
scm_tc7_pws.
take the address of _into; it might be a register. Just have
scm_debug_newcell return the new cell.
* gc.c (scm_debug_newcell): Just return the new cell, instead of
taking the address of a place to store it as an argument.
* gc.h (scm_debug_newcell): Change declaration.
(Thanks to Greg Harvey.)
they get passed the port object, not the port's stream.
* ports.h (scm_ptobfuns): Rename all `stream' arguments to `port'.
* gc.c (scm_gc_sweep): Pass the port itself to the free function.
* genio.c (scm_putc, scm_puts, scm_lfwrite, scm_fflush, scm_getc):
Pass the port itself to the scm_ptobs function.
* ports.c (scm_close_port, scm_force_output, scm_flush_all_ports,
scm_generic_fgets): Same.
(putc_void_port, puts_void_port, write_void_port, flush_void_port,
getc_void_port, fgets_void_port, close_void_port): Just change the
argument names; these functions don't really do anything.
* fports.c (local_fgetc, local_fgets, local_fclose, local_fflush,
local_fputc, local_fputs, local_ffwrite, local_pclose): Take the
port as an argument, and use SCM_STREAM to get the stdio FILE *.
Also, use prototyped definitions, and get rid of the extra
declarations.
(scm_fptob, scm_pipob): We don't need casts here any more.
* strports.c (prinstpt): Use prototype declarations.
(stputc, stwrite, stputs, stgetc): Take the port as an argument,
and use SCM_STREAM to get the string info. Also, use prototyped
definitions, and get rid of the extra declarations.
* vports.c (sfputc, sfwrite, sfputs, sfflush, sfgetc, sfclose,
noop0): Same.
* gc.c (scm_mtrigger, scm_heap_size): Make these unsigned longs.
(scm_gc_sweep): Make n and j local to the blocks they're used in,
so they can have appropriate types for each application. Make i
signed. Use initializers in some spots. I'll probably pay for
all this tweaking.
(scm_must_malloc, scm_must_realloc): Use scm_sizet for size args.
(scm_must_realloc): Make nm unsigned.
(init_heap_seg): Make new_seg_index and n_new_objects signed.
(scm_init_storage): Use prototype-style definition, and make the
argument unsigned.
* gc.h (scm_heap_size, scm_mtrigger, scm_must_malloc,
scm_must_realloc, scm_init_storage): Adjust prototype accordingly.
marking code, and make marker routines only responsible for
turning up outgoing pointers.
* gc.c (scm_gc_mark): Set the mark bit on ports and smobs here,
before calling the marking function. Don't call the marking
function if it's zero.
* markers.c (scm_mark0): Just return #f. This function isn't
necessary at all now, but it's harmless to call it. We'll leave
it in so other folks' code doesn't croak at link time.
(scm_markcdr): Don't call SCM_SETGC8MARK.
* async.c (mark_async): Don't call SCM_SETGC8MARK.
* dynl.c (mark_dynl_obj): Same.
* root.c (mark_root): Same.
* srcprop.c (marksrcprops): Same.
* unif.c (markra): Same.
* variable.c (scm_markvar): Same.
* ports.c (scm_markstream): Same.
(void_port_ptob): Specify zero for our marking function.
* debug.c (debugobjsmob): Same.
* dynwind.c (guardsmob): Same.
* filesys.c (dir_smob): Same.
* fluids.c (fluid_smob): Same.
* fports.c (scm_fptob, scm_pipob): Same.
* mallocs.c (mallocsmob): Same.
* regex-posix.c (regex_t_smob): Same.
* smob.c (freecell, flob, bigob): Same.
* threads.c (thread_smob, mutex_smob, condvar_smob): Same.
* throw.c (jbsmob, lazy_catch_funs): Same.
* print.h (SCM_PRINT_STATE_P): Removed SCM_NIMP test. (NIMP
macros should by convention not test for NIMPness.)
(SCM_COERCE_OPORT): Adjust indentation.
* print.c (scm_valid_oport_value_p): Adjusted indentation; Added
SCM_NIMP test before SCM_PRINT_STATE_P.
* struct.c, struct.h, gc.c: Renamed:
scm_struct_i_layout --> scm_vtable_index_layout
scm_struct_i_vcell --> scm_vtable_index_vcell
scm_struct_i_vtable --> scm_vtable_index_vtable
scm_struct_i_printer --> scm_vtable_index_printer
scm_struct_i_vtable_offset --> scm_vtable_offset_user
* struct.c (scm_print_struct): Use new printer slot; Default
printing: Also output hex code of vtable so that type identity
will be indicated as well.
(scm_init_struct): Updated required_vtable_fields to "pruosrpw";
Removed struct_printer_var; Removed struct-vtable-offset;
(vtable-index-layout, vtable-index-vtable, vtable-index-printer,
vtable-offset-user): New constants.
* struct.h (scm_struct_i_vtable_offset): Bumped from 3 to 4.
(scm_struct_i_printer, SCM_STRUCT_PRINTER): New slot in vtables.
If this slot contains a procedure, use that to print structures of
the type represented by this vtable.
* print.c (scm_iprin1): Don't print arguments of macro
transformers. (They are always: exp env.); Bugfix: Unmemoize
transformer source with correct environment.
when they are non-NULL.
(scm_gc_mark): Likewise, mark only when non-NULL.
* gc.c (scm_done_malloc): New function.
gc.h (scm_done_malloc): New prototype.
sure how this was supposed to work.
(scm_async_click): don't send SCM_TICK_SIGNAL.
(scm_init_async): don't initialize %tick-thunk.
* the following change doesn't affect the Scheme interface:
gc-thunk is called at the end of garbage collection. however it's
no longer implemented by pretending it's a signal.
* gc.c (scm_gc_end): don't call scm_take_signal. instead mark the
system async corresponding to scm_gc_thunk.
* async.h: declare scm_gc_async.
* async.c (scm_sys_gc_async_thunk): apply the thunk named by
gc-thunk directly, instead of going through a signal handler.
(scm_gc_async): new variable, points to the GC system-async.
(scm_init_async): save the GC async as scm_gc_async instead
of using system_signal_asyncs.
(scm_gc_vcell): new variable, stores the gc-thunk vcell.
Their prototypes were already present in gc.h, but they weren't
implemented.
(scm_init_storage): Initialize scm_protects.
* root.c (scm_protects): New element of scm_sys_protects.
(scm_must_malloc, scm_must_realloc): Added a hysteresis to the
rules for raising scm_mtrigger. Previously, unfortunate but not
unlikely circumstances could result in almost constant invokation
of the gc. Now, this situations should be less likely, but they
are not prevented completely.
* gc.c (scm_gc_sweep): Prepend each segment's free cells to its
freelist, rather than wiping out the old value. (Thanks to Marius
Vollmer.)
* gc.c (which_seg, scm_map_free_list, scm_newcell_count,
scm_check_freelist, scm_debug_newcell): New functions and
variables, for debugging freelist problems.
* pairs.h (SCM_NEWCELL): New debugging version added.
* gc.h (scm_debug_newcell): Added extern declaration, used by
debugging version of SCM_NEWCELL.
ramap.c, symbols.c: Added new selectors SCM_CARLOC and SCM_CDRLOC
for obtaining the address of a car or cdr field. Motivation:
&SCM_CXR make assumptions about the internal structure of the
SCM_CXR selectors.
* pairs.h, eval.c, gc.c, init.c, ioext.c, ports.c, ports.h,
srcprop.h, tags.h, throw.c, unif.c: Added new selectors
SCM_SETAND_CAR, SCM_SETAND_CDR, SCM_SETOR_CAR and SCM_SETOR_CDR.
Motivation: Safer use. Some other macros are defined in terms of
these operations. If these are defined using the SCM_SETCXR
(<e1>, SCM_CXR (<e1>) <op> <e2>) pattern a complex <e1> will lead
to inefficiency and an <e1> with side-effects could potentially
break. Also, these particular operations are heavily utilized in
the garbage collector. In unoptimized code there will be a
measurable speedup.
* alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)
required by the tagging system.
* struct.c (alloc_struct): New function.
(scm_make_struct, scm_make_vtable_vtable): Call it.
* struct.h (scm_struct_n_extra_words): Bump to 3.
(scm_struct_i_ptr): New "field".
* gc.c (scm_gc_sweep): When we need to free the data, use the
information stored by alloc_struct to find the beginning of the
block allocated to the structure, so we can free it.
scm_struct_set_x), struct.h, gc.c (scm_gc_mark): Completed Tom
Lord's implementation of structs, allowing for tail arrays as
described in the manual. Also fixed some bugs. (Both the interface
and the implementation should be improved.)
* gc.c: Use the PROTO macro when declaring static functions.
Remove the CPP hair around function definitions.
* gc.c (scm_init_storage): Initialize scm_asyncs.