1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-15 02:00:22 +02:00

* src/vm.c (lookup_variable): New function.

(scm_make_bytecode): Call lookup_variable for top-level variables.
* src/vm_engine.h (VM_VARIABLE_REF, VM_VARIABLE_SET): New macros.
* src/vm_system.c (TOPLEVEL_VAR, TOPLEVEL_VAR_SET): Removed.
Use VM_VARIABLE_REF and VM_VARIABLE_SET instead.
This commit is contained in:
Keisuke Nishida 2000-08-25 02:31:26 +00:00
parent db7880185f
commit 9df03fd0c1
3 changed files with 33 additions and 18 deletions

View file

@ -334,6 +334,18 @@ init_bytecode_type ()
scm_set_smob_free (scm_bytecode_tag, free_bytecode);
}
/* Internal functions */
static SCM
lookup_variable (SCM sym)
{
SCM closure = scm_standard_eval_closure (scm_selected_module ());
SCM var = scm_apply (closure, SCM_LIST2 (sym, SCM_BOOL_F), SCM_EOL);
if (SCM_FALSEP (var))
var = scm_apply (closure, SCM_LIST2 (sym, SCM_BOOL_T), SCM_EOL);
return var;
}
/* Scheme interface */
SCM_DEFINE (scm_bytecode_p, "bytecode?", 1, 0, 0,
@ -428,7 +440,7 @@ SCM_DEFINE (scm_make_bytecode, "make-bytecode", 1, 0, 0,
case INST_TOP:
/* top-level variable */
SCM_VALIDATE_SYMBOL (1, old[i]);
new[i] = scm_intern0 (SCM_CHARS (old[i]));
new[i] = lookup_variable (old[i]);
break;
case INST_EXT:
/* just copy for now */