From 228a24ef30e635e58af0e4fe5fc9b9db738abeff Mon Sep 17 00:00:00 2001 From: Dirk Herrmann Date: Fri, 1 Mar 2002 00:19:20 +0000 Subject: [PATCH] Changes in doc/ref: * api.txt, data-rep.texi: Renamed the struct scm_cell to scm_t_cell. * data-rep.texi: Renamed scm_alloc_cell to scm_cell and scm_alloc_double_cell to scm_double_cell. Changes in libguile: * gc.c (SCM_HEAP_SEG_SIZE, CELL_UP, CELL_DN, NEXT_DATA_CELL, init_heap_seg, alloc_some_heap), gc.h (struct scm_cell, struct scm_t_cell, SCM_CELLPTR, SCM_GC_CARD_SIZE, SCM_GC_IN_CARD_HEADERP), tags.h (SCM_CELLP): Renamed the struct scm_cell and all its uses to scm_t_cell in accordance to Guile's naming scheme for types. * alist.c (scm_acons), convert.i.c (CTYPES2UVECT, CTYPES2UVECT_OPTIONAL), coop-threads.c (scm_call_with_new_thread, scm_spawn_thread), debug.c (scm_make_debugobj), environments.c (scm_make_environment), eval.c (scm_closure), fports.c (scm_fdes_to_port), gc.c (scm_deprecated_newcell, scm_deprecated_newcell2), inline.h (scm_alloc_cell, scm_cell), list.c (SCM_I_CONS), numbers.c (scm_i_mkbig), pairs.c (scm_cons), ports.c (scm_void_port), procs.c (scm_c_make_subr, scm_makcclo), smob.c (scm_make_smob), smob.h (SCM_NEWSMOB), strings.c (scm_take_str, scm_allocate_string), strports.c (scm_mkstrport), unif.c (scm_make_uve), variable.c (make_variable), vectors.c (scm_c_make_vector), vports.c (scm_make_soft_port): Renamed scm_alloc_cell to scm_cell. * environments.c (core_environments_observe), gc.c (scm_deprecated_newcell2), goops.c (wrap_init, scm_wrap_object), inline.h (scm_alloc_double_cell, scm_double_cell), num2float.i.c (FLOAT2NUM), numbers.c (scm_make_real), procs.c (scm_make_procedure_with_setter), smob.h (SCM_NEWSMOB2, SCM_NEWSMOB3), struct.c (scm_make_struct, scm_make_vtable_vtable), symbols.c (scm_mem2symbol, scm_mem2uninterned_symbol), weaks.c (allocate_weak_vector): Renamed scm_alloc_double_cell to scm_double_cell. --- NEWS | 15 ++++++++++----- doc/ref/ChangeLog | 8 ++++++++ doc/ref/api.txt | 8 ++++---- doc/ref/data-rep.texi | 16 ++++++++-------- libguile/ChangeLog | 33 +++++++++++++++++++++++++++++++++ libguile/alist.c | 6 +++--- libguile/convert.i.c | 6 +++--- libguile/coop-threads.c | 4 ++-- libguile/debug.c | 2 +- libguile/environments.c | 12 +++++------- libguile/eval.c | 3 +-- libguile/fports.c | 2 +- libguile/gc.c | 34 +++++++++++++++++----------------- libguile/gc.h | 12 ++++++------ libguile/gh_data.c | 2 +- libguile/goops.c | 12 ++++++------ libguile/inline.h | 12 ++++++------ libguile/list.c | 2 +- libguile/num2float.i.c | 2 +- libguile/numbers.c | 4 ++-- libguile/pairs.c | 2 +- libguile/ports.c | 2 +- libguile/procs.c | 10 +++++----- libguile/smob.c | 2 +- libguile/smob.h | 9 ++++----- libguile/strings.c | 4 ++-- libguile/strports.c | 2 +- libguile/struct.c | 10 +++++----- libguile/symbols.c | 22 ++++++++++------------ libguile/tags.h | 2 +- libguile/unif.c | 10 +++++----- libguile/variable.c | 2 +- libguile/vectors.c | 3 +-- libguile/vports.c | 2 +- libguile/weaks.c | 18 ++++++++---------- 35 files changed, 166 insertions(+), 129 deletions(-) diff --git a/NEWS b/NEWS index dd3e4c1db..76aa249c3 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,12 @@ Use `substring-move!' instead. * Changes to the C interface +** The struct scm_cell has been renamed to scm_t_cell + +This is in accordance to Guile's naming scheme for types. Note that +the name scm_cell is now used for a function that allocates and +initializes a new cell (see below). + ** New functions for memory management A new set of functions for memory management has been added since the @@ -94,11 +100,10 @@ SCM_SRFI4_IMPORT, for the corresponding libraries. ** SCM_NEWCELL and SCM_NEWCELL2 have been deprecated. -Use the new functions scm_alloc_cell and scm_alloc_double_cell -instead. The old macros had problems because with them allocation and -initialization was separated and the GC could sometimes observe half -initialized cells. Only careful coding by the user of SCM_NEWCELL and -SCM_NEWCELL2 could make this safe and efficient. +Use the new functions scm_cell and scm_double_cell instead. The old macros +had problems because with them allocation and initialization was separated and +the GC could sometimes observe half initialized cells. Only careful coding by +the user of SCM_NEWCELL and SCM_NEWCELL2 could make this safe and efficient. Changes since Guile 1.4: diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index 03c3ee36e..aa7ea31fe 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,3 +1,11 @@ +2002-03-01 Dirk Herrmann + + * api.txt, data-rep.texi: Renamed the struct scm_cell to + scm_t_cell. + + * data-rep.texi: Renamed scm_alloc_cell to scm_cell and + scm_alloc_double_cell to scm_double_cell. + 2002-03-01 Marius Vollmer * scheme-memory.texi (Upgrading from scm_must_malloc et al): New diff --git a/doc/ref/api.txt b/doc/ref/api.txt index 367cbbf95..cc26b839f 100644 --- a/doc/ref/api.txt +++ b/doc/ref/api.txt @@ -66,8 +66,8 @@ determined from the scm_bits_t value that is delivered by SCM_UNPACK (x). Non immediate objects ===================== -- (scm_cell *) SCM2PTR (SCM x) (FIXME:: this name should be changed) -- SCM PTR2SCM (scm_cell * x) (FIXME:: this name should be changed) +- (scm_t_cell *) SCM2PTR (SCM x) (FIXME:: this name should be changed) +- SCM PTR2SCM (scm_t_cell * x) (FIXME:: this name should be changed) A scheme object of type SCM that does not fullfill the SCM_IMP predicate holds an encoded reference to a heap cell. This reference can be decoded to a C @@ -76,14 +76,14 @@ a heap cell into a SCM value is done using the PTR2SCM macro. Note that it is also possible to transform a non immediate SCM value by using SCM_UNPACK into a scm_bits_t variable. Hower, the result of SCM_UNPACK may -not be used as a pointer to a scm_cell: Only SCM2PTR is guaranteed to +not be used as a pointer to a scm_t_cell: Only SCM2PTR is guaranteed to transform a SCM object into a valid pointer to a heap cell. Also, it is not allowed to apply PTR2SCM to anything that is not a valid pointer to a heap cell. Summary: * Only use SCM2PTR for SCM values for which SCM_IMP is false! -* Don't use '(scm_cell*) SCM_UNPACK (x)'! Use 'SCM2PTR (x)' instead! +* Don't use '(scm_t_cell*) SCM_UNPACK (x)'! Use 'SCM2PTR (x)' instead! * Don't use PTR2SCM for anything but a cell pointer! diff --git a/doc/ref/data-rep.texi b/doc/ref/data-rep.texi index 5624ddfbe..d3a9aa678 100644 --- a/doc/ref/data-rep.texi +++ b/doc/ref/data-rep.texi @@ -46,7 +46,7 @@ @c essay @sp 10 @c essay @comment The title is printed in a large font. @c essay @title Data Representation in Guile -@c essay @subtitle $Id: data-rep.texi,v 1.4 2002-02-28 20:58:50 mvo Exp $ +@c essay @subtitle $Id: data-rep.texi,v 1.5 2002-03-01 00:19:20 dirk Exp $ @c essay @subtitle For use with Guile @value{VERSION} @c essay @author Jim Blandy @c essay @author Free Software Foundation @@ -1150,13 +1150,13 @@ This reference can be decoded to a C pointer to a heap cell using the @code{SCM} value is done using the @code{PTR2SCM} macro. @c (FIXME:: this name should be changed) -@deftypefn Macro (scm_cell *) SCM2PTR (SCM @var{x}) +@deftypefn Macro (scm_t_cell *) SCM2PTR (SCM @var{x}) Extract and return the heap cell pointer from a non-immediate @code{SCM} object @var{x}. @end deftypefn @c (FIXME:: this name should be changed) -@deftypefn Macro SCM PTR2SCM (scm_cell * @var{x}) +@deftypefn Macro SCM PTR2SCM (scm_t_cell * @var{x}) Return a @code{SCM} value that encodes a reference to the heap cell pointer @var{x}. @end deftypefn @@ -1164,7 +1164,7 @@ pointer @var{x}. Note that it is also possible to transform a non-immediate @code{SCM} value by using @code{SCM_UNPACK} into a @code{scm_t_bits} variable. However, the result of @code{SCM_UNPACK} may not be used as a pointer to -a @code{scm_cell}: only @code{SCM2PTR} is guaranteed to transform a +a @code{scm_t_cell}: only @code{SCM2PTR} is guaranteed to transform a @code{SCM} object into a valid pointer to a heap cell. Also, it is not allowed to apply @code{PTR2SCM} to anything that is not a valid pointer to a heap cell. @@ -1176,7 +1176,7 @@ Summary: Only use @code{SCM2PTR} on @code{SCM} values for which @code{SCM_IMP} is false! @item -Don't use @code{(scm_cell *) SCM_UNPACK (@var{x})}! Use @code{SCM2PTR +Don't use @code{(scm_t_cell *) SCM_UNPACK (@var{x})}! Use @code{SCM2PTR (@var{x})} instead! @item Don't use @code{PTR2SCM} for anything but a cell pointer! @@ -1198,7 +1198,7 @@ the code in @code{}. If you just want to allocate pairs, use @code{scm_cons}. -@deftypefn Function SCM scm_alloc_cell (scm_t_bits word_0, scm_t_bits word_1) +@deftypefn Function SCM scm_cell (scm_t_bits word_0, scm_t_bits word_1) Allocate a new cell, initialize the two slots with @var{word_0} and @var{word_1}, and return it. @@ -1207,8 +1207,8 @@ If you want to pass a @code{SCM} object, you need to use @code{SCM_UNPACK}. @end deftypefn -@deftypefn Function SCM scm_alloc_double_cell (scm_t_bits word_0, scm_t_bits word_1, scm_t_bits word_2, scm_t_bits word_3) -Like @code{scm_alloc_cell}, but allocates a double cell with four +@deftypefn Function SCM scm_double_cell (scm_t_bits word_0, scm_t_bits word_1, scm_t_bits word_2, scm_t_bits word_3) +Like @code{scm_cell}, but allocates a double cell with four slots. @end deftypefn diff --git a/libguile/ChangeLog b/libguile/ChangeLog index ae93bdc1d..f86d494d0 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,36 @@ +2002-03-01 Dirk Herrmann + + * gc.c (SCM_HEAP_SEG_SIZE, CELL_UP, CELL_DN, NEXT_DATA_CELL, + init_heap_seg, alloc_some_heap), gc.h (struct scm_cell, struct + scm_t_cell, SCM_CELLPTR, SCM_GC_CARD_SIZE, + SCM_GC_IN_CARD_HEADERP), tags.h (SCM_CELLP): Renamed the struct + scm_cell and all its uses to scm_t_cell in accordance to Guile's + naming scheme for types. + + * alist.c (scm_acons), convert.i.c (CTYPES2UVECT, + CTYPES2UVECT_OPTIONAL), coop-threads.c (scm_call_with_new_thread, + scm_spawn_thread), debug.c (scm_make_debugobj), environments.c + (scm_make_environment), eval.c (scm_closure), fports.c + (scm_fdes_to_port), gc.c (scm_deprecated_newcell, + scm_deprecated_newcell2), inline.h (scm_alloc_cell, scm_cell), + list.c (SCM_I_CONS), numbers.c (scm_i_mkbig), pairs.c (scm_cons), + ports.c (scm_void_port), procs.c (scm_c_make_subr, scm_makcclo), + smob.c (scm_make_smob), smob.h (SCM_NEWSMOB), strings.c + (scm_take_str, scm_allocate_string), strports.c (scm_mkstrport), + unif.c (scm_make_uve), variable.c (make_variable), vectors.c + (scm_c_make_vector), vports.c (scm_make_soft_port): Renamed + scm_alloc_cell to scm_cell. + + * environments.c (core_environments_observe), gc.c + (scm_deprecated_newcell2), goops.c (wrap_init, scm_wrap_object), + inline.h (scm_alloc_double_cell, scm_double_cell), num2float.i.c + (FLOAT2NUM), numbers.c (scm_make_real), procs.c + (scm_make_procedure_with_setter), smob.h (SCM_NEWSMOB2, + SCM_NEWSMOB3), struct.c (scm_make_struct, scm_make_vtable_vtable), + symbols.c (scm_mem2symbol, scm_mem2uninterned_symbol), weaks.c + (allocate_weak_vector): Renamed scm_alloc_double_cell to + scm_double_cell. + 2002-02-27 Stefan Jahn * convert.i.c, convert.c: Better range checking. diff --git a/libguile/alist.c b/libguile/alist.c index a3cdde604..07bd64356 100644 --- a/libguile/alist.c +++ b/libguile/alist.c @@ -59,9 +59,9 @@ SCM_DEFINE (scm_acons, "acons", 3, 0, 0, "function is @emph{not} destructive; @var{alist} is not modified.") #define FUNC_NAME s_scm_acons { - return scm_alloc_cell (SCM_UNPACK (scm_alloc_cell (SCM_UNPACK (key), - SCM_UNPACK (value))), - SCM_UNPACK (alist)); + return scm_cell (SCM_UNPACK (scm_cell (SCM_UNPACK (key), + SCM_UNPACK (value))), + SCM_UNPACK (alist)); } #undef FUNC_NAME diff --git a/libguile/convert.i.c b/libguile/convert.i.c index 80a0c30ff..0d78711c7 100644 --- a/libguile/convert.i.c +++ b/libguile/convert.i.c @@ -197,7 +197,7 @@ CTYPES2UVECT (const CTYPE *data, long n) n > 0 && n <= SCM_UVECTOR_MAX_LENGTH); v = scm_gc_malloc (n * sizeof (CTYPE), "uvect"); memcpy (v, data, n * sizeof (CTYPE)); - return scm_alloc_cell (SCM_MAKE_UVECTOR_TAG (n, UVECTTYPE), (scm_t_bits) v); + return scm_cell (SCM_MAKE_UVECTOR_TAG (n, UVECTTYPE), (scm_t_bits) v); } #undef FUNC_NAME @@ -212,8 +212,8 @@ CTYPES2UVECT_OPTIONAL (const unsigned CTYPE *data, long n) n > 0 && n <= SCM_UVECTOR_MAX_LENGTH); v = scm_gc_malloc (n * sizeof (unsigned CTYPE) * n, "uvect"); memcpy (v, data, n * sizeof (unsigned CTYPE)); - return scm_alloc_cell (SCM_MAKE_UVECTOR_TAG (n, UVECTTYPE_OPTIONAL), - (scm_t_bits) v); + return scm_cell (SCM_MAKE_UVECTOR_TAG (n, UVECTTYPE_OPTIONAL), + (scm_t_bits) v); } #undef FUNC_NAME #endif /* UVECTTYPE_OPTIONAL */ diff --git a/libguile/coop-threads.c b/libguile/coop-threads.c index 95498b310..a3f4018e0 100644 --- a/libguile/coop-threads.c +++ b/libguile/coop-threads.c @@ -257,7 +257,7 @@ scm_call_with_new_thread (SCM argl) /* Allocate thread locals. */ root = scm_make_root (scm_root->handle); /* Make thread. */ - thread = scm_alloc_cell (scm_tc16_thread, 0); + thread = scm_cell (scm_tc16_thread, 0); SCM_DEFER_INTS; argl = scm_cons (thread, argl); /* Note that we couldn't pass a pointer to argl as data since the @@ -343,7 +343,7 @@ scm_spawn_thread (scm_t_catch_body body, void *body_data, /* Allocate thread locals. */ root = scm_make_root (scm_root->handle); /* Make thread. */ - thread = scm_alloc_cell (scm_tc16_thread, 0); + thread = scm_cell (scm_tc16_thread, 0); SCM_DEFER_INTS; data->u.thread = thread; diff --git a/libguile/debug.c b/libguile/debug.c index 82b647b3a..11f34cd2c 100644 --- a/libguile/debug.c +++ b/libguile/debug.c @@ -539,7 +539,7 @@ SCM_DEFINE (scm_debug_object_p, "debug-object?", 1, 0, 0, SCM scm_make_debugobj (scm_t_debug_frame *frame) { - return scm_alloc_cell (scm_tc16_debugobj, (scm_t_bits) frame); + return scm_cell (scm_tc16_debugobj, (scm_t_bits) frame); } diff --git a/libguile/environments.c b/libguile/environments.c index 3db13b036..10ce8c8ca 100644 --- a/libguile/environments.c +++ b/libguile/environments.c @@ -119,7 +119,7 @@ scm_error_environment_immutable_location (const char *func, SCM env, SCM symbol) SCM scm_make_environment (void *type) { - return scm_alloc_cell (scm_tc16_environment, (scm_t_bits) type); + return scm_cell (scm_tc16_environment, (scm_t_bits) type); } @@ -662,12 +662,10 @@ struct core_environments_base { static SCM core_environments_observe (SCM env, scm_environment_observer proc, SCM data, int weak_p) { - SCM observer; - - observer = scm_alloc_double_cell (scm_tc16_observer, - SCM_UNPACK (env), - SCM_UNPACK (data), - (scm_t_bits) proc); + SCM observer = scm_double_cell (scm_tc16_observer, + SCM_UNPACK (env), + SCM_UNPACK (data), + (scm_t_bits) proc); if (!weak_p) { diff --git a/libguile/eval.c b/libguile/eval.c index 2fff70468..4c3d53e95 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -3836,8 +3836,7 @@ scm_closure (SCM code, SCM env) { SCM z; SCM closcar = scm_cons (code, SCM_EOL); - z = scm_alloc_cell (SCM_UNPACK (closcar) + scm_tc3_closure, - (scm_t_bits) env); + z = scm_cell (SCM_UNPACK (closcar) + scm_tc3_closure, (scm_t_bits) env); scm_remember_upto_here (closcar); return z; } diff --git a/libguile/fports.c b/libguile/fports.c index 882405cec..2fe0bee0c 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -436,7 +436,7 @@ scm_fdes_to_port (int fdes, char *mode, SCM name) SCM_MISC_ERROR ("requested file mode not available on fdes", SCM_EOL); } - port = scm_alloc_cell (scm_tc16_fport, 0); + port = scm_cell (scm_tc16_fport, 0); SCM_DEFER_INTS; pt = scm_add_to_port_table (port); SCM_SETPTAB_ENTRY (port, pt); diff --git a/libguile/gc.c b/libguile/gc.c index 6e781f721..3da2861e1 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -277,9 +277,9 @@ size_t scm_default_max_segment_size = 2097000L;/* a little less (adm) than 2 Mb # define SCM_HEAP_SEG_SIZE 32768L #else # ifdef sequent -# define SCM_HEAP_SEG_SIZE (7000L * sizeof (scm_cell)) +# define SCM_HEAP_SEG_SIZE (7000L * sizeof (scm_t_cell)) # else -# define SCM_HEAP_SEG_SIZE (16384L * sizeof (scm_cell)) +# define SCM_HEAP_SEG_SIZE (16384L * sizeof (scm_t_cell)) # endif #endif /* Make heap grow with factor 1.5 */ @@ -287,7 +287,7 @@ size_t scm_default_max_segment_size = 2097000L;/* a little less (adm) than 2 Mb #define SCM_INIT_MALLOC_LIMIT 100000 #define SCM_MTRIGGER_HYSTERESIS (SCM_INIT_MALLOC_LIMIT/10) -/* CELL_UP and CELL_DN are used by scm_init_heap_seg to find (scm_cell * span) +/* CELL_UP and CELL_DN are used by scm_init_heap_seg to find (scm_t_cell * span) aligned inner bounds for allocated storage */ #ifdef PROT386 @@ -299,12 +299,12 @@ size_t scm_default_max_segment_size = 2097000L;/* a little less (adm) than 2 Mb # define CELL_UP(p, span) (SCM_CELLPTR)(~(span) & ((long)(p)+(span))) # define CELL_DN(p, span) (SCM_CELLPTR)(~(span) & (long)(p)) # else -# define CELL_UP(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & ((long)(p)+sizeof(scm_cell)*(span)-1L)) -# define CELL_DN(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & (long)(p)) +# define CELL_UP(p, span) (SCM_CELLPTR)(~(sizeof(scm_t_cell)*(span)-1L) & ((long)(p)+sizeof(scm_t_cell)*(span)-1L)) +# define CELL_DN(p, span) (SCM_CELLPTR)(~(sizeof(scm_t_cell)*(span)-1L) & (long)(p)) # endif /* UNICOS */ #endif /* PROT386 */ -#define DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_cell) - 1) & SCM_UNPACK (x)) == 0) +#define DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0) #define ALIGNMENT_SLACK(freelist) (SCM_GC_CARD_SIZE - 1) #define CLUSTER_SIZE_IN_BYTES(freelist) \ @@ -1544,7 +1544,7 @@ gc_sweep_freelist_finish (scm_t_freelist *freelist) #define NEXT_DATA_CELL(ptr, span) \ do { \ - scm_cell *nxt__ = CELL_UP ((char *) (ptr) + 1, (span)); \ + scm_t_cell *nxt__ = CELL_UP ((char *) (ptr) + 1, (span)); \ (ptr) = (SCM_GC_IN_CARD_HEADERP (nxt__) ? \ CELL_UP (SCM_GC_CELL_CARD (nxt__) + SCM_GC_CARD_N_HEADER_CELLS, span) \ : nxt__); \ @@ -2201,9 +2201,9 @@ init_heap_seg (SCM_CELLPTR seg_org, size_t size, scm_t_freelist *freelist) NEXT_DATA_CELL (ptr, span); while (ptr < seg_end) { - scm_cell *nxt = ptr; - scm_cell *prv = NULL; - scm_cell *last_card = NULL; + scm_t_cell *nxt = ptr; + scm_t_cell *prv = NULL; + scm_t_cell *last_card = NULL; int n_data_cells = (SCM_GC_CARD_N_DATA_CELLS / span) * SCM_CARDS_PER_CLUSTER - 1; NEXT_DATA_CELL(nxt, span); @@ -2216,7 +2216,7 @@ init_heap_seg (SCM_CELLPTR seg_org, size_t size, scm_t_freelist *freelist) while (n_data_cells--) { - scm_cell *card = SCM_GC_CELL_CARD (ptr); + scm_t_cell *card = SCM_GC_CELL_CARD (ptr); SCM scmptr = PTR2SCM (ptr); nxt = ptr; NEXT_DATA_CELL (nxt, span); @@ -2239,7 +2239,7 @@ init_heap_seg (SCM_CELLPTR seg_org, size_t size, scm_t_freelist *freelist) /* sanity check */ { - scm_cell *ref = seg_end; + scm_t_cell *ref = seg_end; NEXT_DATA_CELL (ref, span); if (ref != ptr) /* [cmm] looks like the segment size doesn't divide cleanly by @@ -2344,7 +2344,7 @@ alloc_some_heap (scm_t_freelist *freelist, policy_on_error error_policy) #endif if (len < min_cells) len = min_cells + freelist->cluster_size; - len *= sizeof (scm_cell); + len *= sizeof (scm_t_cell); /* force new sampling */ freelist->collected = LONG_MAX; } @@ -2831,18 +2831,18 @@ SCM scm_deprecated_newcell (void) { scm_c_issue_deprecation_warning - ("SCM_NEWCELL is deprecated. Use `scm_alloc_cell' instead.\n"); + ("SCM_NEWCELL is deprecated. Use `scm_cell' instead.\n"); - return scm_alloc_cell (scm_tc16_allocated, 0); + return scm_cell (scm_tc16_allocated, 0); } SCM scm_deprecated_newcell2 (void) { scm_c_issue_deprecation_warning - ("SCM_NEWCELL2 is deprecated. Use `scm_alloc_double_cell' instead.\n"); + ("SCM_NEWCELL2 is deprecated. Use `scm_double_cell' instead.\n"); - return scm_alloc_double_cell (scm_tc16_allocated, 0, 0, 0); + return scm_double_cell (scm_tc16_allocated, 0, 0, 0); } #endif /* SCM_ENABLE_DEPRECATED == 1 */ diff --git a/libguile/gc.h b/libguile/gc.h index 7d575bc96..fce0add19 100644 --- a/libguile/gc.h +++ b/libguile/gc.h @@ -52,24 +52,24 @@ -typedef struct scm_cell +typedef struct scm_t_cell { scm_t_bits word_0; scm_t_bits word_1; -} scm_cell; +} scm_t_cell; /* SCM_CELLPTR is a pointer to a cons cell which may be compared or * differenced. */ -typedef scm_cell * SCM_CELLPTR; +typedef scm_t_cell * SCM_CELLPTR; /* Cray machines have pointers that are incremented once for each word, * rather than each byte, the 3 most significant bits encode the byte * within the word. The following macros deal with this by storing the * native Cray pointers like the ones that looks like scm expects. This - * is done for any pointers that might appear in the car of a scm_cell, + * is done for any pointers that might appear in the car of a scm_t_cell, * pointers to scm_vector elts, functions, &c are not munged. */ #ifdef _UNICOS @@ -83,14 +83,14 @@ typedef scm_cell * SCM_CELLPTR; #define SCM_GC_CARD_N_HEADER_CELLS 1 #define SCM_GC_CARD_N_CELLS 256 -#define SCM_GC_CARD_SIZE (SCM_GC_CARD_N_CELLS * sizeof (scm_cell)) +#define SCM_GC_CARD_SIZE (SCM_GC_CARD_N_CELLS * sizeof (scm_t_cell)) #define SCM_GC_CARD_N_DATA_CELLS (SCM_GC_CARD_N_CELLS - SCM_GC_CARD_N_HEADER_CELLS) #define SCM_GC_CARD_BVEC_SIZE_IN_LIMBS \ ((SCM_GC_CARD_N_CELLS + SCM_C_BVEC_LIMB_BITS - 1) / SCM_C_BVEC_LIMB_BITS) #define SCM_GC_IN_CARD_HEADERP(x) \ - SCM_PTR_LT ((scm_cell *) (x), SCM_GC_CELL_CARD (x) + SCM_GC_CARD_N_HEADER_CELLS) + SCM_PTR_LT ((scm_t_cell *) (x), SCM_GC_CELL_CARD (x) + SCM_GC_CARD_N_HEADER_CELLS) #define SCM_GC_CARD_BVEC(card) ((scm_t_c_bvec_limb *) ((card)->word_0)) #define SCM_GC_SET_CARD_BVEC(card, bvec) \ diff --git a/libguile/gh_data.c b/libguile/gh_data.c index ceef34db0..31c9ea730 100644 --- a/libguile/gh_data.c +++ b/libguile/gh_data.c @@ -149,7 +149,7 @@ gh_doubles2scm (const double *d, long n) static SCM makvect (char *m, size_t len, int type) { - return scm_alloc_cell (SCM_MAKE_UVECTOR_TAG (len, type), (scm_t_bits) m); + return scm_cell (SCM_MAKE_UVECTOR_TAG (len, type), (scm_t_bits) m); } SCM diff --git a/libguile/goops.c b/libguile/goops.c index 5c9e0f99b..fde237149 100644 --- a/libguile/goops.c +++ b/libguile/goops.c @@ -1306,9 +1306,9 @@ wrap_init (SCM class, SCM *m, long n) for (i = 0; i < n; i++) m[i] = SCM_GOOPS_UNBOUND; - return scm_alloc_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (class)) - | scm_tc3_struct), - (scm_t_bits) m, 0, 0); + return scm_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (class)) + | scm_tc3_struct), + (scm_t_bits) m, 0, 0); } SCM_DEFINE (scm_sys_allocate_instance, "%allocate-instance", 2, 0, 0, @@ -2580,9 +2580,9 @@ scm_add_slot (SCM class, char *slot_name, SCM slot_class, SCM scm_wrap_object (SCM class, void *data) { - return scm_alloc_double_cell (SCM_UNPACK (SCM_CDR (class)) | scm_tc3_struct, - (scm_t_bits) data, - 0, 0); + return scm_double_cell (SCM_UNPACK (SCM_CDR (class)) | scm_tc3_struct, + (scm_t_bits) data, + 0, 0); } SCM scm_components; diff --git a/libguile/inline.h b/libguile/inline.h index 9d3b6fca1..19566bcce 100644 --- a/libguile/inline.h +++ b/libguile/inline.h @@ -55,7 +55,7 @@ #ifdef HAVE_INLINE static inline SCM -scm_alloc_cell (scm_t_bits car, scm_t_bits cdr) +scm_cell (scm_t_bits car, scm_t_bits cdr) { SCM z; @@ -102,8 +102,8 @@ scm_alloc_cell (scm_t_bits car, scm_t_bits cdr) } static inline SCM -scm_alloc_double_cell (scm_t_bits car, scm_t_bits cbr, - scm_t_bits ccr, scm_t_bits cdr) +scm_double_cell (scm_t_bits car, scm_t_bits cbr, + scm_t_bits ccr, scm_t_bits cdr) { SCM z; @@ -153,9 +153,9 @@ scm_alloc_double_cell (scm_t_bits car, scm_t_bits cbr, #else /* !HAVE_INLINE */ -SCM_API SCM scm_alloc_cell (scm_t_bits car, scm_t_bits cdr); -SCM_API SCM scm_alloc_double_cell (scm_t_bits car, scm_t_bits cbr, - scm_t_bits ccr, scm_t_bits cdr); +SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr); +SCM_API SCM scm_double_cell (scm_t_bits car, scm_t_bits cbr, + scm_t_bits ccr, scm_t_bits cdr); #endif diff --git a/libguile/list.c b/libguile/list.c index 2197a61f5..7b0161cdf 100644 --- a/libguile/list.c +++ b/libguile/list.c @@ -61,7 +61,7 @@ #define SCM_I_CONS(cell,x,y) \ do { \ - cell = scm_alloc_cell ((scm_t_bits)x, (scm_t_bits)y); \ + cell = scm_cell ((scm_t_bits)x, (scm_t_bits)y); \ } while (0) SCM diff --git a/libguile/num2float.i.c b/libguile/num2float.i.c index a3e669266..b393ba9b7 100644 --- a/libguile/num2float.i.c +++ b/libguile/num2float.i.c @@ -32,7 +32,7 @@ SCM FLOAT2NUM (FTYPE n) { SCM z; - z = scm_alloc_double_cell (scm_tc16_real, 0, 0, 0); + z = scm_double_cell (scm_tc16_real, 0, 0, 0); SCM_REAL_VALUE (z) = n; return z; } diff --git a/libguile/numbers.c b/libguile/numbers.c index bdb6f4ca3..98c045b78 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -1390,7 +1390,7 @@ scm_i_mkbig (size_t nlen, int sign) base = scm_gc_malloc (nlen * sizeof (SCM_BIGDIG), s_bignum); - v = scm_alloc_cell (SCM_MAKE_BIGNUM_TAG (nlen, sign), (scm_t_bits) base); + v = scm_cell (SCM_MAKE_BIGNUM_TAG (nlen, sign), (scm_t_bits) base); return v; } @@ -2827,7 +2827,7 @@ SCM scm_make_real (double x) { SCM z; - z = scm_alloc_double_cell (scm_tc16_real, 0, 0, 0); + z = scm_double_cell (scm_tc16_real, 0, 0, 0); SCM_REAL_VALUE (z) = x; return z; } diff --git a/libguile/pairs.c b/libguile/pairs.c index 5216de8bb..bc4831480 100644 --- a/libguile/pairs.c +++ b/libguile/pairs.c @@ -80,7 +80,7 @@ SCM_DEFINE (scm_cons, "cons", 2, 0, 0, "sense of @code{eq?}) from every previously existing object.") #define FUNC_NAME s_scm_cons { - return scm_alloc_cell (SCM_UNPACK (x), SCM_UNPACK (y)); + return scm_cell (SCM_UNPACK (x), SCM_UNPACK (y)); } #undef FUNC_NAME diff --git a/libguile/ports.c b/libguile/ports.c index 33c6cab89..4acf1fdd6 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -1531,7 +1531,7 @@ scm_void_port (char *mode_str) SCM answer; scm_t_port * pt; - answer = scm_alloc_cell (scm_tc16_void_port, 0); + answer = scm_cell (scm_tc16_void_port, 0); SCM_DEFER_INTS; mode_bits = scm_mode_bits (mode_str); pt = scm_add_to_port_table (answer); diff --git a/libguile/procs.c b/libguile/procs.c index afc81cd23..dae2e104e 100644 --- a/libguile/procs.c +++ b/libguile/procs.c @@ -85,7 +85,7 @@ scm_c_make_subr (const char *name, long type, SCM (*fcn) ()) } entry = scm_subr_table_size; - z = scm_alloc_cell ((entry << 8) + type, (scm_t_bits) fcn); + z = scm_cell ((entry << 8) + type, (scm_t_bits) fcn); scm_subr_table[entry].handle = z; scm_subr_table[entry].name = scm_str2symbol (name); scm_subr_table[entry].generic = 0; @@ -160,7 +160,7 @@ scm_makcclo (SCM proc, size_t len) for (i = 0; i < len; ++i) base [i] = SCM_UNPACK (SCM_UNSPECIFIED); - s = scm_alloc_cell (SCM_MAKE_CCLO_TAG (len), (scm_t_bits) base); + s = scm_cell (SCM_MAKE_CCLO_TAG (len), (scm_t_bits) base); SCM_SET_CCLO_SUBR (s, proc); return s; } @@ -320,9 +320,9 @@ SCM_DEFINE (scm_make_procedure_with_setter, "make-procedure-with-setter", 2, 0, { SCM_VALIDATE_PROC (1, procedure); SCM_VALIDATE_PROC (2, setter); - return scm_alloc_double_cell (scm_tc7_pws, - SCM_UNPACK (procedure), - SCM_UNPACK (setter), 0); + return scm_double_cell (scm_tc7_pws, + SCM_UNPACK (procedure), + SCM_UNPACK (setter), 0); } #undef FUNC_NAME diff --git a/libguile/smob.c b/libguile/smob.c index 94133a797..e907fb107 100644 --- a/libguile/smob.c +++ b/libguile/smob.c @@ -462,7 +462,7 @@ scm_make_smob (scm_t_bits tc) scm_t_bits data = (size > 0 ? (scm_t_bits) scm_gc_malloc (size, SCM_SMOBNAME (n)) : 0); - return scm_alloc_cell (tc, data); + return scm_cell (tc, data); } diff --git a/libguile/smob.h b/libguile/smob.h index be87b255e..50de243ce 100644 --- a/libguile/smob.h +++ b/libguile/smob.h @@ -72,7 +72,7 @@ typedef struct scm_smob_descriptor #define SCM_NEWSMOB(z, tc, data) \ do { \ - z = scm_alloc_cell ((tc), (scm_t_bits) (data)); \ + z = scm_cell ((tc), (scm_t_bits) (data)); \ } while (0) #define SCM_RETURN_NEWSMOB(tc, data) \ @@ -83,8 +83,7 @@ do { \ #define SCM_NEWSMOB2(z, tc, data1, data2) \ do { \ - z = scm_alloc_double_cell ((tc), (scm_t_bits)(data1), \ - (scm_t_bits)(data2), 0); \ + z = scm_double_cell ((tc), (scm_t_bits)(data1), (scm_t_bits)(data2), 0); \ } while (0) #define SCM_RETURN_NEWSMOB2(tc, data1, data2) \ @@ -95,8 +94,8 @@ do { \ #define SCM_NEWSMOB3(z, tc, data1, data2, data3) \ do { \ - z = scm_alloc_double_cell ((tc), (scm_t_bits)(data1), \ - (scm_t_bits)(data2), (scm_t_bits)(data3)); \ + z = scm_double_cell ((tc), (scm_t_bits)(data1), \ + (scm_t_bits)(data2), (scm_t_bits)(data3)); \ } while (0) #define SCM_RETURN_NEWSMOB3(tc, data1, data2, data3) \ diff --git a/libguile/strings.c b/libguile/strings.c index c7517626d..d8580b7eb 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -132,7 +132,7 @@ scm_take_str (char *s, size_t len) SCM_ASSERT_RANGE (2, scm_ulong2num (len), len <= SCM_STRING_MAX_LENGTH); - answer = scm_alloc_cell (SCM_MAKE_STRING_TAG (len), (scm_t_bits) s); + answer = scm_cell (SCM_MAKE_STRING_TAG (len), (scm_t_bits) s); scm_gc_register_collectable_memory (s, len+1, "string"); return answer; @@ -194,7 +194,7 @@ scm_allocate_string (size_t len) mem = (char *) scm_gc_malloc (len + 1, "string"); mem[len] = 0; - s = scm_alloc_cell (SCM_MAKE_STRING_TAG (len), (scm_t_bits) mem); + s = scm_cell (SCM_MAKE_STRING_TAG (len), (scm_t_bits) mem); return s; } diff --git a/libguile/strports.c b/libguile/strports.c index daf68b5f3..0a75a4068 100644 --- a/libguile/strports.c +++ b/libguile/strports.c @@ -279,7 +279,7 @@ scm_mkstrport (SCM pos, SCM str, long modes, const char *caller) scm_out_of_range (caller, pos); if (!((modes & SCM_WRTNG) || (modes & SCM_RDNG))) scm_misc_error ("scm_mkstrport", "port must read or write", SCM_EOL); - z = scm_alloc_cell (scm_tc16_strport, 0); + z = scm_cell (scm_tc16_strport, 0); SCM_DEFER_INTS; pt = scm_add_to_port_table (z); SCM_SET_CELL_TYPE (z, scm_tc16_strport | modes); diff --git a/libguile/struct.c b/libguile/struct.c index a384c8647..075388e42 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -460,9 +460,9 @@ SCM_DEFINE (scm_make_struct, "make-struct", 2, 0, 1, data = scm_alloc_struct (basic_size + tail_elts, scm_struct_n_extra_words, "struct"); - handle = scm_alloc_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (vtable)) - + scm_tc3_struct), - (scm_t_bits) data, 0, 0); + handle = scm_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (vtable)) + + scm_tc3_struct), + (scm_t_bits) data, 0, 0); scm_struct_init (handle, layout, data, tail_elts, init); SCM_ALLOW_INTS; return handle; @@ -539,8 +539,8 @@ SCM_DEFINE (scm_make_vtable_vtable, "make-vtable-vtable", 2, 0, 1, data = scm_alloc_struct (basic_size + tail_elts, scm_struct_n_extra_words, "struct"); - handle = scm_alloc_double_cell ((scm_t_bits) data + scm_tc3_struct, - (scm_t_bits) data, 0, 0); + handle = scm_double_cell ((scm_t_bits) data + scm_tc3_struct, + (scm_t_bits) data, 0, 0); data [scm_vtable_index_layout] = SCM_UNPACK (layout); scm_struct_init (handle, layout, data, tail_elts, scm_cons (layout, init)); SCM_ALLOW_INTS; diff --git a/libguile/symbols.c b/libguile/symbols.c index c6979f9a4..57ead5cab 100644 --- a/libguile/symbols.c +++ b/libguile/symbols.c @@ -125,12 +125,11 @@ scm_mem2symbol (const char *name, size_t len) SCM cell; SCM slot; - symbol = scm_alloc_double_cell (SCM_MAKE_SYMBOL_TAG (len), - (scm_t_bits) scm_gc_strndup (name, len, - "symbol"), - raw_hash, - SCM_UNPACK (scm_cons (SCM_BOOL_F, - SCM_EOL))); + symbol = scm_double_cell (SCM_MAKE_SYMBOL_TAG (len), + (scm_t_bits) scm_gc_strndup (name, len, + "symbol"), + raw_hash, + SCM_UNPACK (scm_cons (SCM_BOOL_F, SCM_EOL))); slot = SCM_VELTS (symbols) [hash]; cell = scm_cons (symbol, SCM_UNDEFINED); @@ -146,12 +145,11 @@ scm_mem2uninterned_symbol (const char *name, size_t len) size_t raw_hash = (scm_string_hash ((const unsigned char *) name, len)/2 + SCM_T_BITS_MAX/2 + 1); - return scm_alloc_double_cell (SCM_MAKE_SYMBOL_TAG (len), - (scm_t_bits) scm_gc_strndup (name, len, - "symbol"), - raw_hash, - SCM_UNPACK (scm_cons (SCM_BOOL_F, - SCM_EOL))); + return scm_double_cell (SCM_MAKE_SYMBOL_TAG (len), + (scm_t_bits) scm_gc_strndup (name, len, + "symbol"), + raw_hash, + SCM_UNPACK (scm_cons (SCM_BOOL_F, SCM_EOL))); } SCM diff --git a/libguile/tags.h b/libguile/tags.h index 1e9090ede..37d4a0f60 100644 --- a/libguile/tags.h +++ b/libguile/tags.h @@ -533,7 +533,7 @@ SCM_API char *scm_isymnames[]; /* defined in print.c */ #if (SCM_ENABLE_DEPRECATED == 1) -#define SCM_CELLP(x) (((sizeof (scm_cell) - 1) & SCM_UNPACK (x)) == 0) +#define SCM_CELLP(x) (((sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0) #define SCM_NCELLP(x) (!SCM_CELLP (x)) #endif diff --git a/libguile/unif.c b/libguile/unif.c index 96bdfa4f0..b900df50e 100644 --- a/libguile/unif.c +++ b/libguile/unif.c @@ -170,11 +170,11 @@ scm_make_uve (long k, SCM prot) SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_BITVECTOR_MAX_LENGTH); i = sizeof (long) * ((k + SCM_LONG_BIT - 1) / SCM_LONG_BIT); - v = scm_alloc_cell (SCM_MAKE_BITVECTOR_TAG (k), - (scm_t_bits) scm_gc_malloc (i, "vector")); + v = scm_cell (SCM_MAKE_BITVECTOR_TAG (k), + (scm_t_bits) scm_gc_malloc (i, "vector")); } else - v = scm_alloc_cell (SCM_MAKE_BITVECTOR_TAG (0), 0); + v = scm_cell (SCM_MAKE_BITVECTOR_TAG (0), 0); return v; } else if (SCM_CHARP (prot) && (SCM_CHAR (prot) == '\0')) @@ -239,8 +239,8 @@ scm_make_uve (long k, SCM prot) SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_UVECTOR_MAX_LENGTH); - return scm_alloc_cell (SCM_MAKE_UVECTOR_TAG (k, type), - (scm_t_bits) scm_gc_malloc (i, "vector")); + return scm_cell (SCM_MAKE_UVECTOR_TAG (k, type), + (scm_t_bits) scm_gc_malloc (i, "vector")); } #undef FUNC_NAME diff --git a/libguile/variable.c b/libguile/variable.c index 66f82b9de..b2710c113 100644 --- a/libguile/variable.c +++ b/libguile/variable.c @@ -68,7 +68,7 @@ scm_i_variable_print (SCM exp, SCM port, scm_print_state *pstate) static SCM make_variable (SCM init) { - return scm_alloc_cell (scm_tc7_variable, SCM_UNPACK (init)); + return scm_cell (scm_tc7_variable, SCM_UNPACK (init)); } SCM_DEFINE (scm_make_variable, "make-variable", 1, 0, 0, diff --git a/libguile/vectors.c b/libguile/vectors.c index c1dfe840f..bdc943760 100644 --- a/libguile/vectors.c +++ b/libguile/vectors.c @@ -215,8 +215,7 @@ scm_c_make_vector (unsigned long int k, SCM fill) else base = NULL; - v = scm_alloc_cell (SCM_MAKE_VECTOR_TAG (k, scm_tc7_vector), - (scm_t_bits) base); + v = scm_cell (SCM_MAKE_VECTOR_TAG (k, scm_tc7_vector), (scm_t_bits) base); scm_remember_upto_here_1 (fill); return v; diff --git a/libguile/vports.c b/libguile/vports.c index c25bc204f..2cf94feae 100644 --- a/libguile/vports.c +++ b/libguile/vports.c @@ -189,7 +189,7 @@ SCM_DEFINE (scm_make_soft_port, "make-soft-port", 2, 0, 0, SCM z; SCM_VALIDATE_VECTOR_LEN (1,pv,5); SCM_VALIDATE_STRING (2, modes); - z = scm_alloc_cell (scm_tc16_sfport, 0); + z = scm_cell (scm_tc16_sfport, 0); SCM_DEFER_INTS; pt = scm_add_to_port_table (z); scm_port_non_buffer (pt); diff --git a/libguile/weaks.c b/libguile/weaks.c index 08d570069..a5b194eca 100644 --- a/libguile/weaks.c +++ b/libguile/weaks.c @@ -84,20 +84,18 @@ allocate_weak_vector (scm_t_bits type, SCM size, SCM fill, const char* caller) base = scm_gc_malloc (c_size * sizeof (scm_t_bits), "weak vector"); for (j = 0; j != c_size; ++j) base[j] = SCM_UNPACK (fill); - v = scm_alloc_double_cell (SCM_MAKE_VECTOR_TAG (c_size, - scm_tc7_wvect), - (scm_t_bits) base, - type, - SCM_UNPACK (SCM_EOL)); + v = scm_double_cell (SCM_MAKE_VECTOR_TAG (c_size, scm_tc7_wvect), + (scm_t_bits) base, + type, + SCM_UNPACK (SCM_EOL)); scm_remember_upto_here_1 (fill); } else { - v = scm_alloc_double_cell (SCM_MAKE_VECTOR_TAG (0, - scm_tc7_wvect), - (scm_t_bits) NULL, - type, - SCM_UNPACK (SCM_EOL)); + v = scm_double_cell (SCM_MAKE_VECTOR_TAG (0, scm_tc7_wvect), + (scm_t_bits) NULL, + type, + SCM_UNPACK (SCM_EOL)); } return v; -- 2.20.1