mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Use `scm_gc_malloc_pointerless' in various places (improves performance).
* libguile/fports.c (scm_fport_buffer_add): Use `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when allocating room for the read/write buffers. * libguile/numbers.c (scm_c_make_rectangular): Likewise. * libguile/ports.c (scm_ungetc): Likewise. * libguile/random.c (scm_i_copy_rstate): Likewise. (scm_c_make_rstate): Likewise. * libguile/regex-posix.c (scm_make_regexp): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-36
This commit is contained in:
parent
6cc80cb6ab
commit
92d8fd328c
5 changed files with 20 additions and 12 deletions
|
@ -91,7 +91,7 @@ scm_fport_buffer_add (SCM port, long read_size, int write_size)
|
|||
|
||||
if (SCM_INPUT_PORT_P (port) && read_size > 0)
|
||||
{
|
||||
pt->read_buf = scm_gc_malloc (read_size, "port buffer");
|
||||
pt->read_buf = scm_gc_malloc_pointerless (read_size, "port buffer");
|
||||
pt->read_pos = pt->read_end = pt->read_buf;
|
||||
pt->read_buf_size = read_size;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ scm_fport_buffer_add (SCM port, long read_size, int write_size)
|
|||
|
||||
if (SCM_OUTPUT_PORT_P (port) && write_size > 0)
|
||||
{
|
||||
pt->write_buf = scm_gc_malloc (write_size, "port buffer");
|
||||
pt->write_buf = scm_gc_malloc_pointerless (write_size, "port buffer");
|
||||
pt->write_pos = pt->write_buf;
|
||||
pt->write_buf_size = write_size;
|
||||
}
|
||||
|
@ -432,7 +432,8 @@ scm_i_fdes_to_port (int fdes, long mode_bits, SCM name)
|
|||
pt = SCM_PTAB_ENTRY(port);
|
||||
{
|
||||
scm_t_fport *fp
|
||||
= (scm_t_fport *) scm_gc_malloc (sizeof (scm_t_fport), "file port");
|
||||
= (scm_t_fport *) scm_gc_malloc_pointerless (sizeof (scm_t_fport),
|
||||
"file port");
|
||||
|
||||
fp->fdes = fdes;
|
||||
pt->rw_random = SCM_FDES_RANDOM_P (fdes);
|
||||
|
|
|
@ -5300,8 +5300,9 @@ scm_c_make_rectangular (double re, double im)
|
|||
else
|
||||
{
|
||||
SCM z;
|
||||
SCM_NEWSMOB (z, scm_tc16_complex, scm_gc_malloc (sizeof (scm_t_complex),
|
||||
"complex"));
|
||||
SCM_NEWSMOB (z, scm_tc16_complex,
|
||||
scm_gc_malloc_pointerless (sizeof (scm_t_complex),
|
||||
"complex"));
|
||||
SCM_COMPLEX_REAL (z) = re;
|
||||
SCM_COMPLEX_IMAG (z) = im;
|
||||
return z;
|
||||
|
|
|
@ -1201,6 +1201,8 @@ scm_ungetc (int c, SCM port)
|
|||
{
|
||||
size_t new_size = pt->read_buf_size * 2;
|
||||
unsigned char *tmp = (unsigned char *)
|
||||
/* XXX: Can we use `GC_REALLOC' with `GC_MALLOC_ATOMIC'-allocated
|
||||
data? (Ludo) */
|
||||
scm_gc_realloc (pt->putback_buf, pt->read_buf_size, new_size,
|
||||
"putback buffer");
|
||||
|
||||
|
@ -1228,8 +1230,8 @@ scm_ungetc (int c, SCM port)
|
|||
if (pt->putback_buf == NULL)
|
||||
{
|
||||
pt->putback_buf
|
||||
= (unsigned char *) scm_gc_malloc (SCM_INITIAL_PUTBACK_BUF_SIZE,
|
||||
"putback buffer");
|
||||
= (unsigned char *) scm_gc_malloc_pointerless
|
||||
(SCM_INITIAL_PUTBACK_BUF_SIZE, "putback buffer");
|
||||
pt->putback_buf_size = SCM_INITIAL_PUTBACK_BUF_SIZE;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,8 +142,10 @@ scm_i_init_rstate (scm_t_i_rstate *state, const char *seed, int n)
|
|||
scm_t_i_rstate *
|
||||
scm_i_copy_rstate (scm_t_i_rstate *state)
|
||||
{
|
||||
scm_t_rstate *new_state = scm_gc_malloc (scm_the_rng.rstate_size,
|
||||
"random-state");
|
||||
scm_t_rstate *new_state;
|
||||
|
||||
new_state = scm_gc_malloc_pointerless (scm_the_rng.rstate_size,
|
||||
"random-state");
|
||||
return memcpy (new_state, state, scm_the_rng.rstate_size);
|
||||
}
|
||||
|
||||
|
@ -155,8 +157,10 @@ scm_i_copy_rstate (scm_t_i_rstate *state)
|
|||
scm_t_rstate *
|
||||
scm_c_make_rstate (const char *seed, int n)
|
||||
{
|
||||
scm_t_rstate *state = scm_gc_malloc (scm_the_rng.rstate_size,
|
||||
"random-state");
|
||||
scm_t_rstate *state;
|
||||
|
||||
state = scm_gc_malloc_pointerless (scm_the_rng.rstate_size,
|
||||
"random-state");
|
||||
state->reserved0 = 0;
|
||||
scm_the_rng.init_rstate (state, seed, n);
|
||||
return state;
|
||||
|
|
|
@ -172,7 +172,7 @@ SCM_DEFINE (scm_make_regexp, "make-regexp", 1, 0, 1,
|
|||
flag = SCM_CDR (flag);
|
||||
}
|
||||
|
||||
rx = scm_gc_malloc (sizeof(regex_t), "regex");
|
||||
rx = scm_gc_malloc_pointerless (sizeof (regex_t), "regex");
|
||||
c_pat = scm_to_locale_string (pat);
|
||||
status = regcomp (rx, c_pat,
|
||||
/* Make sure they're not passing REG_NOSUB;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue