1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00

Got the VM up and running! Augmented the documentation.

* src/*.[ch]:  Replaced the remaining `SCM_MAKINUM', and changed `SCM_VELTS'
  into `scm_vector_elements ()'.
* src/vm_loader.c (link):  Fixed so that it pushed a variable object on
  the stack.
* src/vm_system.c (variable-ref):  Fixed so that it uses `scm_variable_ref ()'
  and friends.
* module/system/vm/assemble.scm (dump-object!):  Fixed the string case.
* src/vm_engine.h (CONS):  Use `scm_cons' instead of `SCM_NEWCELL'.
* doc/guile-vm.texi:  Added actual instruction definitions, explanations of
  the program invocation mechanism, programs' object tables, etc., in the
  `Instruction Set' chapter.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-5
This commit is contained in:
Ludovic Court`es 2005-04-28 15:45:59 +00:00 committed by Ludovic Courtès
parent fa19602c28
commit 238e7a11a8
8 changed files with 213 additions and 40 deletions

View file

@ -119,19 +119,19 @@ VM_DEFINE_INSTRUCTION (make_eol, "make-eol", 0, 0, 1)
VM_DEFINE_INSTRUCTION (make_int8, "make-int8", 1, 0, 1)
{
PUSH (SCM_MAKINUM ((signed char) FETCH ()));
PUSH (scm_from_schar ((signed char) FETCH ()));
NEXT;
}
VM_DEFINE_INSTRUCTION (make_int8_0, "make-int8:0", 0, 0, 1)
{
PUSH (SCM_MAKINUM (0));
PUSH (SCM_INUM0);
NEXT;
}
VM_DEFINE_INSTRUCTION (make_int8_1, "make-int8:1", 0, 0, 1)
{
PUSH (SCM_MAKINUM (1));
PUSH (SCM_I_MAKINUM (1));
NEXT;
}
@ -139,7 +139,7 @@ VM_DEFINE_INSTRUCTION (make_int16, "make-int16", 2, 0, 1)
{
int h = FETCH ();
int l = FETCH ();
PUSH (SCM_MAKINUM ((signed short) (h << 8) + l));
PUSH (scm_from_short ((signed short) (h << 8) + l));
NEXT;
}
@ -197,8 +197,8 @@ VM_DEFINE_INSTRUCTION (list_break, "list-break", 0, 0, 0)
#define LOCAL_REF(i) SCM_FRAME_VARIABLE (fp, i)
#define LOCAL_SET(i,o) SCM_FRAME_VARIABLE (fp, i) = o
#define VARIABLE_REF(v) SCM_CDR (v)
#define VARIABLE_SET(v,o) SCM_SETCDR (v, o)
/* #define VARIABLE_REF(v) SCM_CDR (v) */
/* #define VARIABLE_SET(v,o) SCM_SETCDR (v, o) */
/* ref */
@ -231,13 +231,19 @@ VM_DEFINE_INSTRUCTION (external_ref, "external-ref", 1, 0, 1)
VM_DEFINE_INSTRUCTION (variable_ref, "variable-ref", 0, 0, 1)
{
SCM x = *sp;
SCM o = VARIABLE_REF (x);
if (SCM_UNBNDP (o))
if (SCM_FALSEP (scm_variable_bound_p (x)))
{
err_args = SCM_LIST1 (SCM_CAR (x));
err_args = SCM_LIST1 (x);
/* Was: err_args = SCM_LIST1 (SCM_CAR (x)); */
goto vm_error_unbound;
}
*sp = o;
else
{
SCM o = scm_variable_ref (x);
*sp = o;
}
NEXT;
}
@ -267,7 +273,7 @@ VM_DEFINE_INSTRUCTION (external_set, "external-set", 1, 1, 0)
VM_DEFINE_INSTRUCTION (variable_set, "variable-set", 0, 1, 0)
{
VARIABLE_SET (sp[0], sp[-1]);
scm_variable_set_x (sp[0], sp[-1]);
scm_set_object_property_x (sp[-1], scm_sym_name, SCM_CAR (sp[0]));
sp -= 2;
NEXT;