mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 23:50:19 +02:00
add long-object-ref, long-toplevel-ref, long-toplevel-set
* libguile/vm-i-system.c (long-object-ref, long-toplevel-ref) (long-toplevel-set): Add new instructions, for accessing the object table with a 16-bit offset. HTMLprag defines a test program that has more than 256 constants, necessitating this addition. * doc/ref/vm.texi: Mention the new instructions. * module/language/glil/compile-assembly.scm: Emit long refs for object tables bigger than 256 entries.
This commit is contained in:
parent
5e89cd13c0
commit
a9b0f876c1
3 changed files with 86 additions and 8 deletions
|
@ -1062,6 +1062,62 @@ VM_DEFINE_INSTRUCTION (51, truncate_values, "truncate-values", 2, -1, -1)
|
|||
NEXT;
|
||||
}
|
||||
|
||||
VM_DEFINE_INSTRUCTION (52, long_object_ref, "long-object-ref", 2, 0, 1)
|
||||
{
|
||||
unsigned int objnum = FETCH ();
|
||||
objnum <<= 8;
|
||||
objnum += FETCH ();
|
||||
CHECK_OBJECT (objnum);
|
||||
PUSH (OBJECT_REF (objnum));
|
||||
NEXT;
|
||||
}
|
||||
|
||||
VM_DEFINE_INSTRUCTION (53, long_toplevel_ref, "long-toplevel-ref", 2, 0, 1)
|
||||
{
|
||||
SCM what;
|
||||
unsigned int objnum = FETCH ();
|
||||
objnum <<= 8;
|
||||
objnum += FETCH ();
|
||||
CHECK_OBJECT (objnum);
|
||||
what = OBJECT_REF (objnum);
|
||||
|
||||
if (!SCM_VARIABLEP (what))
|
||||
{
|
||||
SYNC_REGISTER ();
|
||||
what = resolve_variable (what, scm_program_module (program));
|
||||
if (!VARIABLE_BOUNDP (what))
|
||||
{
|
||||
finish_args = scm_list_1 (what);
|
||||
goto vm_error_unbound;
|
||||
}
|
||||
OBJECT_SET (objnum, what);
|
||||
}
|
||||
|
||||
PUSH (VARIABLE_REF (what));
|
||||
NEXT;
|
||||
}
|
||||
|
||||
VM_DEFINE_INSTRUCTION (54, long_toplevel_set, "long-toplevel-set", 2, 1, 0)
|
||||
{
|
||||
SCM what;
|
||||
unsigned int objnum = FETCH ();
|
||||
objnum <<= 8;
|
||||
objnum += FETCH ();
|
||||
CHECK_OBJECT (objnum);
|
||||
what = OBJECT_REF (objnum);
|
||||
|
||||
if (!SCM_VARIABLEP (what))
|
||||
{
|
||||
SYNC_BEFORE_GC ();
|
||||
what = resolve_variable (what, scm_program_module (program));
|
||||
OBJECT_SET (objnum, what);
|
||||
}
|
||||
|
||||
VARIABLE_SET (what, *sp);
|
||||
DROP ();
|
||||
NEXT;
|
||||
}
|
||||
|
||||
/*
|
||||
(defun renumber-ops ()
|
||||
"start from top of buffer and renumber 'VM_DEFINE_FOO (\n' sequences"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue