mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* modules.c (scm_export): new function
* gc-card.c: add a note about malloc()/free() overhead.
This commit is contained in:
parent
a12611c3e7
commit
06e80f59f9
4 changed files with 44 additions and 5 deletions
1
THANKS
1
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
|
||||
|
|
|
@ -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>
|
||||
|
||||
* Makefile.am (c-tokenize.$(OBJEXT)): Don't look for c-tokenize.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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue