mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 08:10:17 +02:00
Add `load-unsigned-integer' instruction.
* libguile/vm-i-loader.c (load_unsigned_integer): New loader. * module/language/assembly.scm (byte-length): Handle `load-unsigned-integer'. * module/language/assembly/compile-bytecode.scm (write-bytecode): Likewise. * module/language/glil/compile-assembly.scm (dump-object): Emit a `load-unsigned-integer' instruction for positive integers. This fixes loading of integers greater than 2^31 - 1. * testsuite/Makefile.am (vm_test_files): Add `t-literal-integers.scm'. * doc/ref/vm.texi (Loading Instructions): Add `load-unsigned-integer'.
This commit is contained in:
parent
4e29767187
commit
b912a1cd6b
7 changed files with 37 additions and 6 deletions
|
@ -18,12 +18,30 @@
|
|||
|
||||
/* This file is included in vm_engine.c */
|
||||
|
||||
VM_DEFINE_LOADER (59, load_unsigned_integer, "load-unsigned-integer")
|
||||
{
|
||||
size_t len;
|
||||
|
||||
FETCH_LENGTH (len);
|
||||
if (SCM_LIKELY (len <= 4))
|
||||
{
|
||||
unsigned int val = 0;
|
||||
while (len-- > 0)
|
||||
val = (val << 8U) + FETCH ();
|
||||
SYNC_REGISTER ();
|
||||
PUSH (scm_from_uint (val));
|
||||
NEXT;
|
||||
}
|
||||
else
|
||||
SCM_MISC_ERROR ("load-unsigned-integer: not implemented yet", SCM_EOL);
|
||||
}
|
||||
|
||||
VM_DEFINE_LOADER (60, load_integer, "load-integer")
|
||||
{
|
||||
size_t len;
|
||||
|
||||
FETCH_LENGTH (len);
|
||||
if (len <= 4)
|
||||
if (SCM_LIKELY (len <= 4))
|
||||
{
|
||||
int val = 0;
|
||||
while (len-- > 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue