1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-14 23:50:19 +02:00

Compile variable-ref, variable-set!

* libguile/vm-engine (box-ref, box-set!): Instead of aborting if a box
  isn't a var, call out to vm_error_not_a_variable.  This makes these
  instructions equivalent to variable-ref/variable-set!.
  (vector-set!): Rename from vector-set.

* module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add
  variable-set! case, and adapt vector-set!.

* module/language/cps/primitives.scm (*rtl-instruction-aliases*): Add
  variable-ref / variable-set! aliases to box-ref / box-set!.
This commit is contained in:
Andy Wingo 2013-10-26 15:40:49 +02:00
parent d023ae8679
commit 4f406fea7e
3 changed files with 10 additions and 5 deletions

View file

@ -1839,7 +1839,8 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_)
SCM var;
SCM_UNPACK_RTL_12_12 (op, dst, src);
var = LOCAL_REF (src);
VM_ASSERT (SCM_VARIABLEP (var), abort ());
VM_ASSERT (SCM_VARIABLEP (var),
vm_error_not_a_variable ("variable-ref", var));
VM_ASSERT (VARIABLE_BOUNDP (var),
vm_error_unbound (SCM_FRAME_PROGRAM (fp), var));
LOCAL_SET (dst, VARIABLE_REF (var));
@ -1856,7 +1857,8 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_)
SCM var;
SCM_UNPACK_RTL_12_12 (op, dst, src);
var = LOCAL_REF (dst);
VM_ASSERT (SCM_VARIABLEP (var), abort ());
VM_ASSERT (SCM_VARIABLEP (var),
vm_error_not_a_variable ("variable-set!", var));
VARIABLE_SET (var, LOCAL_REF (src));
NEXT (1);
}
@ -2906,7 +2908,7 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_)
*
* Store SRC into the vector DST at index IDX.
*/
VM_DEFINE_OP (92, vector_set, "vector-set", OP1 (U8_U8_U8_U8))
VM_DEFINE_OP (92, vector_set, "vector-set!", OP1 (U8_U8_U8_U8))
{
scm_t_uint8 dst, idx_var, src;
SCM vect, idx, val;