diff --git a/THANKS b/THANKS index f4cc95176..3946e5842 100644 --- a/THANKS +++ b/THANKS @@ -26,6 +26,7 @@ For fixes or providing information which led to a fix: Clinton Ebadi Eric Gillespie, Jr John Goerzen + Sven Hartrumpf Eric Hanchrow Aubrey Jaffer Richard Kim diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 62a02e24e..8e1b914e3 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,9 @@ +2002-12-10 Han-Wen Nienhuys + + * modules.c (scm_export): new function + + * gc-card.c: add a note about malloc()/free() overhead. + 2002-12-10 Mikael Djurfeldt * Makefile.am (c-tokenize.$(OBJEXT)): Don't look for c-tokenize.c diff --git a/libguile/gc-card.c b/libguile/gc-card.c index 13cca2606..3926fb77f 100644 --- a/libguile/gc-card.c +++ b/libguile/gc-card.c @@ -81,9 +81,28 @@ SCM scm_i_structs_to_free; It would be cleaner to have a separate function sweep_value(), but that is too slow (functions with switch statements can't be 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 scm_i_sweep_card (scm_t_cell * p, SCM *free_list, scm_t_heap_segment*seg) #define FUNC_NAME "sweep_card" diff --git a/libguile/modules.c b/libguile/modules.c index 28b65caa2..52d054c94 100644 --- a/libguile/modules.c +++ b/libguile/modules.c @@ -115,6 +115,10 @@ scm_c_call_with_current_module (SCM module, return scm_c_with_fluid (the_module, module, func, data); } + +/* + convert "A B C" to scheme list (A B C) + */ static SCM convert_module_name (const char *name) { @@ -177,6 +181,16 @@ scm_c_use_module (const char *name) 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}) @@ -189,7 +203,6 @@ static SCM module_export_x_var; scm_c_export ("add-double-record", "bamboozle-money", NULL); @end example */ - void scm_c_export (const char *name, ...) { @@ -208,11 +221,11 @@ scm_c_export (const char *name, ...) tail = SCM_CDRLOC (*tail); } va_end (ap); - scm_call_2 (SCM_VARIABLE_REF (module_export_x_var), - scm_current_module (), names); + scm_export (scm_current_module(), names); } } + /* Environments */ SCM