diff options
author | Ludovic Court`es <ludovic.courtes@laas.fr> | 2005-04-29 14:12:12 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-04-25 19:09:30 +0200 |
commit | 2d80426a3ec7de15a194d0baed0e9f4be8659b92 (patch) | |
tree | 8100ff8d82d6a1fec507e67f23987c0da58a9703 /src/vm_system.c | |
parent | 238e7a11a8ec5aa2406b31620d3e56409639d4cf (diff) | |
download | guile-2d80426a3ec7de15a194d0baed0e9f4be8659b92.tar.gz |
Improved the VM's efficiency. The VM is as fast as the interpreter. :-(
* benchmark/lib.scm: New file.
* benchmark/measure.scm: New file.
* README: Added useful pointers to various threads.
* doc/guile-vm.texi: Fixed the description of `load-program' (it now expects
_immediate_ integers).
* src/*.[ch]: Use immediate integers whereever possible, as in the original
code. For `CONS', use `scm_cell' rather than `scm_cons'.
git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-6
Diffstat (limited to 'src/vm_system.c')
-rw-r--r-- | src/vm_system.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/vm_system.c b/src/vm_system.c index 9b4522747..e10263f19 100644 --- a/src/vm_system.c +++ b/src/vm_system.c @@ -119,7 +119,7 @@ VM_DEFINE_INSTRUCTION (make_eol, "make-eol", 0, 0, 1) VM_DEFINE_INSTRUCTION (make_int8, "make-int8", 1, 0, 1) { - PUSH (scm_from_schar ((signed char) FETCH ())); + PUSH (SCM_I_MAKINUM ((signed char) FETCH ())); NEXT; } @@ -139,7 +139,7 @@ VM_DEFINE_INSTRUCTION (make_int16, "make-int16", 2, 0, 1) { int h = FETCH (); int l = FETCH (); - PUSH (scm_from_short ((signed short) (h << 8) + l)); + PUSH (SCM_I_MAKINUM ((signed short) (h << 8) + l)); NEXT; } @@ -197,8 +197,12 @@ 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) */ +/* For the variable operations, we _must_ obviously avoid function calls to + `scm_variable_ref ()', `scm_variable_bound_p ()' and friends which do + nothing more than the corresponding macros. */ +#define VARIABLE_REF(v) SCM_VARIABLE_REF (v) +#define VARIABLE_SET(v,o) SCM_VARIABLE_SET (v, o) +#define VARIABLE_BOUNDP(v) (VARIABLE_REF (v) != SCM_UNDEFINED) /* ref */ @@ -232,7 +236,7 @@ VM_DEFINE_INSTRUCTION (variable_ref, "variable-ref", 0, 0, 1) { SCM x = *sp; - if (SCM_FALSEP (scm_variable_bound_p (x))) + if (!VARIABLE_BOUNDP (x)) { err_args = SCM_LIST1 (x); /* Was: err_args = SCM_LIST1 (SCM_CAR (x)); */ @@ -240,7 +244,7 @@ VM_DEFINE_INSTRUCTION (variable_ref, "variable-ref", 0, 0, 1) } else { - SCM o = scm_variable_ref (x); + SCM o = VARIABLE_REF (x); *sp = o; } @@ -273,7 +277,7 @@ VM_DEFINE_INSTRUCTION (external_set, "external-set", 1, 1, 0) VM_DEFINE_INSTRUCTION (variable_set, "variable-set", 0, 1, 0) { - scm_variable_set_x (sp[0], sp[-1]); + VARIABLE_SET (sp[0], sp[-1]); scm_set_object_property_x (sp[-1], scm_sym_name, SCM_CAR (sp[0])); sp -= 2; NEXT; |