1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-13 15:10:34 +02:00

Use immutable cells (aka. libgc "stubborn") for subrs.

* libguile/procs.c (scm_c_make_subr): Use `scm_immutable_cell ()' instead
  of `scm_cell ()'.
  (scm_free_subr_entry): Remove.

* libguile/procs.h (SCM_SET_SUBRNUM, SCM_SET_SUBRF): Remove.
  (scm_free_subr_entry): Remove declaration.
This commit is contained in:
Ludovic Courtès 2008-09-15 23:32:11 +02:00
parent 53ea4fdf99
commit d3be55145a
2 changed files with 1 additions and 17 deletions

View file

@ -64,7 +64,7 @@ scm_c_make_subr (const char *name, long type, SCM (*fcn) ())
}
entry = scm_subr_table_size;
z = scm_cell ((entry << 8) + type, (scm_t_bits) fcn);
z = scm_immutable_cell ((entry << 8) + type, (scm_t_bits) fcn);
scm_subr_table[entry].handle = z;
scm_subr_table[entry].name = scm_from_locale_symbol (name);
scm_subr_table[entry].generic = 0;
@ -82,18 +82,6 @@ scm_c_define_subr (const char *name, long type, SCM (*fcn) ())
return subr;
}
/* This function isn't currently used since subrs are never freed. */
/* *fixme* Need mutex here. */
void
scm_free_subr_entry (SCM subr)
{
long entry = SCM_SUBRNUM (subr);
/* Move last entry in table to the free position */
scm_subr_table[entry] = scm_subr_table[scm_subr_table_size - 1];
SCM_SET_SUBRNUM (scm_subr_table[entry].handle, entry);
scm_subr_table_size--;
}
SCM
scm_c_make_subr_with_generic (const char *name,
long type, SCM (*fcn) (), SCM *gf)

View file

@ -41,12 +41,9 @@ typedef struct
} scm_t_subr_entry;
#define SCM_SUBRNUM(subr) (SCM_CELL_WORD_0 (subr) >> 8)
#define SCM_SET_SUBRNUM(subr, num) \
SCM_SET_CELL_WORD_0 (subr, (num << 8) + SCM_TYP7 (subr))
#define SCM_SUBR_ENTRY(x) (scm_subr_table[SCM_SUBRNUM (x)])
#define SCM_SNAME(x) (SCM_SUBR_ENTRY (x).name)
#define SCM_SUBRF(x) ((SCM (*)()) SCM_CELL_WORD_1 (x))
#define SCM_SET_SUBRF(x, v) (SCM_SET_CELL_WORD_1 ((x), (v)))
#define SCM_DSUBRF(x) ((double (*)()) SCM_CELL_WORD_1 (x))
#define SCM_SUBR_PROPS(x) (SCM_SUBR_ENTRY (x).properties)
#define SCM_SUBR_GENERIC(x) (SCM_SUBR_ENTRY (x).generic)
@ -136,7 +133,6 @@ SCM_API long scm_subr_table_room;
SCM_API void scm_free_subr_entry (SCM subr);
SCM_API SCM scm_c_make_subr (const char *name, long type, SCM (*fcn)());
SCM_API SCM scm_c_make_subr_with_generic (const char *name, long type,
SCM (*fcn)(), SCM *gf);