mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 17:50:29 +02:00
remove some configurability in vm-engine
* libguile/vm-engine.c: Remove the ability for the VM to check object access, free variable access, and the ip. They were off by default. Since they will be different in the RTL VM, their presence is just making things confusing. * libguile/vm.c: Remove corresponding error helpers.
This commit is contained in:
parent
27c7c630a1
commit
ff3968c22d
2 changed files with 3 additions and 67 deletions
|
@ -19,17 +19,11 @@
|
||||||
/* This file is included in vm.c multiple times */
|
/* This file is included in vm.c multiple times */
|
||||||
|
|
||||||
#if (VM_ENGINE == SCM_VM_REGULAR_ENGINE)
|
#if (VM_ENGINE == SCM_VM_REGULAR_ENGINE)
|
||||||
#define VM_USE_HOOKS 0 /* Various hooks */
|
# define VM_USE_HOOKS 0 /* Various hooks */
|
||||||
#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)
|
#elif (VM_ENGINE == SCM_VM_DEBUG_ENGINE)
|
||||||
#define VM_USE_HOOKS 1
|
# define VM_USE_HOOKS 1
|
||||||
#define VM_CHECK_OBJECT 0
|
|
||||||
#define VM_CHECK_FREE_VARIABLES 0
|
|
||||||
#define VM_CHECK_UNDERFLOW 0 /* Check underflow when popping values */
|
|
||||||
#else
|
#else
|
||||||
#error unknown debug engine VM_ENGINE
|
# error unknown debug engine VM_ENGINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,12 +157,6 @@
|
||||||
#define ASSERT_BOUND(x)
|
#define ASSERT_BOUND(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if VM_CHECK_OBJECT
|
|
||||||
#define SET_OBJECT_COUNT(n) object_count = n
|
|
||||||
#else
|
|
||||||
#define SET_OBJECT_COUNT(n) /* nop */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Cache the object table and free variables. */
|
/* Cache the object table and free variables. */
|
||||||
#define CACHE_PROGRAM() \
|
#define CACHE_PROGRAM() \
|
||||||
{ \
|
{ \
|
||||||
|
@ -177,10 +165,8 @@
|
||||||
ASSERT_ALIGNED_PROCEDURE (); \
|
ASSERT_ALIGNED_PROCEDURE (); \
|
||||||
if (SCM_I_IS_VECTOR (SCM_PROGRAM_OBJTABLE (program))) { \
|
if (SCM_I_IS_VECTOR (SCM_PROGRAM_OBJTABLE (program))) { \
|
||||||
objects = SCM_I_VECTOR_WELTS (SCM_PROGRAM_OBJTABLE (program)); \
|
objects = SCM_I_VECTOR_WELTS (SCM_PROGRAM_OBJTABLE (program)); \
|
||||||
SET_OBJECT_COUNT (SCM_I_VECTOR_LENGTH (SCM_PROGRAM_OBJTABLE (program))); \
|
|
||||||
} else { \
|
} else { \
|
||||||
objects = NULL; \
|
objects = NULL; \
|
||||||
SET_OBJECT_COUNT (0); \
|
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -201,20 +187,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Accesses to a program's object table. */
|
/* Accesses to a program's object table. */
|
||||||
#if VM_CHECK_OBJECT
|
|
||||||
#define CHECK_OBJECT(_num) \
|
|
||||||
VM_ASSERT ((_num) < object_count, vm_error_object ())
|
|
||||||
#else
|
|
||||||
#define CHECK_OBJECT(_num)
|
#define CHECK_OBJECT(_num)
|
||||||
#endif
|
|
||||||
|
|
||||||
#if VM_CHECK_FREE_VARIABLES
|
|
||||||
#define CHECK_FREE_VARIABLE(_num) \
|
|
||||||
VM_ASSERT ((_num) < SCM_PROGRAM_NUM_FREE_VARIABLES (program), \
|
|
||||||
vm_error_free_variable ())
|
|
||||||
#else
|
|
||||||
#define CHECK_FREE_VARIABLE(_num)
|
#define CHECK_FREE_VARIABLE(_num)
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -377,9 +351,6 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
|
||||||
/* Cache variables */
|
/* Cache variables */
|
||||||
struct scm_objcode *bp = NULL; /* program base pointer */
|
struct scm_objcode *bp = NULL; /* program base pointer */
|
||||||
SCM *objects = NULL; /* constant objects */
|
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 *stack_limit = vp->stack_limit; /* stack limit address */
|
||||||
|
|
||||||
scm_i_thread *current_thread = SCM_I_CURRENT_THREAD;
|
scm_i_thread *current_thread = SCM_I_CURRENT_THREAD;
|
||||||
|
@ -518,9 +489,6 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
|
||||||
#undef RUN_HOOK
|
#undef RUN_HOOK
|
||||||
#undef RUN_HOOK1
|
#undef RUN_HOOK1
|
||||||
#undef VM_USE_HOOKS
|
#undef VM_USE_HOOKS
|
||||||
#undef VM_CHECK_OBJECT
|
|
||||||
#undef VM_CHECK_FREE_VARIABLE
|
|
||||||
#undef VM_CHECK_UNDERFLOW
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
|
|
|
@ -408,15 +408,6 @@ static void vm_error_no_values (void) SCM_NORETURN SCM_NOINLINE;
|
||||||
static void vm_error_not_enough_values (void) SCM_NORETURN SCM_NOINLINE;
|
static void vm_error_not_enough_values (void) SCM_NORETURN SCM_NOINLINE;
|
||||||
static void vm_error_continuation_not_rewindable (SCM cont) SCM_NORETURN SCM_NOINLINE;
|
static void vm_error_continuation_not_rewindable (SCM cont) SCM_NORETURN SCM_NOINLINE;
|
||||||
static void vm_error_bad_wide_string_length (size_t len) SCM_NORETURN SCM_NOINLINE;
|
static void vm_error_bad_wide_string_length (size_t len) SCM_NORETURN SCM_NOINLINE;
|
||||||
#if VM_CHECK_IP
|
|
||||||
static void vm_error_invalid_address (void) SCM_NORETURN SCM_NOINLINE;
|
|
||||||
#endif
|
|
||||||
#if VM_CHECK_OBJECT
|
|
||||||
static void vm_error_object (void) SCM_NORETURN SCM_NOINLINE;
|
|
||||||
#endif
|
|
||||||
#if VM_CHECK_FREE_VARIABLES
|
|
||||||
static void vm_error_free_variable (void) SCM_NORETURN SCM_NOINLINE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vm_error (const char *msg, SCM arg)
|
vm_error (const char *msg, SCM arg)
|
||||||
|
@ -575,29 +566,6 @@ vm_error_bad_wide_string_length (size_t len)
|
||||||
vm_error ("VM: Bad wide string length: ~S", scm_from_size_t (len));
|
vm_error ("VM: Bad wide string length: ~S", scm_from_size_t (len));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VM_CHECK_IP
|
|
||||||
static void
|
|
||||||
vm_error_invalid_address (void)
|
|
||||||
{
|
|
||||||
vm_error ("VM: Invalid program address", SCM_UNDEFINED);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if VM_CHECK_OBJECT
|
|
||||||
static void
|
|
||||||
vm_error_object ()
|
|
||||||
{
|
|
||||||
vm_error ("VM: Invalid object table access", SCM_UNDEFINED);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if VM_CHECK_FREE_VARIABLES
|
|
||||||
static void
|
|
||||||
vm_error_free_variable ()
|
|
||||||
{
|
|
||||||
vm_error ("VM: Invalid free variable access", SCM_UNDEFINED);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue