From bf5a05f2a01fee23f5622d1429dc32f4850f98b5 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 3 Dec 2009 15:58:43 +0100 Subject: [PATCH] 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. --- libguile/eval.c | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/libguile/eval.c b/libguile/eval.c index 8a4700843..b68c0ca82 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -543,56 +543,34 @@ SCM_DEFINE (scm_evaluator_traps, "evaluator-traps-interface", 0, 1, 0, SCM scm_call_0 (SCM proc) { - if (SCM_PROGRAM_P (proc)) - return scm_c_vm_run (scm_the_vm (), proc, NULL, 0); - else - return scm_apply (proc, SCM_EOL, SCM_EOL); + return scm_c_vm_run (scm_the_vm (), proc, NULL, 0); } SCM scm_call_1 (SCM proc, SCM arg1) { - if (SCM_PROGRAM_P (proc)) - return scm_c_vm_run (scm_the_vm (), proc, &arg1, 1); - else - return scm_apply (proc, arg1, scm_listofnull); + return scm_c_vm_run (scm_the_vm (), proc, &arg1, 1); } SCM scm_call_2 (SCM proc, SCM arg1, SCM arg2) { - if (SCM_PROGRAM_P (proc)) - { - SCM args[] = { arg1, arg2 }; - return scm_c_vm_run (scm_the_vm (), proc, args, 2); - } - else - return scm_apply (proc, arg1, scm_cons (arg2, scm_listofnull)); + SCM args[] = { arg1, arg2 }; + return scm_c_vm_run (scm_the_vm (), proc, args, 2); } SCM scm_call_3 (SCM proc, SCM arg1, SCM arg2, SCM arg3) { - if (SCM_PROGRAM_P (proc)) - { - SCM args[] = { arg1, arg2, arg3 }; - return scm_c_vm_run (scm_the_vm (), proc, args, 3); - } - else - return scm_apply (proc, arg1, scm_cons2 (arg2, arg3, scm_listofnull)); + SCM args[] = { arg1, arg2, arg3 }; + return scm_c_vm_run (scm_the_vm (), proc, args, 3); } SCM scm_call_4 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4) { - if (SCM_PROGRAM_P (proc)) - { - SCM args[] = { arg1, arg2, arg3, arg4 }; - 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))); + SCM args[] = { arg1, arg2, arg3, arg4 }; + return scm_c_vm_run (scm_the_vm (), proc, args, 4); } /* Simple procedure applies