diff options
author | Andy Wingo <wingo@pobox.com> | 2009-06-05 12:08:02 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-06-05 12:08:02 +0200 |
commit | a9b0f876c12bbbca9bdf1890eb014a30f004d9f8 (patch) | |
tree | 25651e1fee31f04629109488c11560017dbfdd8c /libguile/vm-i-system.c | |
parent | 5e89cd13c077de1419cab140590f76f92a457807 (diff) | |
download | guile-a9b0f876c12bbbca9bdf1890eb014a30f004d9f8.tar.gz |
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.
Diffstat (limited to 'libguile/vm-i-system.c')
-rw-r--r-- | libguile/vm-i-system.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 32b772afa..36ff5bde8 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -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" |