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

new instructions: make-int64, make-uint64

* doc/ref/vm.texi (Loading Instructions): Remove references to
  load-integer and load-unsigned-integer -- they're still in the VM but
  will be removed at some point.
  (Data Control Instructions): Add make-int64 and make-uint64.

* libguile/vm-i-loader.c (load-unsigned-integer): Allow 8-byte values.
  But this instruction is on its way out, yo.

* libguile/vm-i-system.c (make-int64, make-uint64): New instructions.

* module/language/assembly.scm (object->assembly): Write out make-int64
  and make-uint64 instructions, using bytevectors to do the endianness
  conversion.
  (assembly->object): And pretty-print them back, for disassembly.

* module/language/glil/compile-assembly.scm: Don't generate load-integer
  / load-unsigned-integer instructions.
This commit is contained in:
Andy Wingo 2009-06-06 15:45:00 +02:00
parent 4bcc952d45
commit 586cfdecfa
5 changed files with 65 additions and 18 deletions

View file

@ -138,6 +138,36 @@ VM_DEFINE_INSTRUCTION (13, make_int16, "make-int16", 2, 0, 1)
NEXT;
}
VM_DEFINE_INSTRUCTION (55, make_int64, "make-int64", 8, 0, 1)
{
scm_t_uint64 v = 0;
v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
PUSH (scm_from_int64 ((scm_t_int64) v));
NEXT;
}
VM_DEFINE_INSTRUCTION (56, make_uint64, "make-uint64", 8, 0, 1)
{
scm_t_uint64 v = 0;
v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
v <<= 8; v += FETCH ();
PUSH (scm_from_uint64 (v));
NEXT;
}
VM_DEFINE_INSTRUCTION (14, make_char8, "make-char8", 1, 0, 1)
{
PUSH (SCM_MAKE_CHAR (FETCH ()));