From f775e51bceb7399893b01380c5b56a7b665b782a Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 3 Feb 2009 22:36:02 +0100 Subject: 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(). --- libguile/vm-engine.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libguile/vm-engine.c') 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 -- cgit v1.2.3