mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 08:10:17 +02:00
enable multiple vm engines (regular, debug, ...)
* libguile/vm-engine.c (VM_USE_HOOKS, VM_USE_CLOCK, VM_CHECK_EXTERNAL) (VM_CHECK_OBJECT): Update to define these here, before including vm-engine.h. (vm_run): Change so that we can make different engines. Also, we take an array of arguments, and the struct scm_vm directly, so as to avoid any need to cons. * libguile/vm-engine.h (CHECK_EXTERNAL, CHECK_OBJECT): Add some UNLIKELY bits; don't seem to help. * libguile/vm.c (vm_dispatch_hook): Change to not pass the VP. This needs some love, and perhaps we revert to the old way. (VM_ENGINE): Actually make two engines, vm_regular_engine and vm_debug_engine. Probably there is room for improvement here. Actually their speeds are the same at the moment. (make_vm): Choose which engine to run; currently the debug engine by default. (scm_c_vm_run): A thin wrapper to invoke a VM without consing. (scm_vm_apply): Use scm_c_vm_run. (scm_load_compiled_with_vm): Use scm_c_vm_run.
This commit is contained in:
parent
bef9591104
commit
6d14383e86
4 changed files with 84 additions and 37 deletions
|
@ -55,6 +55,14 @@
|
|||
#define SCM_VM_RETURN_HOOK 7
|
||||
#define SCM_VM_NUM_HOOKS 8
|
||||
|
||||
struct scm_vm;
|
||||
|
||||
typedef SCM (*scm_t_vm_engine) (struct scm_vm *vp, SCM program, SCM *argv, int nargs);
|
||||
|
||||
#define SCM_VM_REGULAR_ENGINE 0
|
||||
#define SCM_VM_DEBUG_ENGINE 1
|
||||
#define SCM_VM_NUM_ENGINES 2
|
||||
|
||||
struct scm_vm {
|
||||
scm_byte_t *ip; /* instruction pointer */
|
||||
SCM *sp; /* stack pointer */
|
||||
|
@ -62,6 +70,7 @@ struct scm_vm {
|
|||
size_t stack_size; /* stack size */
|
||||
SCM *stack_base; /* stack base address */
|
||||
SCM *stack_limit; /* stack limit address */
|
||||
int engine; /* which vm engine we're using */
|
||||
SCM hooks[SCM_VM_NUM_HOOKS]; /* hooks */
|
||||
SCM options; /* options */
|
||||
unsigned long time; /* time spent */
|
||||
|
@ -78,6 +87,7 @@ extern SCM scm_the_vm_fluid;
|
|||
extern SCM scm_the_vm ();
|
||||
extern SCM scm_make_vm (void);
|
||||
extern SCM scm_vm_apply (SCM vm, SCM program, SCM args);
|
||||
extern SCM scm_c_vm_run (struct scm_vm *vp, SCM program, SCM *argv, int nargs);
|
||||
extern SCM scm_vm_option_ref (SCM vm, SCM key);
|
||||
extern SCM scm_vm_option_set_x (SCM vm, SCM key, SCM val);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue