[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 10/13: Remove "resume" arg from vm engine
From: |
Andy Wingo |
Subject: |
[Guile-commits] 10/13: Remove "resume" arg from vm engine |
Date: |
Wed, 27 Jun 2018 14:00:13 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 9c8c4060dd61fd9eb1296a17f6496a1fe2537494
Author: Andy Wingo <address@hidden>
Date: Wed Jun 27 18:57:37 2018 +0200
Remove "resume" arg from vm engine
* libguile/vm-engine.c (vm_engine): Remove "resume" argument; scm_call_n
will handle the differences.
* libguile/vm.c (scm_call_n): Inline handling of what to do in normal
and resume cases. Remove resume argument to vm_engine.
---
libguile/vm-engine.c | 20 ++------------------
libguile/vm.c | 15 +++++++++++++--
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 2409af9..9e0e0ef 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -272,7 +272,7 @@
((uintptr_t) (ptr) % alignof_type (type) == 0)
static SCM
-VM_NAME (scm_thread *thread, int resume)
+VM_NAME (scm_thread *thread)
{
/* Instruction pointer: A pointer to the opcode that is currently
running. */
@@ -303,23 +303,7 @@ VM_NAME (scm_thread *thread, int resume)
/* Load VM registers. */
CACHE_REGISTER ();
- /* Usually a call to the VM happens on application, with the boot
- continuation on the next frame. Sometimes it happens after a
- non-local exit however; in that case the VM state is all set up,
- and we have but to jump to the next opcode. */
- if (SCM_UNLIKELY (resume))
- NEXT (0);
-
- if (SCM_LIKELY (SCM_PROGRAM_P (FP_REF (0))))
- ip = SCM_PROGRAM_CODE (FP_REF (0));
- else
- {
- CALL_INTRINSIC (apply_non_program, (thread));
- CACHE_REGISTER ();
- }
-
- APPLY_HOOK ();
-
+ /* Start processing! */
NEXT (0);
BEGIN_DISPATCH_SWITCH;
diff --git a/libguile/vm.c b/libguile/vm.c
index ef423b0..e28f3f6 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -464,7 +464,7 @@ scm_i_call_with_current_continuation (SCM proc)
#undef VM_USE_HOOKS
#undef VM_NAME
-typedef SCM (*scm_t_vm_engine) (scm_thread *current_thread, int resume);
+typedef SCM (*scm_t_vm_engine) (scm_thread *current_thread);
static const scm_t_vm_engine vm_engines[SCM_VM_NUM_ENGINES] =
{ vm_regular_engine, vm_debug_engine };
@@ -1420,9 +1420,20 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
/* Non-local return. */
vm_dispatch_abort_hook (vp);
}
+ else
+ {
+ if (SCM_LIKELY (SCM_PROGRAM_P (proc)))
+ vp->ip = SCM_PROGRAM_CODE (proc);
+ else
+ /* FIXME: Make this return an IP. */
+ apply_non_program (thread);
+
+ if (vp->engine == SCM_VM_DEBUG_ENGINE && vp->trace_level > 0)
+ vm_dispatch_apply_hook (vp);
+ }
thread->vm.registers = ®isters;
- ret = vm_engines[vp->engine](thread, resume);
+ ret = vm_engines[vp->engine](thread);
thread->vm.registers = prev_registers;
return ret;
- [Guile-commits] 07/13: Refactor handling of active VM registers, (continued)
- [Guile-commits] 07/13: Refactor handling of active VM registers, Andy Wingo, 2018/06/27
- [Guile-commits] 05/13: bind-rest inst uses cons-rest intrinsic, Andy Wingo, 2018/06/27
- [Guile-commits] 11/13: Minor optimizations to debug hook dispatch, Andy Wingo, 2018/06/27
- [Guile-commits] 02/13: Compile current-module as intrinsic call, Andy Wingo, 2018/06/27
- [Guile-commits] 12/13: Microoptimizations to hook dispatch, Andy Wingo, 2018/06/27
- [Guile-commits] 13/13: Refactor hook dispatch in VM, Andy Wingo, 2018/06/27
- [Guile-commits] 09/13: Intrinsics take registers from thread, Andy Wingo, 2018/06/27
- [Guile-commits] 06/13: Use CALL_INTRINSICS helper in VM, Andy Wingo, 2018/06/27
- [Guile-commits] 08/13: Minor scm_thread refactoring, Andy Wingo, 2018/06/27
- [Guile-commits] 03/13: Remove dedicated current-module instruction., Andy Wingo, 2018/06/27
- [Guile-commits] 10/13: Remove "resume" arg from vm engine,
Andy Wingo <=