1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 14:21:10 +02:00

generic dispatch in the vm (sorta)

* libguile/vm-i-system.c (call, goto/args, mv-call): Add a case for
  generics, so we can avoid the evaluator in that case. Still have to
  cons up a list -- the real solution comes later.
This commit is contained in:
Andy Wingo 2009-10-31 00:08:42 +01:00
parent 9e759da10b
commit 352c87d7e4

View file

@ -749,6 +749,17 @@ VM_DEFINE_INSTRUCTION (53, call, "call", 1, -1, 1)
APPLY_HOOK ();
NEXT;
}
if (SCM_STRUCTP (x) && SCM_OBJ_CLASS_FLAGS (x) & SCM_CLASSF_PURE_GENERIC)
{
SCM args = SCM_EOL;
int n = nargs;
SCM* walk = sp;
SYNC_REGISTER ();
while (n--)
args = scm_cons (*walk--, args);
*walk = scm_mcache_compute_cmethod (SCM_ENTITY_PROCEDURE (x), args);
goto vm_call;
}
/*
* Other interpreted or compiled call
*/
@ -822,6 +833,17 @@ VM_DEFINE_INSTRUCTION (54, goto_args, "goto/args", 1, -1, 1)
APPLY_HOOK ();
NEXT;
}
if (SCM_STRUCTP (x) && SCM_OBJ_CLASS_FLAGS (x) & SCM_CLASSF_PURE_GENERIC)
{
SCM args = SCM_EOL;
int n = nargs;
SCM* walk = sp;
SYNC_REGISTER ();
while (n--)
args = scm_cons (*walk--, args);
*walk = scm_mcache_compute_cmethod (SCM_ENTITY_PROCEDURE (x), args);
goto vm_goto_args;
}
/*
* Other interpreted or compiled call
@ -883,6 +905,7 @@ VM_DEFINE_INSTRUCTION (57, mv_call, "mv-call", 4, -1, 1)
FETCH_OFFSET (offset);
mvra = ip + offset;
vm_mv_call:
x = sp[-nargs];
/*
@ -902,6 +925,17 @@ VM_DEFINE_INSTRUCTION (57, mv_call, "mv-call", 4, -1, 1)
APPLY_HOOK ();
NEXT;
}
if (SCM_STRUCTP (x) && SCM_OBJ_CLASS_FLAGS (x) & SCM_CLASSF_PURE_GENERIC)
{
SCM args = SCM_EOL;
int n = nargs;
SCM* walk = sp;
SYNC_REGISTER ();
while (n--)
args = scm_cons (*walk--, args);
*walk = scm_mcache_compute_cmethod (SCM_ENTITY_PROCEDURE (x), args);
goto vm_mv_call;
}
/*
* Other interpreted or compiled call
*/