[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/10] remove some configurability in vm-engine
From: |
Andy Wingo |
Subject: |
[PATCH 04/10] remove some configurability in vm-engine |
Date: |
Thu, 23 May 2013 15:30:57 +0200 |
* 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.
---
libguile/vm-engine.c | 38 +++-----------------------------------
libguile/vm.c | 32 --------------------------------
2 files changed, 3 insertions(+), 67 deletions(-)
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 3278783..98e9837 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -19,17 +19,11 @@
/* This file is included in vm.c multiple times */
#if (VM_ENGINE == SCM_VM_REGULAR_ENGINE)
-#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
*/
+# define VM_USE_HOOKS 0 /* Various hooks */
#elif (VM_ENGINE == SCM_VM_DEBUG_ENGINE)
-#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
*/
+# define VM_USE_HOOKS 1
#else
-#error unknown debug engine VM_ENGINE
+# error unknown debug engine VM_ENGINE
#endif
@@ -163,12 +157,6 @@
#define ASSERT_BOUND(x)
#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. */
#define CACHE_PROGRAM()
\
{ \
@@ -177,10 +165,8 @@
ASSERT_ALIGNED_PROCEDURE (); \
if (SCM_I_IS_VECTOR (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 { \
objects = NULL; \
- SET_OBJECT_COUNT (0); \
} \
} \
}
@@ -201,20 +187,8 @@
*/
/* 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)
-#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)
-#endif
/*
@@ -377,9 +351,6 @@ 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_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_HOOK1
#undef VM_USE_HOOKS
-#undef VM_CHECK_OBJECT
-#undef VM_CHECK_FREE_VARIABLE
-#undef VM_CHECK_UNDERFLOW
/*
Local Variables:
diff --git a/libguile/vm.c b/libguile/vm.c
index ccc182a..0b0650d 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -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_continuation_not_rewindable (SCM cont) 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
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));
}
-#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
--
1.7.10.4
- Add RTL VM, Andy Wingo, 2013/05/23
- [PATCH 01/10] inline vm-engine.h into vm-engine.c, Andy Wingo, 2013/05/23
- [PATCH 03/10] minor vm-engine cleanups, Andy Wingo, 2013/05/23
- [PATCH 02/10] remove CONS macro in VM; use scm_cons instead, Andy Wingo, 2013/05/23
- [PATCH 04/10] remove some configurability in vm-engine,
Andy Wingo <=
- [PATCH 05/10] vm-engine: remove register assignments, Andy Wingo, 2013/05/23
- [PATCH 06/10] Allow vm_engine caller to pass arguments on the stack., Andy Wingo, 2013/05/23
- [PATCH 08/10] cpp hygiene in the vm, Andy Wingo, 2013/05/23
- [PATCH 07/10] pop-continuation abort-continuation hooks pass return vals directly, Andy Wingo, 2013/05/23
- [PATCH 09/10] refactor to resolve_variable, Andy Wingo, 2013/05/23
- [PATCH 10/10] add new rtl vm, Andy Wingo, 2013/05/23