diff options
author | Andy Wingo <wingo@pobox.com> | 2011-05-05 14:04:23 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-05-05 14:04:23 +0200 |
commit | eae2438d2bd1d9a0e0aaa052abb8b36b2d073850 (patch) | |
tree | 3c5e2fbe178620de4d87ccba03c53f308b66e6f4 /libguile/vm-engine.c | |
parent | 9e775af3bf0db457eceb5a9a1f4a87968d011492 (diff) | |
download | guile-eae2438d2bd1d9a0e0aaa052abb8b36b2d073850.tar.gz |
VM tweaks
* libguile/vm-engine.c (VM_CHECK_OBJECT, VM_CHECK_FREE_VARIABLES): Set
to 0 for both engines. These are really internal debugging variables,
which don't affect user-visible features, provided that the compiler
is correct of course.
(VM_CHECK_UNDERFLOW): New var, also off by default: whether to check
for stack underflow when popping values.
(vm_engine): Don't declare object_count if we are not checking object
table accesses.
* libguile/vm-engine.h (CACHE_PROGRAM): Don't muck with object_count
if we are not checking object table accesses.
(CHECK_UNDERFLOW, PRE_CHECK_UNDERFLOW): Nop out if we are not checking
underflow.
(POP2, POP3): New macros which check for underflow before popping more
than one value.
* libguile/vm-i-loader.c (load_array):
* libguile/vm-i-scheme.c (set_car, set_cdr, vector_set, slot_set)
(BV_SET_WITH_ENDIANNESS, BV_FIXABLE_INT_SET, BV_INT_SET)
(BV_FLOAT_SET):
* libguile/vm-i-system.c (partial_cont_call, fix_closure, prompt)
(fluid_set): Use POP2 / POP3.
(local_set, long_local_set): Pop to locals instead of using values on
the stack then dropping; allows for underflow to be checked before the
value is accessed.
(BR): Don't NULLSTACK or DROP after the operation.
(br_if, br_if_not, br_if_eq, br_if_not_eq, br_if_null)
(br_if_not_null): Pop to locals before doing the compare and jump.
Diffstat (limited to 'libguile/vm-engine.c')
-rw-r--r-- | libguile/vm-engine.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index ab9ffc98c..bfa848967 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -20,12 +20,14 @@ #if (VM_ENGINE == SCM_VM_REGULAR_ENGINE) #define VM_USE_HOOKS 0 /* Various hooks */ -#define VM_CHECK_OBJECT 1 /* Check object table */ -#define VM_CHECK_FREE_VARIABLES 1 /* Check free variable access */ +#define VM_CHECK_OBJECT 0 /* Check object table */ +#define VM_CHECK_FREE_VARIABLES 0 /* Check free variable access */ +#define VM_CHECK_UNDERFLOW 0 /* Check underflow when popping values */ #elif (VM_ENGINE == SCM_VM_DEBUG_ENGINE) #define VM_USE_HOOKS 1 -#define VM_CHECK_OBJECT 1 -#define VM_CHECK_FREE_VARIABLES 1 +#define VM_CHECK_OBJECT 0 +#define VM_CHECK_FREE_VARIABLES 0 +#define VM_CHECK_UNDERFLOW 0 /* Check underflow when popping values */ #else #error unknown debug engine VM_ENGINE #endif @@ -45,7 +47,9 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs) /* Cache variables */ struct scm_objcode *bp = NULL; /* program base pointer */ SCM *objects = NULL; /* constant objects */ +#if VM_CHECK_OBJECT size_t object_count = 0; /* length of OBJECTS */ +#endif SCM *stack_limit = vp->stack_limit; /* stack limit address */ SCM dynstate = SCM_I_CURRENT_THREAD->dynamic_state; @@ -298,6 +302,7 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs) #undef VM_USE_HOOKS #undef VM_CHECK_OBJECT #undef VM_CHECK_FREE_VARIABLE +#undef VM_CHECK_UNDERFLOW /* Local Variables: |