mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
speed up scm_call_N for non-programs
* libguile/eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3): All of these should dispatch through the VM, without consing.
This commit is contained in:
parent
a941cde9e5
commit
bf5a05f2a0
1 changed files with 8 additions and 30 deletions
|
@ -543,56 +543,34 @@ SCM_DEFINE (scm_evaluator_traps, "evaluator-traps-interface", 0, 1, 0,
|
||||||
SCM
|
SCM
|
||||||
scm_call_0 (SCM proc)
|
scm_call_0 (SCM proc)
|
||||||
{
|
{
|
||||||
if (SCM_PROGRAM_P (proc))
|
|
||||||
return scm_c_vm_run (scm_the_vm (), proc, NULL, 0);
|
return scm_c_vm_run (scm_the_vm (), proc, NULL, 0);
|
||||||
else
|
|
||||||
return scm_apply (proc, SCM_EOL, SCM_EOL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
scm_call_1 (SCM proc, SCM arg1)
|
scm_call_1 (SCM proc, SCM arg1)
|
||||||
{
|
{
|
||||||
if (SCM_PROGRAM_P (proc))
|
|
||||||
return scm_c_vm_run (scm_the_vm (), proc, &arg1, 1);
|
return scm_c_vm_run (scm_the_vm (), proc, &arg1, 1);
|
||||||
else
|
|
||||||
return scm_apply (proc, arg1, scm_listofnull);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
scm_call_2 (SCM proc, SCM arg1, SCM arg2)
|
scm_call_2 (SCM proc, SCM arg1, SCM arg2)
|
||||||
{
|
{
|
||||||
if (SCM_PROGRAM_P (proc))
|
|
||||||
{
|
|
||||||
SCM args[] = { arg1, arg2 };
|
SCM args[] = { arg1, arg2 };
|
||||||
return scm_c_vm_run (scm_the_vm (), proc, args, 2);
|
return scm_c_vm_run (scm_the_vm (), proc, args, 2);
|
||||||
}
|
|
||||||
else
|
|
||||||
return scm_apply (proc, arg1, scm_cons (arg2, scm_listofnull));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
scm_call_3 (SCM proc, SCM arg1, SCM arg2, SCM arg3)
|
scm_call_3 (SCM proc, SCM arg1, SCM arg2, SCM arg3)
|
||||||
{
|
{
|
||||||
if (SCM_PROGRAM_P (proc))
|
|
||||||
{
|
|
||||||
SCM args[] = { arg1, arg2, arg3 };
|
SCM args[] = { arg1, arg2, arg3 };
|
||||||
return scm_c_vm_run (scm_the_vm (), proc, args, 3);
|
return scm_c_vm_run (scm_the_vm (), proc, args, 3);
|
||||||
}
|
|
||||||
else
|
|
||||||
return scm_apply (proc, arg1, scm_cons2 (arg2, arg3, scm_listofnull));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
scm_call_4 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4)
|
scm_call_4 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4)
|
||||||
{
|
{
|
||||||
if (SCM_PROGRAM_P (proc))
|
|
||||||
{
|
|
||||||
SCM args[] = { arg1, arg2, arg3, arg4 };
|
SCM args[] = { arg1, arg2, arg3, arg4 };
|
||||||
return scm_c_vm_run (scm_the_vm (), proc, args, 4);
|
return scm_c_vm_run (scm_the_vm (), proc, args, 4);
|
||||||
}
|
|
||||||
else
|
|
||||||
return scm_apply (proc, arg1, scm_cons2 (arg2, arg3,
|
|
||||||
scm_cons (arg4, scm_listofnull)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simple procedure applies
|
/* Simple procedure applies
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue