diff options
author | Andy Wingo <wingo@pobox.com> | 2009-02-03 22:36:02 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-02-03 22:36:02 +0100 |
commit | f775e51bceb7399893b01380c5b56a7b665b782a (patch) | |
tree | ecaa0bf864d531d19a90e67895486af0b0e593b7 /libguile/vm-engine.c | |
parent | ef7e18683c06a3a1524787becd29b8c11dbc5674 (diff) | |
download | guile-f775e51bceb7399893b01380c5b56a7b665b782a.tar.gz |
make symbol -> opcode lookup faster
* libguile/instructions.c (fetch_instruction_table)
(scm_lookup_instruction_by_name): Rework so we lazily load instructions
into an array keyed by opcode, and a hash table keyed by symbolic name.
Much faster, in this hot spot of compilation.
* libguile/vm-engine.c (vm_run): Use malloc instead of scm_gc_malloc,
given that we aren't ever going to free this thing.
* libguile/vm-expand.h (VM_DEFINE_FUNCTION, VM_DEFINE_LOADER): Rework to
always be aliases to VM_DEFINE_INSTRUCTION.
(VM_DEFINE_INSTRUCTION): In the table case, update to work with
fetch_instruction_table().
Diffstat (limited to 'libguile/vm-engine.c')
-rw-r--r-- | libguile/vm-engine.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index e1468b61d..97684d90b 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -80,8 +80,7 @@ vm_run (SCM vm, SCM program, SCM args) if (SCM_UNLIKELY (!jump_table)) { int i; - jump_table = scm_gc_malloc (SCM_VM_NUM_INSTRUCTIONS * sizeof(void*), - "jump table"); + jump_table = malloc (SCM_VM_NUM_INSTRUCTIONS * sizeof(void*)); for (i = 0; i < SCM_VM_NUM_INSTRUCTIONS; i++) jump_table[i] = &&vm_error_bad_instruction; #define VM_INSTRUCTION_TO_LABEL 1 |