mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
cache 8 boot programs
* libguile/vm.c (vm_make_boot_program): Cache boot programs for nargs < 8.
This commit is contained in:
parent
9bb8012dd6
commit
d2d7acd5c1
1 changed files with 19 additions and 1 deletions
|
@ -268,7 +268,7 @@ static SCM make_u8vector (const scm_t_uint8 *bytes, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static SCM
|
static SCM
|
||||||
vm_make_boot_program (long nargs)
|
really_make_boot_program (long nargs)
|
||||||
{
|
{
|
||||||
scm_byte_t bytes[] = {0, 0, 0, 0,
|
scm_byte_t bytes[] = {0, 0, 0, 0,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
|
@ -280,6 +280,24 @@ vm_make_boot_program (long nargs)
|
||||||
return scm_make_program (scm_bytecode_to_objcode (make_u8vector (bytes, sizeof(bytes))),
|
return scm_make_program (scm_bytecode_to_objcode (make_u8vector (bytes, sizeof(bytes))),
|
||||||
SCM_BOOL_F, SCM_EOL);
|
SCM_BOOL_F, SCM_EOL);
|
||||||
}
|
}
|
||||||
|
#define NUM_BOOT_PROGS 8
|
||||||
|
static SCM
|
||||||
|
vm_make_boot_program (long nargs)
|
||||||
|
{
|
||||||
|
static SCM programs[NUM_BOOT_PROGS] = { 0, };
|
||||||
|
|
||||||
|
if (SCM_UNLIKELY (!programs[0]))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < NUM_BOOT_PROGS; i++)
|
||||||
|
programs[i] = scm_permanent_object (really_make_boot_program (i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SCM_LIKELY (nargs < NUM_BOOT_PROGS))
|
||||||
|
return programs[nargs];
|
||||||
|
else
|
||||||
|
return really_make_boot_program (nargs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue