mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-29 00:10:21 +02:00
make late-variable-{ref,set} work before module system boot
* libguile/vm-i-system.c (late-variable-ref, late-variable-set): If the module system isn't booted, do a simple scm_lookup. In the -ref case, actually cache the variable location (doh!).
This commit is contained in:
parent
1b79210aa2
commit
3aabb7b793
1 changed files with 24 additions and 7 deletions
|
@ -269,15 +269,24 @@ VM_DEFINE_INSTRUCTION (late_variable_ref, "late-variable-ref", 1, 0, 1)
|
||||||
if (!SCM_VARIABLEP (pair_or_var))
|
if (!SCM_VARIABLEP (pair_or_var))
|
||||||
{
|
{
|
||||||
SYNC_REGISTER ();
|
SYNC_REGISTER ();
|
||||||
/* either one of these calls might longjmp */
|
if (SCM_LIKELY (scm_module_system_booted_p))
|
||||||
SCM mod = scm_resolve_module (SCM_CAR (pair_or_var));
|
{
|
||||||
pair_or_var = scm_module_lookup (mod, SCM_CDR (pair_or_var));
|
/* either one of these calls might longjmp */
|
||||||
OBJECT_SET (objnum, pair_or_var);
|
SCM mod = scm_resolve_module (SCM_CAR (pair_or_var));
|
||||||
|
pair_or_var = scm_module_lookup (mod, SCM_CDR (pair_or_var));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pair_or_var = scm_lookup (SCM_CDR (pair_or_var));
|
||||||
|
}
|
||||||
|
|
||||||
if (!VARIABLE_BOUNDP (pair_or_var))
|
if (!VARIABLE_BOUNDP (pair_or_var))
|
||||||
{
|
{
|
||||||
err_args = SCM_LIST1 (pair_or_var);
|
err_args = SCM_LIST1 (pair_or_var);
|
||||||
goto vm_error_unbound;
|
goto vm_error_unbound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OBJECT_SET (objnum, pair_or_var);
|
||||||
}
|
}
|
||||||
|
|
||||||
PUSH (VARIABLE_REF (pair_or_var));
|
PUSH (VARIABLE_REF (pair_or_var));
|
||||||
|
@ -325,9 +334,17 @@ VM_DEFINE_INSTRUCTION (late_variable_set, "late-variable-set", 1, 1, 0)
|
||||||
if (!SCM_VARIABLEP (pair_or_var))
|
if (!SCM_VARIABLEP (pair_or_var))
|
||||||
{
|
{
|
||||||
SYNC_BEFORE_GC ();
|
SYNC_BEFORE_GC ();
|
||||||
SCM mod = scm_resolve_module (SCM_CAR (pair_or_var));
|
if (SCM_LIKELY (scm_module_system_booted_p))
|
||||||
/* module_lookup might longjmp */
|
{
|
||||||
pair_or_var = scm_module_lookup (mod, SCM_CDR (pair_or_var));
|
/* either one of these calls might longjmp */
|
||||||
|
SCM mod = scm_resolve_module (SCM_CAR (pair_or_var));
|
||||||
|
pair_or_var = scm_module_lookup (mod, SCM_CDR (pair_or_var));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pair_or_var = scm_lookup (SCM_CDR (pair_or_var));
|
||||||
|
}
|
||||||
|
|
||||||
OBJECT_SET (objnum, pair_or_var);
|
OBJECT_SET (objnum, pair_or_var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue