1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 14:21:10 +02:00

* modules.c (scm_export): new function

* gc-card.c: add a note about malloc()/free() overhead.
This commit is contained in:
Han-Wen Nienhuys 2002-12-10 13:26:25 +00:00
parent a12611c3e7
commit 06e80f59f9
4 changed files with 44 additions and 5 deletions

1
THANKS
View file

@ -26,6 +26,7 @@ For fixes or providing information which led to a fix:
Clinton Ebadi Clinton Ebadi
Eric Gillespie, Jr Eric Gillespie, Jr
John Goerzen John Goerzen
Sven Hartrumpf
Eric Hanchrow Eric Hanchrow
Aubrey Jaffer Aubrey Jaffer
Richard Kim Richard Kim

View file

@ -1,3 +1,9 @@
2002-12-10 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* modules.c (scm_export): new function
* gc-card.c: add a note about malloc()/free() overhead.
2002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net> 2002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net>
* Makefile.am (c-tokenize.$(OBJEXT)): Don't look for c-tokenize.c * Makefile.am (c-tokenize.$(OBJEXT)): Don't look for c-tokenize.c

View file

@ -81,9 +81,28 @@ SCM scm_i_structs_to_free;
It would be cleaner to have a separate function sweep_value(), but It would be cleaner to have a separate function sweep_value(), but
that is too slow (functions with switch statements can't be that is too slow (functions with switch statements can't be
inlined). inlined).
*/
NOTE:
This function is quite efficient. However, for many types of cells,
allocation and a de-allocation involves calling malloc() and
free().
This is costly for small objects (due to malloc/free overhead.)
(should measure this).
It might also be bad for threads: if several threads are allocating
strings concurrently, then mallocs for both threads may have to
fiddle with locks.
It might be interesting to add a separate memory pool for small
objects to each freelist.
--hwn.
*/
int int
scm_i_sweep_card (scm_t_cell * p, SCM *free_list, scm_t_heap_segment*seg) scm_i_sweep_card (scm_t_cell * p, SCM *free_list, scm_t_heap_segment*seg)
#define FUNC_NAME "sweep_card" #define FUNC_NAME "sweep_card"

View file

@ -115,6 +115,10 @@ scm_c_call_with_current_module (SCM module,
return scm_c_with_fluid (the_module, module, func, data); return scm_c_with_fluid (the_module, module, func, data);
} }
/*
convert "A B C" to scheme list (A B C)
*/
static SCM static SCM
convert_module_name (const char *name) convert_module_name (const char *name)
{ {
@ -177,6 +181,16 @@ scm_c_use_module (const char *name)
static SCM module_export_x_var; static SCM module_export_x_var;
/*
TODO: should export this function? --hwn.
*/
static SCM
scm_export (SCM module, SCM namelist)
{
scm_call_2 (SCM_VARIABLE_REF (module_export_x_var),
module, namelist);
}
/* /*
@code{scm_c_export}(@var{name-list}) @code{scm_c_export}(@var{name-list})
@ -189,7 +203,6 @@ static SCM module_export_x_var;
scm_c_export ("add-double-record", "bamboozle-money", NULL); scm_c_export ("add-double-record", "bamboozle-money", NULL);
@end example @end example
*/ */
void void
scm_c_export (const char *name, ...) scm_c_export (const char *name, ...)
{ {
@ -208,11 +221,11 @@ scm_c_export (const char *name, ...)
tail = SCM_CDRLOC (*tail); tail = SCM_CDRLOC (*tail);
} }
va_end (ap); va_end (ap);
scm_call_2 (SCM_VARIABLE_REF (module_export_x_var), scm_export (scm_current_module(), names);
scm_current_module (), names);
} }
} }
/* Environments */ /* Environments */
SCM SCM