1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-15 16:20:17 +02:00

Simplify state sync in VM before potential bailout.

* libguile/vm-engine.c (SYNC_IP): Remove calls to SYNC_BEFORE_GC, a
  no-op.  Replace SYNC_REGISTER / SYNC_ALL calls with just SYNC_IP.
This commit is contained in:
Andy Wingo 2013-11-22 18:06:35 +01:00
parent 1cdf9b788e
commit 56280be983

View file

@ -88,7 +88,7 @@
do { \ do { \
if (SCM_UNLIKELY (!(condition))) \ if (SCM_UNLIKELY (!(condition))) \
{ \ { \
SYNC_ALL(); \ SYNC_IP(); \
handler; \ handler; \
} \ } \
} while (0) } while (0)
@ -104,7 +104,7 @@
do { \ do { \
if (SCM_UNLIKELY (vp->trace_level > 0)) \ if (SCM_UNLIKELY (vp->trace_level > 0)) \
{ \ { \
SYNC_REGISTER (); \ SYNC_IP (); \
exp; \ exp; \
} \ } \
} while (0) } while (0)
@ -128,7 +128,7 @@
RUN_HOOK0 (restore_continuation) RUN_HOOK0 (restore_continuation)
#define VM_HANDLE_INTERRUPTS \ #define VM_HANDLE_INTERRUPTS \
SCM_ASYNC_TICK_WITH_CODE (current_thread, SYNC_REGISTER ()) SCM_ASYNC_TICK_WITH_CODE (current_thread, SYNC_IP ())
/* Virtual Machine /* Virtual Machine
@ -159,14 +159,8 @@
would like to walk the stack, perhaps as the result of an would like to walk the stack, perhaps as the result of an
exception. */ exception. */
#define SYNC_IP() \ #define SYNC_IP() vp->ip = (ip)
vp->ip = (ip)
#define SYNC_REGISTER() \
SYNC_IP()
#define SYNC_BEFORE_GC() /* Only SP and FP needed to trace GC */
#define SYNC_ALL() /* FP already saved */ \
SYNC_IP()
/* After advancing vp->sp, but before writing any stack slots, check /* After advancing vp->sp, but before writing any stack slots, check
that it is actually in bounds. If it is not in bounds, currently we that it is actually in bounds. If it is not in bounds, currently we
@ -177,8 +171,9 @@
do { \ do { \
if (SCM_UNLIKELY (vp->sp >= vp->stack_limit)) \ if (SCM_UNLIKELY (vp->sp >= vp->stack_limit)) \
{ \ { \
vm_error_stack_overflow (vp); \ SYNC_IP (); \
CACHE_REGISTER(); \ vm_expand_stack (vp); \
CACHE_REGISTER (); \
} \ } \
} while (0) } while (0)
@ -518,7 +513,6 @@ VM_NAME (scm_i_thread *current_thread, struct scm_vm *vp,
{ {
scm_t_uint32 n; scm_t_uint32 n;
ret = SCM_EOL; ret = SCM_EOL;
SYNC_BEFORE_GC();
for (n = nvals; n > 0; n--) for (n = nvals; n > 0; n--)
ret = scm_cons (LOCAL_REF (4 + n - 1), ret); ret = scm_cons (LOCAL_REF (4 + n - 1), ret);
ret = scm_values (ret); ret = scm_values (ret);
@ -3232,10 +3226,7 @@ VM_NAME (scm_i_thread *current_thread, struct scm_vm *vp,
#undef RUN_HOOK #undef RUN_HOOK
#undef RUN_HOOK0 #undef RUN_HOOK0
#undef RUN_HOOK1 #undef RUN_HOOK1
#undef SYNC_ALL
#undef SYNC_BEFORE_GC
#undef SYNC_IP #undef SYNC_IP
#undef SYNC_REGISTER
#undef UNPACK_8_8_8 #undef UNPACK_8_8_8
#undef UNPACK_8_16 #undef UNPACK_8_16
#undef UNPACK_16_8 #undef UNPACK_16_8